Completed
Pull Request — master (#1336)
by Devin
16:29
created
includes/admin/reporting/class-export.php 1 patch
Spacing   +27 added lines, -27 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
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @return bool Whether we can export or not
38 38
 	 */
39 39
 	public function can_export() {
40
-		return (bool) apply_filters( 'give_export_capability', current_user_can( 'export_give_reports' ) );
40
+		return (bool) apply_filters('give_export_capability', current_user_can('export_give_reports'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 	 * @return void
49 49
 	 */
50 50
 	public function headers() {
51
-		ignore_user_abort( true );
51
+		ignore_user_abort(true);
52 52
 
53
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
54
-			set_time_limit( 0 );
53
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
54
+			set_time_limit(0);
55 55
 		}
56 56
 
57 57
 		nocache_headers();
58
-		header( 'Content-Type: text/csv; charset=utf-8' );
59
-		header( 'Content-Disposition: attachment; filename=give-export-' . $this->export_type . '-' . date( 'm-d-Y' ) . '.csv' );
60
-		header( "Expires: 0" );
58
+		header('Content-Type: text/csv; charset=utf-8');
59
+		header('Content-Disposition: attachment; filename=give-export-'.$this->export_type.'-'.date('m-d-Y').'.csv');
60
+		header("Expires: 0");
61 61
 	}
62 62
 
63 63
 	/**
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public function csv_cols() {
71 71
 		$cols = array(
72
-			'id'   => esc_html__( 'ID', 'give' ),
73
-			'date' => esc_html__( 'Date', 'give' )
72
+			'id'   => esc_html__('ID', 'give'),
73
+			'date' => esc_html__('Date', 'give')
74 74
 		);
75 75
 
76 76
 		return $cols;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	public function get_csv_cols() {
87 87
 		$cols = $this->csv_cols();
88 88
 
89
-		return apply_filters( "give_export_csv_cols_{$this->export_type}", $cols );
89
+		return apply_filters("give_export_csv_cols_{$this->export_type}", $cols);
90 90
 	}
91 91
 
92 92
 	/**
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	public function csv_cols_out() {
101 101
 		$cols = $this->get_csv_cols();
102 102
 		$i    = 1;
103
-		foreach ( $cols as $col_id => $column ) {
104
-			echo '"' . addslashes( $column ) . '"';
105
-			echo $i == count( $cols ) ? '' : ',';
106
-			$i ++;
103
+		foreach ($cols as $col_id => $column) {
104
+			echo '"'.addslashes($column).'"';
105
+			echo $i == count($cols) ? '' : ',';
106
+			$i++;
107 107
 		}
108 108
 		echo "\r\n";
109 109
 	}
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 		$data = array(
121 121
 			0 => array(
122 122
 				'id'   => '',
123
-				'data' => date( 'F j, Y' )
123
+				'data' => date('F j, Y')
124 124
 			),
125 125
 			1 => array(
126 126
 				'id'   => '',
127
-				'data' => date( 'F j, Y' )
127
+				'data' => date('F j, Y')
128 128
 			)
129 129
 		);
130 130
 
131
-		$data = apply_filters( 'give_export_get_data', $data );
132
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
131
+		$data = apply_filters('give_export_get_data', $data);
132
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
133 133
 
134 134
 		return $data;
135 135
 	}
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 		$cols = $this->get_csv_cols();
148 148
 
149 149
 		// Output each row
150
-		foreach ( $data as $row ) {
150
+		foreach ($data as $row) {
151 151
 			$i = 1;
152
-			foreach ( $row as $col_id => $column ) {
152
+			foreach ($row as $col_id => $column) {
153 153
 				// Make sure the column is valid
154
-				if ( array_key_exists( $col_id, $cols ) ) {
155
-					echo '"' . addslashes( $column ) . '"';
156
-					echo $i == count( $cols ) ? '' : ',';
157
-					$i ++;
154
+				if (array_key_exists($col_id, $cols)) {
155
+					echo '"'.addslashes($column).'"';
156
+					echo $i == count($cols) ? '' : ',';
157
+					$i++;
158 158
 				}
159 159
 			}
160 160
 			echo "\r\n";
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @return void
174 174
 	 */
175 175
 	public function export() {
176
-		if ( ! $this->can_export() ) {
177
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
176
+		if ( ! $this->can_export()) {
177
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
178 178
 		}
179 179
 
180 180
 		// Set headers
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 		// Set parent defaults.
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records.
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records.
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records.
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records.
50 50
 			'ajax'     => false                        // Does this table support ajax?.
51
-		) );
51
+		));
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,19 +62,19 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Column Name.
64 64
 	 */
65
-	public function column_default( $item, $column_name ) {
65
+	public function column_default($item, $column_name) {
66 66
 
67
-		switch ( $column_name ) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'payment_id' :
71
-				return empty( $item->payment_id ) ? esc_html__( 'n/a', 'give' ) : $item->payment_id;
71
+				return empty($item->payment_id) ? esc_html__('n/a', 'give') : $item->payment_id;
72 72
 			case 'gateway' :
73
-				return empty( $item->gateway ) ? esc_html__( 'n/a', 'give' ) : $item->gateway;
73
+				return empty($item->gateway) ? esc_html__('n/a', 'give') : $item->gateway;
74 74
 			case 'error' :
75
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
75
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
76 76
 			default:
77
-				return $item[ $column_name ];
77
+				return $item[$column_name];
78 78
 		}
79 79
 	}
80 80
 
@@ -88,27 +88,27 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return void
90 90
 	 */
91
-	public function column_message( $item ) { ?>
92
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e( 'View Log Message', 'give' ); ?>"><span class="dashicons dashicons-visibility"></span></a>
91
+	public function column_message($item) { ?>
92
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox give-error-log-details-link button button-small" data-tooltip="<?php esc_attr_e('View Log Message', 'give'); ?>"><span class="dashicons dashicons-visibility"></span></a>
93 93
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
94 94
 			<?php
95 95
 
96
-			$log_message = get_post_field( 'post_content', $item['ID'] );
96
+			$log_message = get_post_field('post_content', $item['ID']);
97 97
 
98
-			$serialized = strpos( $log_message, '{"' );
98
+			$serialized = strpos($log_message, '{"');
99 99
 
100 100
 			// Check to see if the log message contains serialized information
101
-			if ( $serialized !== false ) {
102
-				$length = strlen( $log_message ) - $serialized;
103
-				$intro  = substr( $log_message, 0, - $length );
104
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
101
+			if ($serialized !== false) {
102
+				$length = strlen($log_message) - $serialized;
103
+				$intro  = substr($log_message, 0, - $length);
104
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
105 105
 
106
-				echo wpautop( $intro );
107
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
108
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
106
+				echo wpautop($intro);
107
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
108
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
109 109
 			} else {
110 110
 				// No serialized data found
111
-				echo wpautop( $log_message );
111
+				echo wpautop($log_message);
112 112
 			}
113 113
 			?>
114 114
 		</div>
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
 	 */
125 125
 	public function get_columns() {
126 126
 		$columns = array(
127
-			'ID'         => esc_html__( 'Log ID', 'give' ),
128
-			'error'      => esc_html__( 'Error', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'payment_id' => esc_html__( 'Donation ID', 'give' ),
131
-			'date'       => esc_html__( 'Date', 'give' ),
132
-			'message'    => esc_html__( 'Details', 'give' )
127
+			'ID'         => esc_html__('Log ID', 'give'),
128
+			'error'      => esc_html__('Error', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'payment_id' => esc_html__('Donation ID', 'give'),
131
+			'date'       => esc_html__('Date', 'give'),
132
+			'message'    => esc_html__('Details', 'give')
133 133
 		);
134 134
 
135 135
 		return $columns;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return int Current page number
144 144
 	 */
145 145
 	public function get_paged() {
146
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
146
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
147 147
 	}
148 148
 
149 149
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @since  1.0
154 154
 	 * @return void
155 155
 	 */
156
-	public function bulk_actions( $which = '' ) {
156
+	public function bulk_actions($which = '') {
157 157
 		give_log_views();
158 158
 	}
159 159
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 		// Prevent the queries from getting cached.
173 173
 		// Without this there are occasional memory issues for some installs.
174
-		wp_suspend_cache_addition( true );
174
+		wp_suspend_cache_addition(true);
175 175
 
176 176
 		$logs_data = array();
177 177
 		$paged     = $this->get_paged();
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 			'paged'    => $paged
181 181
 		);
182 182
 
183
-		$logs = $give_logs->get_connected_logs( $log_query );
183
+		$logs = $give_logs->get_connected_logs($log_query);
184 184
 
185
-		if ( $logs ) {
186
-			foreach ( $logs as $log ) {
185
+		if ($logs) {
186
+			foreach ($logs as $log) {
187 187
 
188 188
 				$logs_data[] = array(
189 189
 					'ID'         => $log->ID,
190
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
190
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
191 191
 					'payment_id' => $log->post_parent,
192 192
 					'error'      => 'error',
193
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
193
+					'gateway'    => give_get_payment_gateway($log->post_parent),
194 194
 					'date'       => $log->post_date
195 195
 				);
196 196
 			}
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @param string $which
214 214
 	 */
215
-	protected function display_tablenav( $which ) {
216
-		if ( 'top' === $which ) {
217
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
215
+	protected function display_tablenav($which) {
216
+		if ('top' === $which) {
217
+			wp_nonce_field('bulk-'.$this->_args['plural']);
218 218
 		}
219 219
 		?>
220
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
220
+		<div class="tablenav <?php echo esc_attr($which); ?>">
221 221
 
222 222
 			<div class="alignleft actions bulkactions">
223
-				<?php $this->bulk_actions( $which ); ?>
223
+				<?php $this->bulk_actions($which); ?>
224 224
 			</div>
225 225
 			<?php
226
-			$this->extra_tablenav( $which );
227
-			$this->pagination( $which );
226
+			$this->extra_tablenav($which);
227
+			$this->pagination($which);
228 228
 			?>
229 229
 
230 230
 			<br class="clear"/>
@@ -251,14 +251,14 @@  discard block
 block discarded – undo
251 251
 		$columns               = $this->get_columns();
252 252
 		$hidden                = array(); // No hidden columns
253 253
 		$sortable              = $this->get_sortable_columns();
254
-		$this->_column_headers = array( $columns, $hidden, $sortable );
254
+		$this->_column_headers = array($columns, $hidden, $sortable);
255 255
 		$this->items           = $this->get_logs();
256
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
256
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
257 257
 
258
-		$this->set_pagination_args( array(
258
+		$this->set_pagination_args(array(
259 259
 				'total_items' => $total_items,
260 260
 				'per_page'    => $this->per_page,
261
-				'total_pages' => ceil( $total_items / $this->per_page )
261
+				'total_pages' => ceil($total_items / $this->per_page)
262 262
 			)
263 263
 		);
264 264
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-export-earnings.php 1 patch
Spacing   +28 added lines, -28 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
 
@@ -38,16 +38,16 @@  discard block
 block discarded – undo
38 38
 	 * @return void
39 39
 	 */
40 40
 	public function headers() {
41
-		ignore_user_abort( true );
41
+		ignore_user_abort(true);
42 42
 
43
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
44
-			set_time_limit( 0 );
43
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
44
+			set_time_limit(0);
45 45
 		}
46 46
 
47 47
 		nocache_headers();
48
-		header( 'Content-Type: text/csv; charset=utf-8' );
49
-		header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' );
50
-		header( "Expires: 0" );
48
+		header('Content-Type: text/csv; charset=utf-8');
49
+		header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv');
50
+		header("Expires: 0");
51 51
 
52 52
 	}
53 53
 
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	public function csv_cols() {
62 62
 
63 63
 		$cols = array(
64
-			'date'      => esc_html__( 'Date', 'give' ),
65
-			'donations' => esc_html__( 'Donations', 'give' ),
64
+			'date'      => esc_html__('Date', 'give'),
65
+			'donations' => esc_html__('Donations', 'give'),
66 66
 			/* translators: %s: currency */
67
-			'earnings'  => sprintf( esc_html__( 'Income (%s)', 'give' ), html_entity_decode( give_currency_filter( '' ) ) )
67
+			'earnings'  => sprintf(esc_html__('Income (%s)', 'give'), html_entity_decode(give_currency_filter('')))
68 68
 		);
69 69
 
70 70
 		return $cols;
@@ -79,28 +79,28 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function get_data() {
81 81
 
82
-		$start_year  = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' );
83
-		$end_year    = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' );
84
-		$start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' );
85
-		$end_month   = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' );
82
+		$start_year  = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y');
83
+		$end_year    = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y');
84
+		$start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n');
85
+		$end_month   = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n');
86 86
 
87 87
 		$data  = array();
88 88
 		$year  = $start_year;
89 89
 		$stats = new Give_Payment_Stats;
90 90
 
91
-		while ( $year <= $end_year ) {
91
+		while ($year <= $end_year) {
92 92
 
93
-			if ( $year == $start_year && $year == $end_year ) {
93
+			if ($year == $start_year && $year == $end_year) {
94 94
 
95 95
 				$m1 = $start_month;
96 96
 				$m2 = $end_month;
97 97
 
98
-			} elseif ( $year == $start_year ) {
98
+			} elseif ($year == $start_year) {
99 99
 
100 100
 				$m1 = $start_month;
101 101
 				$m2 = 12;
102 102
 
103
-			} elseif ( $year == $end_year ) {
103
+			} elseif ($year == $end_year) {
104 104
 
105 105
 				$m1 = 1;
106 106
 				$m2 = $end_month;
@@ -112,28 +112,28 @@  discard block
 block discarded – undo
112 112
 
113 113
 			}
114 114
 
115
-			while ( $m1 <= $m2 ) {
115
+			while ($m1 <= $m2) {
116 116
 
117
-				$date1 = mktime( 0, 0, 0, $m1, 1, $year );
118
-				$date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year );
117
+				$date1 = mktime(0, 0, 0, $m1, 1, $year);
118
+				$date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year);
119 119
 
120 120
 				$data[] = array(
121
-					'date'      => date_i18n( 'F Y', $date1 ),
122
-					'donations' => $stats->get_sales( 0, $date1, $date2 ),
123
-					'earnings'  => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ) ),
121
+					'date'      => date_i18n('F Y', $date1),
122
+					'donations' => $stats->get_sales(0, $date1, $date2),
123
+					'earnings'  => give_format_amount($stats->get_earnings(0, $date1, $date2)),
124 124
 				);
125 125
 
126
-				$m1 ++;
126
+				$m1++;
127 127
 
128 128
 			}
129 129
 
130 130
 
131
-			$year ++;
131
+			$year++;
132 132
 
133 133
 		}
134 134
 
135
-		$data = apply_filters( 'give_export_get_data', $data );
136
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
135
+		$data = apply_filters('give_export_get_data', $data);
136
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
137 137
 
138 138
 		return $data;
139 139
 	}
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 2 patches
Spacing   +13 added lines, -13 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
 
@@ -24,51 +24,51 @@  discard block
 block discarded – undo
24 24
 function give_hide_subscription_notices() {
25 25
 
26 26
     // Hide subscription notices permanently.
27
-    if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
27
+    if ( ! empty($_GET['_give_hide_license_notices_permanently'])) {
28 28
         global $current_user;
29 29
 
30 30
         // check previously disabled notice ids.
31
-        $already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
31
+        $already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true))
32 32
             ? $already_dismiss_notices
33 33
             : array();
34 34
 
35 35
         // Get notice id.
36
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
36
+        $notice_id = sanitize_text_field($_GET['_give_hide_license_notices_permanently']);
37 37
 
38
-        if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
38
+        if ( ! in_array($notice_id, $already_dismiss_notices)) {
39 39
             $already_dismiss_notices[] = $notice_id;
40 40
         }
41 41
 
42 42
         // Store subscription ids.
43
-        update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
43
+        update_user_meta($current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices);
44 44
 
45 45
         // Redirect user.
46
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
46
+        wp_safe_redirect(remove_query_arg('_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI']));
47 47
         exit();
48 48
     }
49 49
 
50 50
     // Hide subscription notices shortly.
51
-    if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
51
+    if ( ! empty($_GET['_give_hide_license_notices_shortly'])) {
52 52
         global $current_user;
53 53
 
54 54
         // Get notice id.
55
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
55
+        $notice_id = sanitize_text_field($_GET['_give_hide_license_notices_shortly']);
56 56
 
57 57
         // Transient key name.
58 58
         $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-        if( get_transient( $transient_key ) ) {
60
+        if (get_transient($transient_key)) {
61 61
             return;
62 62
         }
63 63
 
64 64
 
65 65
         // Hide notice for 24 hours.
66
-        set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
66
+        set_transient($transient_key, true, 24 * HOUR_IN_SECONDS);
67 67
 
68 68
         // Redirect user.
69
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
69
+        wp_safe_redirect(remove_query_arg('_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI']));
70 70
         exit();
71 71
     }
72 72
 }
73 73
 
74
-add_action( 'admin_init', 'give_hide_subscription_notices' );
75 74
\ No newline at end of file
75
+add_action('admin_init', 'give_hide_subscription_notices');
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,52 +23,52 @@
 block discarded – undo
23 23
  */
24 24
 function give_hide_subscription_notices() {
25 25
 
26
-    // Hide subscription notices permanently.
27
-    if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
28
-        $current_user = wp_get_current_user();
26
+	// Hide subscription notices permanently.
27
+	if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
28
+		$current_user = wp_get_current_user();
29 29
 
30
-        // check previously disabled notice ids.
31
-        $already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
32
-            ? $already_dismiss_notices
33
-            : array();
30
+		// check previously disabled notice ids.
31
+		$already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
32
+			? $already_dismiss_notices
33
+			: array();
34 34
 
35
-        // Get notice id.
36
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
35
+		// Get notice id.
36
+		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
37 37
 
38
-        if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
39
-            $already_dismiss_notices[] = $notice_id;
40
-        }
38
+		if( ! in_array( $notice_id, $already_dismiss_notices ) ) {
39
+			$already_dismiss_notices[] = $notice_id;
40
+		}
41 41
 
42
-        // Store subscription ids.
43
-        update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
42
+		// Store subscription ids.
43
+		update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
44 44
 
45
-        // Redirect user.
46
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
47
-        exit();
48
-    }
45
+		// Redirect user.
46
+		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
47
+		exit();
48
+	}
49 49
 
50
-    // Hide subscription notices shortly.
51
-    if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
52
-        $current_user = wp_get_current_user();
50
+	// Hide subscription notices shortly.
51
+	if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
52
+		$current_user = wp_get_current_user();
53 53
 
54
-        // Get notice id.
55
-        $notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
54
+		// Get notice id.
55
+		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
56 56
 
57
-        // Transient key name.
58
-        $transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
57
+		// Transient key name.
58
+		$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-        if( get_transient( $transient_key ) ) {
61
-            return;
62
-        }
60
+		if( get_transient( $transient_key ) ) {
61
+			return;
62
+		}
63 63
 
64 64
 
65
-        // Hide notice for 24 hours.
66
-        set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
65
+		// Hide notice for 24 hours.
66
+		set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
67 67
 
68
-        // Redirect user.
69
-        wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
70
-        exit();
71
-    }
68
+		// Redirect user.
69
+		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
70
+		exit();
71
+	}
72 72
 }
73 73
 
74 74
 add_action( 'admin_init', 'give_hide_subscription_notices' );
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/customers/customer-actions.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
  * and redirect back to the donor interface for feedback
544 544
  *
545 545
  * @since  1.7
546
- * @return void|bool
546
+ * @return false|null
547 547
  */
548 548
 function give_remove_donor_email() {
549 549
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
  * and redirect back to the donor interface for feedback
584 584
  *
585 585
  * @since  1.7
586
- * @return void|bool
586
+ * @return false|null
587 587
  */
588 588
 function give_set_donor_primary_email() {
589 589
 	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
Please login to merge, or discard this patch.
Spacing   +185 added lines, -185 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array $output Response messages
25 25
  */
26
-function give_edit_customer( $args ) {
26
+function give_edit_customer($args) {
27 27
 	
28
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
28
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
29 29
 
30
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
31
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( empty( $args ) ) {
34
+	if (empty($args)) {
35 35
 		return;
36 36
 	}
37 37
 
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 	$customer_id   = (int) $args['customerinfo']['id'];
40 40
 	$nonce         = $args['_wpnonce'];
41 41
 
42
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
43
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
42
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
43
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
44 44
 	}
45 45
 
46
-	$customer = new Give_Customer( $customer_id );
47
-	if ( empty( $customer->id ) ) {
46
+	$customer = new Give_Customer($customer_id);
47
+	if (empty($customer->id)) {
48 48
 		return false;
49 49
 	}
50 50
 
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 		'user_id' => 0
54 54
 	);
55 55
 
56
-	$customer_info = wp_parse_args( $customer_info, $defaults );
56
+	$customer_info = wp_parse_args($customer_info, $defaults);
57 57
 
58
-	if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {
58
+	if ((int) $customer_info['user_id'] != (int) $customer->user_id) {
59 59
 
60 60
 		// Make sure we don't already have this user attached to a customer
61
-		if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) {
62
-			give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html__( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) );
61
+		if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) {
62
+			give_set_error('give-invalid-customer-user_id', sprintf(esc_html__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id']));
63 63
 		}
64 64
 
65 65
 		// Make sure it's actually a user
66
-		$user = get_user_by( 'id', $customer_info['user_id'] );
67
-		if ( ! empty( $customer_info['user_id'] ) && false === $user ) {
68
-			give_set_error( 'give-invalid-user_id', sprintf( esc_html__( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) );
66
+		$user = get_user_by('id', $customer_info['user_id']);
67
+		if ( ! empty($customer_info['user_id']) && false === $user) {
68
+			give_set_error('give-invalid-user_id', sprintf(esc_html__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id']));
69 69
 		}
70 70
 
71 71
 	}
@@ -73,52 +73,52 @@  discard block
 block discarded – undo
73 73
 	// Record this for later
74 74
 	$previous_user_id = $customer->user_id;
75 75
 
76
-	if ( give_get_errors() ) {
76
+	if (give_get_errors()) {
77 77
 		return;
78 78
 	}
79 79
 
80 80
 	// Setup the customer address, if present
81 81
 	$address = array();
82
-	if ( intval( $customer_info['user_id'] ) > 0 ) {
82
+	if (intval($customer_info['user_id']) > 0) {
83 83
 
84
-		$current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true );
84
+		$current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true);
85 85
 
86
-		if ( false === $current_address ) {
87
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : '';
88
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : '';
89
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : '';
90
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : '';
91
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : '';
92
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : '';
86
+		if (false === $current_address) {
87
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : '';
88
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : '';
89
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : '';
90
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : '';
91
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : '';
92
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : '';
93 93
 		} else {
94
-			$current_address    = wp_parse_args( $current_address, array(
94
+			$current_address    = wp_parse_args($current_address, array(
95 95
 				'line1',
96 96
 				'line2',
97 97
 				'city',
98 98
 				'zip',
99 99
 				'state',
100 100
 				'country'
101
-			) );
102
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1'];
103
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2'];
104
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city'];
105
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country'];
106
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip'];
107
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state'];
101
+			));
102
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1'];
103
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2'];
104
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city'];
105
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country'];
106
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip'];
107
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state'];
108 108
 		}
109 109
 
110 110
 	}
111 111
 
112 112
 	// Sanitize the inputs
113 113
 	$customer_data            = array();
114
-	$customer_data['name']    = strip_tags( stripslashes( $customer_info['name'] ) );
114
+	$customer_data['name']    = strip_tags(stripslashes($customer_info['name']));
115 115
 	$customer_data['user_id'] = $customer_info['user_id'];
116 116
 
117
-	$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
118
-	$address       = apply_filters( 'give_edit_customer_address', $address, $customer_id );
117
+	$customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id);
118
+	$address       = apply_filters('give_edit_customer_address', $address, $customer_id);
119 119
 
120
-	$customer_data = array_map( 'sanitize_text_field', $customer_data );
121
-	$address       = array_map( 'sanitize_text_field', $address );
120
+	$customer_data = array_map('sanitize_text_field', $customer_data);
121
+	$address       = array_map('sanitize_text_field', $address);
122 122
 
123 123
 
124 124
 	/**
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
 	 * @param array $customer_data The customer data.
131 131
 	 * @param array $address       The customer address.
132 132
 	 */
133
-	do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );
133
+	do_action('give_pre_edit_customer', $customer_id, $customer_data, $address);
134 134
 
135
-	$output         = array();
135
+	$output = array();
136 136
 
137
-	if ( $customer->update( $customer_data ) ) {
137
+	if ($customer->update($customer_data)) {
138 138
 
139
-		if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
140
-			update_user_meta( $customer->user_id, '_give_user_address', $address );
139
+		if ( ! empty($customer->user_id) && $customer->user_id > 0) {
140
+			update_user_meta($customer->user_id, '_give_user_address', $address);
141 141
 		}
142 142
 
143 143
 		// Update some donation meta if we need to
144
-		$payments_array = explode( ',', $customer->payment_ids );
144
+		$payments_array = explode(',', $customer->payment_ids);
145 145
 
146
-		if ( $customer->user_id != $previous_user_id ) {
147
-			foreach ( $payments_array as $payment_id ) {
148
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
146
+		if ($customer->user_id != $previous_user_id) {
147
+			foreach ($payments_array as $payment_id) {
148
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
149 149
 			}
150 150
 		}
151 151
 
152 152
 		$output['success']       = true;
153
-		$customer_data           = array_merge( $customer_data, $address );
153
+		$customer_data           = array_merge($customer_data, $address);
154 154
 		$output['customer_info'] = $customer_data;
155 155
 
156 156
 	} else {
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
 	 * @param int   $customer_id   The ID of the customer.
168 168
 	 * @param array $customer_data The customer data.
169 169
 	 */
170
-	do_action( 'give_post_edit_customer', $customer_id, $customer_data );
170
+	do_action('give_post_edit_customer', $customer_id, $customer_data);
171 171
 
172
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
173
-		header( 'Content-Type: application/json' );
174
-		echo json_encode( $output );
172
+	if (defined('DOING_AJAX') && DOING_AJAX) {
173
+		header('Content-Type: application/json');
174
+		echo json_encode($output);
175 175
 		wp_die();
176 176
 	}
177 177
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 
180 180
 }
181 181
 
182
-add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 );
182
+add_action('give_edit-customer', 'give_edit_customer', 10, 1);
183 183
 
184 184
 /**
185 185
  * Save a customer note being added
@@ -190,36 +190,36 @@  discard block
 block discarded – undo
190 190
  *
191 191
  * @return int         The Note ID that was saved, or 0 if nothing was saved
192 192
  */
193
-function give_customer_save_note( $args ) {
193
+function give_customer_save_note($args) {
194 194
 
195
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
195
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
196 196
 
197
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
198
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
197
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
198
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
199 199
 	}
200 200
 
201
-	if ( empty( $args ) ) {
201
+	if (empty($args)) {
202 202
 		return;
203 203
 	}
204 204
 
205
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
205
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
206 206
 	$customer_id   = (int) $args['customer_id'];
207 207
 	$nonce         = $args['add_customer_note_nonce'];
208 208
 
209
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
210
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
209
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
210
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
211 211
 	}
212 212
 
213
-	if ( empty( $customer_note ) ) {
214
-		give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) );
213
+	if (empty($customer_note)) {
214
+		give_set_error('empty-customer-note', esc_html__('A note is required.', 'give'));
215 215
 	}
216 216
 
217
-	if ( give_get_errors() ) {
217
+	if (give_get_errors()) {
218 218
 		return;
219 219
 	}
220 220
 
221
-	$customer = new Give_Customer( $customer_id );
222
-	$new_note = $customer->add_note( $customer_note );
221
+	$customer = new Give_Customer($customer_id);
222
+	$new_note = $customer->add_note($customer_note);
223 223
 
224 224
 	/**
225 225
 	 * Fires before inserting customer note.
@@ -229,22 +229,22 @@  discard block
 block discarded – undo
229 229
 	 * @param int    $customer_id The ID of the customer.
230 230
 	 * @param string $new_note    Note content.
231 231
 	 */
232
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
232
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
233 233
 
234
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
234
+	if ( ! empty($new_note) && ! empty($customer->id)) {
235 235
 
236 236
 		ob_start();
237 237
 		?>
238 238
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
239 239
 			<span class="note-content-wrap">
240
-				<?php echo stripslashes( $new_note ); ?>
240
+				<?php echo stripslashes($new_note); ?>
241 241
 			</span>
242 242
 		</div>
243 243
 		<?php
244 244
 		$output = ob_get_contents();
245 245
 		ob_end_clean();
246 246
 
247
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
247
+		if (defined('DOING_AJAX') && DOING_AJAX) {
248 248
 			echo $output;
249 249
 			exit;
250 250
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 
258 258
 }
259 259
 
260
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
260
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
261 261
 
262 262
 /**
263 263
  * Delete a customer
@@ -268,37 +268,37 @@  discard block
 block discarded – undo
268 268
  *
269 269
  * @return int Whether it was a successful deletion
270 270
  */
271
-function give_customer_delete( $args ) {
271
+function give_customer_delete($args) {
272 272
 
273
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
273
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
274 274
 
275
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
276
-		wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
275
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
276
+		wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
277 277
 	}
278 278
 
279
-	if ( empty( $args ) ) {
279
+	if (empty($args)) {
280 280
 		return;
281 281
 	}
282 282
 
283 283
 	$customer_id = (int) $args['customer_id'];
284
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
285
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
284
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
285
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
286 286
 	$nonce       = $args['_wpnonce'];
287 287
 
288
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
289
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
288
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
289
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
290 290
 	}
291 291
 
292
-	if ( ! $confirm ) {
293
-		give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) );
292
+	if ( ! $confirm) {
293
+		give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give'));
294 294
 	}
295 295
 
296
-	if ( give_get_errors() ) {
297
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
296
+	if (give_get_errors()) {
297
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
298 298
 		exit;
299 299
 	}
300 300
 
301
-	$customer = new Give_Customer( $customer_id );
301
+	$customer = new Give_Customer($customer_id);
302 302
 
303 303
 	/**
304 304
 	 * Fires before deleting customer.
@@ -309,53 +309,53 @@  discard block
 block discarded – undo
309 309
 	 * @param bool $confirm     Delete confirmation.
310 310
 	 * @param bool $remove_data Records delete confirmation.
311 311
 	 */
312
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
312
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
313 313
 	
314
-	if ( $customer->id > 0 ) {
314
+	if ($customer->id > 0) {
315 315
 
316
-		$payments_array = explode( ',', $customer->payment_ids );
317
-		$success        = Give()->customers->delete( $customer->id );
316
+		$payments_array = explode(',', $customer->payment_ids);
317
+		$success        = Give()->customers->delete($customer->id);
318 318
 
319
-		if ( $success ) {
319
+		if ($success) {
320 320
 
321
-			if ( $remove_data ) {
321
+			if ($remove_data) {
322 322
 
323 323
 				// Remove all donations, logs, etc
324
-				foreach ( $payments_array as $payment_id ) {
325
-					give_delete_purchase( $payment_id );
324
+				foreach ($payments_array as $payment_id) {
325
+					give_delete_purchase($payment_id);
326 326
 				}
327 327
 
328 328
 			} else {
329 329
 
330 330
 				// Just set the donations to customer_id of 0
331
-				foreach ( $payments_array as $payment_id ) {
332
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
331
+				foreach ($payments_array as $payment_id) {
332
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
333 333
 				}
334 334
 
335 335
 			}
336 336
 
337
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
337
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
338 338
 
339 339
 		} else {
340 340
 
341
-			give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) );
342
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
341
+			give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give'));
342
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
343 343
 
344 344
 		}
345 345
 
346 346
 	} else {
347 347
 
348
-		give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) );
349
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
348
+		give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give'));
349
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
350 350
 
351 351
 	}
352 352
 
353
-	wp_redirect( $redirect );
353
+	wp_redirect($redirect);
354 354
 	exit;
355 355
 
356 356
 }
357 357
 
358
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
358
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
359 359
 
360 360
 /**
361 361
  * Disconnect a user ID from a donor
@@ -366,27 +366,27 @@  discard block
 block discarded – undo
366 366
  *
367 367
  * @return bool        If the disconnect was successful
368 368
  */
369
-function give_disconnect_customer_user_id( $args ) {
369
+function give_disconnect_customer_user_id($args) {
370 370
 
371
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
371
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
372 372
 
373
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
374
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
373
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
374
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
375 375
 	}
376 376
 
377
-	if ( empty( $args ) ) {
377
+	if (empty($args)) {
378 378
 		return;
379 379
 	}
380 380
 
381 381
 	$customer_id = (int) $args['customer_id'];
382 382
 	$nonce       = $args['_wpnonce'];
383 383
 
384
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
385
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
384
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
385
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
386 386
 	}
387 387
 
388
-	$customer = new Give_Customer( $customer_id );
389
-	if ( empty( $customer->id ) ) {
388
+	$customer = new Give_Customer($customer_id);
389
+	if (empty($customer->id)) {
390 390
 		return false;
391 391
 	}
392 392
 
@@ -400,16 +400,16 @@  discard block
 block discarded – undo
400 400
 	 * @param int $customer_id The ID of the customer.
401 401
 	 * @param int $user_id     The ID of the user.
402 402
 	 */
403
-	do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id );
403
+	do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id);
404 404
 
405 405
 	$output = array();
406
-	$customer_args = array( 'user_id' => 0 );
406
+	$customer_args = array('user_id' => 0);
407 407
 
408
-	if ( $customer->update( $customer_args ) ) {
408
+	if ($customer->update($customer_args)) {
409 409
 		global $wpdb;
410 410
 
411
-		if ( ! empty( $customer->payment_ids ) ) {
412
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" );
411
+		if ( ! empty($customer->payment_ids)) {
412
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )");
413 413
 		}
414 414
 
415 415
 		$output['success'] = true;
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	} else {
418 418
 
419 419
 		$output['success'] = false;
420
-		give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) );
420
+		give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give'));
421 421
 	}
422 422
 
423 423
 	/**
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 	 *
428 428
 	 * @param int $customer_id The ID of the customer.
429 429
 	 */
430
-	do_action( 'give_post_customer_disconnect_user_id', $customer_id );
430
+	do_action('give_post_customer_disconnect_user_id', $customer_id);
431 431
 
432
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
433
-		header( 'Content-Type: application/json' );
434
-		echo json_encode( $output );
432
+	if (defined('DOING_AJAX') && DOING_AJAX) {
433
+		header('Content-Type: application/json');
434
+		echo json_encode($output);
435 435
 		wp_die();
436 436
 	}
437 437
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 
440 440
 }
441 441
 
442
-add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 );
442
+add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1);
443 443
 
444 444
 /**
445 445
  * Add an email address to the donor from within the admin and log a donor note
@@ -448,81 +448,81 @@  discard block
 block discarded – undo
448 448
  * @param  array $args  Array of arguments: nonce, customer id, and email address
449 449
  * @return mixed        If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string)
450 450
  */
451
-function give_add_donor_email( $args ) {
452
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
451
+function give_add_donor_email($args) {
452
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
453 453
 
454
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
455
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'edit' ) );
454
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
455
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'edit'));
456 456
 	}
457 457
 
458 458
 	$output = array();
459
-	if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) {
459
+	if (empty($args) || empty($args['email']) || empty($args['customer_id'])) {
460 460
 		$output['success'] = false;
461
-		if ( empty( $args['email'] ) ) {
462
-			$output['message'] = esc_html__( 'Email address is required.', 'give' );
463
-		} else if ( empty( $args['customer_id'] ) ) {
464
-			$output['message'] = esc_html__( 'Customer ID is required.', 'give' );
461
+		if (empty($args['email'])) {
462
+			$output['message'] = esc_html__('Email address is required.', 'give');
463
+		} else if (empty($args['customer_id'])) {
464
+			$output['message'] = esc_html__('Customer ID is required.', 'give');
465 465
 		} else {
466
-			$output['message'] = esc_html__( 'An error has occurred. Please try again.', 'give' );
466
+			$output['message'] = esc_html__('An error has occurred. Please try again.', 'give');
467 467
 		}
468
-	} else if ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) {
468
+	} else if ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) {
469 469
 		$output = array(
470 470
 			'success' => false,
471
-			'message' => esc_html__( 'Nonce verification failed.', 'give' ),
471
+			'message' => esc_html__('Nonce verification failed.', 'give'),
472 472
 		);
473
-	} else if ( ! is_email( $args['email'] ) ) {
473
+	} else if ( ! is_email($args['email'])) {
474 474
 		$output = array(
475 475
 			'success' => false,
476
-			'message' => esc_html__( 'Invalid email address.', 'give' ),
476
+			'message' => esc_html__('Invalid email address.', 'give'),
477 477
 		);
478 478
 	} else {
479
-		$email       = sanitize_email($args['email'] );
479
+		$email       = sanitize_email($args['email']);
480 480
 		$customer_id = (int) $args['customer_id'];
481 481
 		$primary     = 'true' === $args['primary'] ? true : false;
482
-		$customer    = new Give_Customer( $customer_id );
483
-		if ( false === $customer->add_email( $email, $primary ) ) {
484
-			if ( in_array( $email, $customer->emails ) ) {
482
+		$customer    = new Give_Customer($customer_id);
483
+		if (false === $customer->add_email($email, $primary)) {
484
+			if (in_array($email, $customer->emails)) {
485 485
 				$output = array(
486 486
 					'success'  => false,
487
-					'message'  => esc_html__( 'Email already associated with this donor.', 'give' ),
487
+					'message'  => esc_html__('Email already associated with this donor.', 'give'),
488 488
 				);
489 489
 			} else {
490 490
 				$output = array(
491 491
 					'success' => false,
492
-					'message' => esc_html__( 'Email address is already associated with another donor.', 'give' ),
492
+					'message' => esc_html__('Email address is already associated with another donor.', 'give'),
493 493
 				);
494 494
 			}
495 495
 		} else {
496
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id . '&give-message=email-added' );
496
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id.'&give-message=email-added');
497 497
 			$output = array(
498 498
 				'success'  => true,
499
-				'message'  => esc_html__( 'Email successfully added to donor.', 'give' ),
499
+				'message'  => esc_html__('Email successfully added to donor.', 'give'),
500 500
 				'redirect' => $redirect,
501 501
 			);
502 502
 
503 503
 			$user          = wp_get_current_user();
504
-			$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
505
-			$customer_note = sprintf( __( 'Email address %s added by %s', 'give' ), $email, $user_login );
506
-			$customer->add_note( $customer_note );
504
+			$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
505
+			$customer_note = sprintf(__('Email address %s added by %s', 'give'), $email, $user_login);
506
+			$customer->add_note($customer_note);
507 507
 
508
-			if ( $primary ) {
509
-				$customer_note = sprintf( __( 'Email address %s set as primary by %s', 'give' ), $email, $user_login );
510
-				$customer->add_note( $customer_note );
508
+			if ($primary) {
509
+				$customer_note = sprintf(__('Email address %s set as primary by %s', 'give'), $email, $user_login);
510
+				$customer->add_note($customer_note);
511 511
 			}
512 512
 		}
513 513
 	}
514 514
 
515
-	do_action( 'give_post_add_customer_email', $customer_id, $args );
515
+	do_action('give_post_add_customer_email', $customer_id, $args);
516 516
 
517
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
518
-		header( 'Content-Type: application/json' );
519
-		echo json_encode( $output );
517
+	if (defined('DOING_AJAX') && DOING_AJAX) {
518
+		header('Content-Type: application/json');
519
+		echo json_encode($output);
520 520
 		wp_die();
521 521
 	}
522 522
 
523 523
 	return $output;
524 524
 }
525
-add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 );
525
+add_action('give_add_donor_email', 'give_add_donor_email', 10, 1);
526 526
 
527 527
 
528 528
 /**
@@ -533,36 +533,36 @@  discard block
 block discarded – undo
533 533
  * @return void|bool
534 534
  */
535 535
 function give_remove_donor_email() {
536
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
536
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
537 537
 		return false;
538 538
 	}
539
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
539
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
540 540
 		return false;
541 541
 	}
542
-	if ( empty( $_GET['_wpnonce'] ) ) {
542
+	if (empty($_GET['_wpnonce'])) {
543 543
 		return false;
544 544
 	}
545 545
 
546 546
 	$nonce = $_GET['_wpnonce'];
547
-	if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) {
548
-		wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
547
+	if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) {
548
+		wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array('response' => 403));
549 549
 	}
550 550
 
551
-	$customer = new Give_Customer( $_GET['id'] );
552
-	if ( $customer->remove_email( $_GET['email'] ) ) {
553
-		$url = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
551
+	$customer = new Give_Customer($_GET['id']);
552
+	if ($customer->remove_email($_GET['email'])) {
553
+		$url = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
554 554
 		$user          = wp_get_current_user();
555
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
556
-		$customer_note = sprintf( __( 'Email address %s removed by %s', 'give' ), $_GET['email'], $user_login );
557
-		$customer->add_note( $customer_note );
555
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
556
+		$customer_note = sprintf(__('Email address %s removed by %s', 'give'), $_GET['email'], $user_login);
557
+		$customer->add_note($customer_note);
558 558
 	} else {
559
-		$url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) );
559
+		$url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id));
560 560
 	}
561 561
 
562
-	wp_safe_redirect( $url );
562
+	wp_safe_redirect($url);
563 563
 	exit;
564 564
 }
565
-add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 );
565
+add_action('give_remove_donor_email', 'give_remove_donor_email', 10);
566 566
 
567 567
 
568 568
 /**
@@ -573,38 +573,38 @@  discard block
 block discarded – undo
573 573
  * @return void|bool
574 574
  */
575 575
 function give_set_donor_primary_email() {
576
-	if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
576
+	if (empty($_GET['id']) || ! is_numeric($_GET['id'])) {
577 577
 		return false;
578 578
 	}
579 579
 
580
-	if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) {
580
+	if (empty($_GET['email']) || ! is_email($_GET['email'])) {
581 581
 		return false;
582 582
 	}
583 583
 
584
-	if ( empty( $_GET['_wpnonce'] ) ) {
584
+	if (empty($_GET['_wpnonce'])) {
585 585
 		return false;
586 586
 	}
587 587
 
588 588
 	$nonce = $_GET['_wpnonce'];
589 589
 
590
-	if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) {
591
-		wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
590
+	if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) {
591
+		wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array('response' => 403));
592 592
 	}
593 593
 
594
-	$donor = new Give_Customer( $_GET['id'] );
594
+	$donor = new Give_Customer($_GET['id']);
595 595
 
596
-	if ( $donor->set_primary_email( $_GET['email'] ) ) {
597
-		$url = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
596
+	if ($donor->set_primary_email($_GET['email'])) {
597
+		$url = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
598 598
 		$user          = wp_get_current_user();
599
-		$user_login    = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' );
600
-		$donor_note    = sprintf( __( 'Email address %s set as primary by %s', 'give' ), $_GET['email'], $user_login );
599
+		$user_login    = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give');
600
+		$donor_note    = sprintf(__('Email address %s set as primary by %s', 'give'), $_GET['email'], $user_login);
601 601
 
602
-		$donor->add_note( $donor_note );
602
+		$donor->add_note($donor_note);
603 603
 	} else {
604
-		$url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) );
604
+		$url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id));
605 605
 	}
606 606
 
607
-	wp_safe_redirect( $url );
607
+	wp_safe_redirect($url);
608 608
 	exit;
609 609
 }
610
-add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 );
610
+add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10);
Please login to merge, or discard this patch.
includes/class-give-customer.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	 * @access public
891 891
 	 *
892 892
 	 * @param  string $meta_key   Metadata name. Default is empty.
893
-	 * @param  mixed  $meta_value Metadata value.
893
+	 * @param  string  $meta_value Metadata value.
894 894
 	 * @param  bool   $unique     Optional. Whether the same key should not be added. Default is false.
895 895
 	 *
896 896
 	 * @return bool               False for failure. True for success.
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 	 * @access public
923 923
 	 *
924 924
 	 * @param  string $meta_key   Metadata name. Default is empty.
925
-	 * @param  mixed  $meta_value Optional. Metadata value. Default is empty.
925
+	 * @param  string  $meta_value Optional. Metadata value. Default is empty.
926 926
 	 *
927 927
 	 * @return bool               False for failure. True for success.
928 928
 	 */
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -714,12 +714,12 @@  discard block
 block discarded – undo
714 714
 
715 715
 	/**
716 716
 	 * Decrease/Increase a customer's lifetime value.
717
-     *
718
-     * This function will update donation stat on basis of current amount and new amount donation difference.
719
-     * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
720
-     *
717
+	 *
718
+	 * This function will update donation stat on basis of current amount and new amount donation difference.
719
+	 * Difference value can positive or negative. Negative value will decrease user donation stat while positive value increase donation stat.
720
+	 *
721 721
 	 * @since  1.0
722
-     * @access public
722
+	 * @access public
723 723
 	 *
724 724
 	 * @param  float $curr_amount Current Donation amount.
725 725
 	 * @param  float $new_amount  New (changed) Donation amount.
@@ -727,35 +727,35 @@  discard block
 block discarded – undo
727 727
 	 * @return mixed              If successful, the new donation stat value, otherwise false.
728 728
 	 */
729 729
 	public function update_donation_value( $curr_amount, $new_amount ) {
730
-        /**
731
-         * Payment total difference value can be:
732
-         *  zero   (in case amount not change)
733
-         *  or -ve (in case amount decrease)
734
-         *  or +ve (in case amount increase)
735
-         */
736
-        $payment_total_diff = $new_amount - $curr_amount;
737
-
738
-        // We do not need to update donation stat if donation did not change.
739
-        if( ! $payment_total_diff ) {
740
-            return false;
741
-        }
742
-
743
-
744
-        if( $payment_total_diff > 0 ) {
745
-            $this->increase_value( $payment_total_diff );
746
-        } else {
747
-            // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
748
-            $this->decrease_value( -$payment_total_diff );
749
-        }
750
-
751
-        return $this->purchase_value;
730
+		/**
731
+		 * Payment total difference value can be:
732
+		 *  zero   (in case amount not change)
733
+		 *  or -ve (in case amount decrease)
734
+		 *  or +ve (in case amount increase)
735
+		 */
736
+		$payment_total_diff = $new_amount - $curr_amount;
737
+
738
+		// We do not need to update donation stat if donation did not change.
739
+		if( ! $payment_total_diff ) {
740
+			return false;
741
+		}
742
+
743
+
744
+		if( $payment_total_diff > 0 ) {
745
+			$this->increase_value( $payment_total_diff );
746
+		} else {
747
+			// Pass payment total difference as +ve value to decrease amount from user lifetime stat.
748
+			$this->decrease_value( -$payment_total_diff );
749
+		}
750
+
751
+		return $this->purchase_value;
752 752
 	}
753 753
 
754 754
 	/**
755 755
 	 * Get the parsed notes for a customer as an array.
756 756
 	 *
757 757
 	 * @since  1.0
758
-     * @access public
758
+	 * @access public
759 759
 	 *
760 760
 	 * @param  int $length The number of notes to get.
761 761
 	 * @param  int $paged  What note to start at.
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	 * Get the total number of notes we have after parsing.
781 781
 	 *
782 782
 	 * @since  1.0
783
-     * @access public
783
+	 * @access public
784 784
 	 *
785 785
 	 * @return int The number of notes for the customer.
786 786
 	 */
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 	 * Add a note for the customer.
798 798
 	 *
799 799
 	 * @since  1.0
800
-     * @access public
800
+	 * @access public
801 801
 	 *
802 802
 	 * @param  string $note   The note to add. Default is empty.
803 803
 	 *
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	 * Get the notes column for the customer
857 857
 	 *
858 858
 	 * @since  1.0
859
-     * @access private
859
+	 * @access private
860 860
 	 *
861 861
 	 * @return string The Notes for the customer, non-parsed.
862 862
 	 */
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 	 * Sanitize the data for update/create
935 935
 	 *
936 936
 	 * @since  1.0
937
-     * @access private
937
+	 * @access private
938 938
 	 *
939 939
 	 * @param  array $data The data to sanitize.
940 940
 	 *
Please login to merge, or discard this patch.
Spacing   +169 added lines, -169 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
 
@@ -144,29 +144,29 @@  discard block
 block discarded – undo
144 144
 	 * @param  bool $_id_or_email 
145 145
 	 * @param  bool $by_user_id
146 146
 	 */
147
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
147
+	public function __construct($_id_or_email = false, $by_user_id = false) {
148 148
 
149 149
 		$this->db = new Give_DB_Customers;
150 150
 
151
-		if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) {
151
+		if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) {
152 152
 			return false;
153 153
 		}
154 154
 
155
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
155
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
156 156
 
157
-		if ( is_numeric( $_id_or_email ) ) {
157
+		if (is_numeric($_id_or_email)) {
158 158
 			$field = $by_user_id ? 'user_id' : 'id';
159 159
 		} else {
160 160
 			$field = 'email';
161 161
 		}
162 162
 
163
-		$customer = $this->db->get_customer_by( $field, $_id_or_email );
163
+		$customer = $this->db->get_customer_by($field, $_id_or_email);
164 164
 
165
-		if ( empty( $customer ) || ! is_object( $customer ) ) {
165
+		if (empty($customer) || ! is_object($customer)) {
166 166
 			return false;
167 167
 		}
168 168
 
169
-		$this->setup_customer( $customer );
169
+		$this->setup_customer($customer);
170 170
 
171 171
 	}
172 172
 
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @return bool             If the setup was successful or not.
184 184
 	 */
185
-	private function setup_customer( $customer ) {
185
+	private function setup_customer($customer) {
186 186
 
187
-		if ( ! is_object( $customer ) ) {
187
+		if ( ! is_object($customer)) {
188 188
 			return false;
189 189
 		}
190 190
 
191
-		foreach ( $customer as $key => $value ) {
191
+		foreach ($customer as $key => $value) {
192 192
 
193
-			switch ( $key ) {
193
+			switch ($key) {
194 194
 
195 195
 				case 'notes':
196 196
 					$this->$key = $this->get_notes();
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 		}
206 206
 
207 207
 		// Get donor's all email including primary email.
208
-		$this->emails   = (array) $this->get_meta( 'additional_email', false );
209
-		$this->emails = array( 'primary' => $this->email ) + $this->emails;
208
+		$this->emails = (array) $this->get_meta('additional_email', false);
209
+		$this->emails = array('primary' => $this->email) + $this->emails;
210 210
 
211 211
 		// Customer ID and email are the only things that are necessary, make sure they exist.
212
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
212
+		if ( ! empty($this->id) && ! empty($this->email)) {
213 213
 			return true;
214 214
 		}
215 215
 
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
 	 * @since  1.0
224 224
 	 * @access public
225 225
 	 */
226
-	public function __get( $key ) {
226
+	public function __get($key) {
227 227
 
228
-		if ( method_exists( $this, 'get_' . $key ) ) {
228
+		if (method_exists($this, 'get_'.$key)) {
229 229
 
230
-			return call_user_func( array( $this, 'get_' . $key ) );
230
+			return call_user_func(array($this, 'get_'.$key));
231 231
 
232 232
 		} else {
233 233
 
234 234
 			/* translators: %s: property key */
235
-			return new WP_Error( 'give-customer-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
235
+			return new WP_Error('give-customer-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
236 236
 
237 237
 		}
238 238
 
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @return bool|int    False if not a valid creation, customer ID if user is found or valid creation.
250 250
 	 */
251
-	public function create( $data = array() ) {
251
+	public function create($data = array()) {
252 252
 
253
-		if ( $this->id != 0 || empty( $data ) ) {
253
+		if ($this->id != 0 || empty($data)) {
254 254
 			return false;
255 255
 		}
256 256
 
@@ -258,15 +258,15 @@  discard block
 block discarded – undo
258 258
 			'payment_ids' => ''
259 259
 		);
260 260
 
261
-		$args = wp_parse_args( $data, $defaults );
262
-		$args = $this->sanitize_columns( $args );
261
+		$args = wp_parse_args($data, $defaults);
262
+		$args = $this->sanitize_columns($args);
263 263
 
264
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
264
+		if (empty($args['email']) || ! is_email($args['email'])) {
265 265
 			return false;
266 266
 		}
267 267
 
268
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
269
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
268
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
269
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
270 270
 		}
271 271
 
272 272
 		/**
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
 		 *
277 277
 		 * @param array $args Customer attributes.
278 278
 		 */
279
-		do_action( 'give_customer_pre_create', $args );
279
+		do_action('give_customer_pre_create', $args);
280 280
 
281 281
 		$created = false;
282 282
 
283 283
 		// The DB class 'add' implies an update if the customer being asked to be created already exists
284
-		if ( $this->db->add( $data ) ) {
284
+		if ($this->db->add($data)) {
285 285
 
286 286
 			// We've successfully added/updated the customer, reset the class vars with the new data
287
-			$customer = $this->db->get_customer_by( 'email', $args['email'] );
287
+			$customer = $this->db->get_customer_by('email', $args['email']);
288 288
 
289 289
 			// Setup the customer data with the values from DB
290
-			$this->setup_customer( $customer );
290
+			$this->setup_customer($customer);
291 291
 
292 292
 			$created = $this->id;
293 293
 		}
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		 *                          customer ID if user is found or valid creation.
302 302
 		 * @param array    $args    Customer attributes.
303 303
 		 */
304
-		do_action( 'give_customer_post_create', $created, $args );
304
+		do_action('give_customer_post_create', $created, $args);
305 305
 
306 306
 		return $created;
307 307
 
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @return bool        If the update was successful or not.
319 319
 	 */
320
-	public function update( $data = array() ) {
320
+	public function update($data = array()) {
321 321
 
322
-		if ( empty( $data ) ) {
322
+		if (empty($data)) {
323 323
 			return false;
324 324
 		}
325 325
 
326
-		$data = $this->sanitize_columns( $data );
326
+		$data = $this->sanitize_columns($data);
327 327
 
328 328
 		/**
329 329
 		 * Fires before updating customers.
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 		 * @param int   $customer_id Customer id.
334 334
 		 * @param array $data        Customer attributes.
335 335
 		 */
336
-		do_action( 'give_customer_pre_update', $this->id, $data );
336
+		do_action('give_customer_pre_update', $this->id, $data);
337 337
 
338 338
 		$updated = false;
339 339
 
340
-		if ( $this->db->update( $this->id, $data ) ) {
340
+		if ($this->db->update($this->id, $data)) {
341 341
 
342
-			$customer = $this->db->get_customer_by( 'id', $this->id );
343
-			$this->setup_customer( $customer );
342
+			$customer = $this->db->get_customer_by('id', $this->id);
343
+			$this->setup_customer($customer);
344 344
 
345 345
 			$updated = true;
346 346
 		}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 		 * @param int   $customer_id Customer id.
355 355
 		 * @param array $data        Customer attributes.
356 356
 		 */
357
-		do_action( 'give_customer_post_update', $updated, $this->id, $data );
357
+		do_action('give_customer_post_update', $updated, $this->id, $data);
358 358
 
359 359
 		return $updated;
360 360
 	}
@@ -372,27 +372,27 @@  discard block
 block discarded – undo
372 372
 	 *
373 373
 	 * @return bool            If the attachment was successfuly.
374 374
 	 */
375
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
375
+	public function attach_payment($payment_id = 0, $update_stats = true) {
376 376
 
377
-		if ( empty( $payment_id ) ) {
377
+		if (empty($payment_id)) {
378 378
 			return false;
379 379
 		}
380 380
 
381
-		if ( empty( $this->payment_ids ) ) {
381
+		if (empty($this->payment_ids)) {
382 382
 
383 383
 			$new_payment_ids = $payment_id;
384 384
 
385 385
 		} else {
386 386
 
387
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
387
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
388 388
 
389
-			if ( in_array( $payment_id, $payment_ids ) ) {
389
+			if (in_array($payment_id, $payment_ids)) {
390 390
 				$update_stats = false;
391 391
 			}
392 392
 
393 393
 			$payment_ids[] = $payment_id;
394 394
 
395
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
395
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
396 396
 
397 397
 		}
398 398
 
@@ -404,20 +404,20 @@  discard block
 block discarded – undo
404 404
 		 * @param int $payment_id  Payment id.
405 405
 		 * @param int $customer_id Customer id.
406 406
 		 */
407
-		do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id );
407
+		do_action('give_customer_pre_attach_payment', $payment_id, $this->id);
408 408
 
409
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
409
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
410 410
 
411
-		if ( $payment_added ) {
411
+		if ($payment_added) {
412 412
 
413 413
 			$this->payment_ids = $new_payment_ids;
414 414
 
415 415
 			// We added this payment successfully, increment the stats
416
-			if ( $update_stats ) {
417
-				$payment_amount = give_get_payment_amount( $payment_id );
416
+			if ($update_stats) {
417
+				$payment_amount = give_get_payment_amount($payment_id);
418 418
 
419
-				if ( ! empty( $payment_amount ) ) {
420
-					$this->increase_value( $payment_amount );
419
+				if ( ! empty($payment_amount)) {
420
+					$this->increase_value($payment_amount);
421 421
 				}
422 422
 
423 423
 				$this->increase_purchase_count();
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		 * @param int  $payment_id    Payment id.
435 435
 		 * @param int  $customer_id   Customer id.
436 436
 		 */
437
-		do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id );
437
+		do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id);
438 438
 
439 439
 		return $payment_added;
440 440
 	}
@@ -452,33 +452,33 @@  discard block
 block discarded – undo
452 452
 	 *
453 453
 	 * @return boolean               If the removal was successful.
454 454
 	 */
455
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
455
+	public function remove_payment($payment_id = 0, $update_stats = true) {
456 456
 
457
-		if ( empty( $payment_id ) ) {
457
+		if (empty($payment_id)) {
458 458
 			return false;
459 459
 		}
460 460
 
461
-		$payment = new Give_Payment( $payment_id );
461
+		$payment = new Give_Payment($payment_id);
462 462
 
463
-		if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) {
463
+		if ('publish' !== $payment->status && 'revoked' !== $payment->status) {
464 464
 			$update_stats = false;
465 465
 		}
466 466
 
467 467
 		$new_payment_ids = '';
468 468
 
469
-		if ( ! empty( $this->payment_ids ) ) {
469
+		if ( ! empty($this->payment_ids)) {
470 470
 
471
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
471
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
472 472
 
473
-			$pos = array_search( $payment_id, $payment_ids );
474
-			if ( false === $pos ) {
473
+			$pos = array_search($payment_id, $payment_ids);
474
+			if (false === $pos) {
475 475
 				return false;
476 476
 			}
477 477
 
478
-			unset( $payment_ids[ $pos ] );
479
-			$payment_ids = array_filter( $payment_ids );
478
+			unset($payment_ids[$pos]);
479
+			$payment_ids = array_filter($payment_ids);
480 480
 
481
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
481
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
482 482
 
483 483
 		}
484 484
 
@@ -490,20 +490,20 @@  discard block
 block discarded – undo
490 490
 		 * @param int $payment_id  Payment id.
491 491
 		 * @param int $customer_id Customer id.
492 492
 		 */
493
-		do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id );
493
+		do_action('give_customer_pre_remove_payment', $payment_id, $this->id);
494 494
 
495
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
495
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
496 496
 
497
-		if ( $payment_removed ) {
497
+		if ($payment_removed) {
498 498
 
499 499
 			$this->payment_ids = $new_payment_ids;
500 500
 
501
-			if ( $update_stats ) {
501
+			if ($update_stats) {
502 502
 				// We removed this payment successfully, decrement the stats
503
-				$payment_amount = give_get_payment_amount( $payment_id );
503
+				$payment_amount = give_get_payment_amount($payment_id);
504 504
 
505
-				if ( ! empty( $payment_amount ) ) {
506
-					$this->decrease_value( $payment_amount );
505
+				if ( ! empty($payment_amount)) {
506
+					$this->decrease_value($payment_amount);
507 507
 				}
508 508
 
509 509
 				$this->decrease_purchase_count();
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		 * @param int  $payment_id      Payment id.
521 521
 		 * @param int  $customer_id     Customer id.
522 522
 		 */
523
-		do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id );
523
+		do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id);
524 524
 
525 525
 		return $payment_removed;
526 526
 
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
 	 *
537 537
 	 * @return int        The donation count.
538 538
 	 */
539
-	public function increase_purchase_count( $count = 1 ) {
539
+	public function increase_purchase_count($count = 1) {
540 540
 
541 541
 		// Make sure it's numeric and not negative.
542
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
542
+		if ( ! is_numeric($count) || $count != absint($count)) {
543 543
 			return false;
544 544
 		}
545 545
 
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
 		 * @param int $count       The number to increase by.
554 554
 		 * @param int $customer_id Customer id.
555 555
 		 */
556
-		do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id );
556
+		do_action('give_customer_pre_increase_purchase_count', $count, $this->id);
557 557
 
558
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
558
+		if ($this->update(array('purchase_count' => $new_total))) {
559 559
 			$this->purchase_count = $new_total;
560 560
 		}
561 561
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 		 * @param int $count          The number increased by.
569 569
 		 * @param int $customer_id    Customer id.
570 570
 		 */
571
-		do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id );
571
+		do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id);
572 572
 
573 573
 		return $this->purchase_count;
574 574
 	}
@@ -583,16 +583,16 @@  discard block
 block discarded – undo
583 583
 	 *
584 584
 	 * @return mixed      If successful, the new count, otherwise false.
585 585
 	 */
586
-	public function decrease_purchase_count( $count = 1 ) {
586
+	public function decrease_purchase_count($count = 1) {
587 587
 
588 588
 		// Make sure it's numeric and not negative
589
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
589
+		if ( ! is_numeric($count) || $count != absint($count)) {
590 590
 			return false;
591 591
 		}
592 592
 
593 593
 		$new_total = (int) $this->purchase_count - (int) $count;
594 594
 
595
-		if ( $new_total < 0 ) {
595
+		if ($new_total < 0) {
596 596
 			$new_total = 0;
597 597
 		}
598 598
 
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
 		 * @param int $count       The number to decrease by.
605 605
 		 * @param int $customer_id Customer id.
606 606
 		 */
607
-		do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id );
607
+		do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
608 608
 
609
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
609
+		if ($this->update(array('purchase_count' => $new_total))) {
610 610
 			$this->purchase_count = $new_total;
611 611
 		}
612 612
 
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 		 * @param int $count          The number decreased by.
620 620
 		 * @param int $customer_id    Customer id.
621 621
 		 */
622
-		do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id );
622
+		do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
623 623
 
624 624
 		return $this->purchase_count;
625 625
 	}
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
 	 *
635 635
 	 * @return mixed        If successful, the new value, otherwise false.
636 636
 	 */
637
-	public function increase_value( $value = 0.00 ) {
637
+	public function increase_value($value = 0.00) {
638 638
 
639
-		$new_value = floatval( $this->purchase_value ) + $value;
639
+		$new_value = floatval($this->purchase_value) + $value;
640 640
 
641 641
 		/**
642 642
 		 * Fires before increasing customer lifetime value.
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 		 * @param float $value       The value to increase by.
647 647
 		 * @param int   $customer_id Customer id.
648 648
 		 */
649
-		do_action( 'give_customer_pre_increase_value', $value, $this->id );
649
+		do_action('give_customer_pre_increase_value', $value, $this->id);
650 650
 
651
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
651
+		if ($this->update(array('purchase_value' => $new_value))) {
652 652
 			$this->purchase_value = $new_value;
653 653
 		}
654 654
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 		 * @param float $value          The value increased by.
662 662
 		 * @param int   $customer_id    Customer id.
663 663
 		 */
664
-		do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id );
664
+		do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id);
665 665
 
666 666
 		return $this->purchase_value;
667 667
 	}
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 	 *
677 677
 	 * @return mixed        If successful, the new value, otherwise false.
678 678
 	 */
679
-	public function decrease_value( $value = 0.00 ) {
679
+	public function decrease_value($value = 0.00) {
680 680
 
681
-		$new_value = floatval( $this->purchase_value ) - $value;
681
+		$new_value = floatval($this->purchase_value) - $value;
682 682
 
683
-		if ( $new_value < 0 ) {
683
+		if ($new_value < 0) {
684 684
 			$new_value = 0.00;
685 685
 		}
686 686
 
@@ -692,9 +692,9 @@  discard block
 block discarded – undo
692 692
 		 * @param float $value       The value to decrease by.
693 693
 		 * @param int   $customer_id Customer id.
694 694
 		 */
695
-		do_action( 'give_customer_pre_decrease_value', $value, $this->id );
695
+		do_action('give_customer_pre_decrease_value', $value, $this->id);
696 696
 
697
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
697
+		if ($this->update(array('purchase_value' => $new_value))) {
698 698
 			$this->purchase_value = $new_value;
699 699
 		}
700 700
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 		 * @param float $value          The value decreased by.
708 708
 		 * @param int   $customer_id    Customer id.
709 709
 		 */
710
-		do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id );
710
+		do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id);
711 711
 
712 712
 		return $this->purchase_value;
713 713
 	}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	 *
727 727
 	 * @return mixed              If successful, the new donation stat value, otherwise false.
728 728
 	 */
729
-	public function update_donation_value( $curr_amount, $new_amount ) {
729
+	public function update_donation_value($curr_amount, $new_amount) {
730 730
         /**
731 731
          * Payment total difference value can be:
732 732
          *  zero   (in case amount not change)
@@ -736,13 +736,13 @@  discard block
 block discarded – undo
736 736
         $payment_total_diff = $new_amount - $curr_amount;
737 737
 
738 738
         // We do not need to update donation stat if donation did not change.
739
-        if( ! $payment_total_diff ) {
739
+        if ( ! $payment_total_diff) {
740 740
             return false;
741 741
         }
742 742
 
743 743
 
744
-        if( $payment_total_diff > 0 ) {
745
-            $this->increase_value( $payment_total_diff );
744
+        if ($payment_total_diff > 0) {
745
+            $this->increase_value($payment_total_diff);
746 746
         } else {
747 747
             // Pass payment total difference as +ve value to decrease amount from user lifetime stat.
748 748
             $this->decrease_value( -$payment_total_diff );
@@ -762,15 +762,15 @@  discard block
 block discarded – undo
762 762
 	 *
763 763
 	 * @return array       The notes requested.
764 764
 	 */
765
-	public function get_notes( $length = 20, $paged = 1 ) {
765
+	public function get_notes($length = 20, $paged = 1) {
766 766
 
767
-		$length = is_numeric( $length ) ? $length : 20;
768
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
767
+		$length = is_numeric($length) ? $length : 20;
768
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
769 769
 
770 770
 		$all_notes   = $this->get_raw_notes();
771
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
771
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
772 772
 
773
-		$desired_notes = array_slice( $notes_array, $offset, $length );
773
+		$desired_notes = array_slice($notes_array, $offset, $length);
774 774
 
775 775
 		return $desired_notes;
776 776
 
@@ -787,9 +787,9 @@  discard block
 block discarded – undo
787 787
 	public function get_notes_count() {
788 788
 
789 789
 		$all_notes   = $this->get_raw_notes();
790
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
790
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
791 791
 
792
-		return count( $notes_array );
792
+		return count($notes_array);
793 793
 
794 794
 	}
795 795
 
@@ -803,22 +803,22 @@  discard block
 block discarded – undo
803 803
 	 *
804 804
 	 * @return string|boolean The new note if added successfully, false otherwise.
805 805
 	 */
806
-	public function add_note( $note = '' ) {
806
+	public function add_note($note = '') {
807 807
 
808
-		$note = trim( $note );
809
-		if ( empty( $note ) ) {
808
+		$note = trim($note);
809
+		if (empty($note)) {
810 810
 			return false;
811 811
 		}
812 812
 
813 813
 		$notes = $this->get_raw_notes();
814 814
 
815
-		if ( empty( $notes ) ) {
815
+		if (empty($notes)) {
816 816
 			$notes = '';
817 817
 		}
818 818
 
819
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
820
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
821
-		$notes .= "\n\n" . $new_note;
819
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
820
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
821
+		$notes .= "\n\n".$new_note;
822 822
 
823 823
 		/**
824 824
 		 * Fires before customer note added.
@@ -828,11 +828,11 @@  discard block
 block discarded – undo
828 828
 		 * @param string $new_note    New note to add.
829 829
 		 * @param int    $customer_id Customer id.
830 830
 		 */
831
-		do_action( 'give_customer_pre_add_note', $new_note, $this->id );
831
+		do_action('give_customer_pre_add_note', $new_note, $this->id);
832 832
 
833
-		$updated = $this->update( array( 'notes' => $notes ) );
833
+		$updated = $this->update(array('notes' => $notes));
834 834
 
835
-		if ( $updated ) {
835
+		if ($updated) {
836 836
 			$this->notes = $this->get_notes();
837 837
 		}
838 838
 
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
 		 * @param string $new_note       New note added.
846 846
 		 * @param int    $customer_id    Customer id.
847 847
 		 */
848
-		do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id );
848
+		do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id);
849 849
 
850 850
 		// Return the formatted note, so we can test, as well as update any displays
851 851
 		return $new_note;
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 	 */
863 863
 	private function get_raw_notes() {
864 864
 
865
-		$all_notes = $this->db->get_column( 'notes', $this->id );
865
+		$all_notes = $this->db->get_column('notes', $this->id);
866 866
 
867 867
 		return $all_notes;
868 868
 
@@ -879,8 +879,8 @@  discard block
 block discarded – undo
879 879
 	 *
880 880
 	 * @return mixed            Will be an array if $single is false. Will be value of meta data field if $single is true.
881 881
 	 */
882
-	public function get_meta( $meta_key = '', $single = true ) {
883
-		return Give()->customer_meta->get_meta( $this->id, $meta_key, $single );
882
+	public function get_meta($meta_key = '', $single = true) {
883
+		return Give()->customer_meta->get_meta($this->id, $meta_key, $single);
884 884
 	}
885 885
 
886 886
 	/**
@@ -895,8 +895,8 @@  discard block
 block discarded – undo
895 895
 	 *
896 896
 	 * @return bool               False for failure. True for success.
897 897
 	 */
898
-	public function add_meta( $meta_key = '', $meta_value, $unique = false ) {
899
-		return Give()->customer_meta->add_meta( $this->id, $meta_key, $meta_value, $unique );
898
+	public function add_meta($meta_key = '', $meta_value, $unique = false) {
899
+		return Give()->customer_meta->add_meta($this->id, $meta_key, $meta_value, $unique);
900 900
 	}
901 901
 
902 902
 	/**
@@ -911,8 +911,8 @@  discard block
 block discarded – undo
911 911
 	 *
912 912
 	 * @return bool               False on failure, true if success.
913 913
 	 */
914
-	public function update_meta( $meta_key = '', $meta_value, $prev_value = '' ) {
915
-		return Give()->customer_meta->update_meta( $this->id, $meta_key, $meta_value, $prev_value );
914
+	public function update_meta($meta_key = '', $meta_value, $prev_value = '') {
915
+		return Give()->customer_meta->update_meta($this->id, $meta_key, $meta_value, $prev_value);
916 916
 	}
917 917
 
918 918
 	/**
@@ -926,8 +926,8 @@  discard block
 block discarded – undo
926 926
 	 *
927 927
 	 * @return bool               False for failure. True for success.
928 928
 	 */
929
-	public function delete_meta( $meta_key = '', $meta_value = '' ) {
930
-		return Give()->customer_meta->delete_meta( $this->id, $meta_key, $meta_value );
929
+	public function delete_meta($meta_key = '', $meta_value = '') {
930
+		return Give()->customer_meta->delete_meta($this->id, $meta_key, $meta_value);
931 931
 	}
932 932
 
933 933
 	/**
@@ -940,51 +940,51 @@  discard block
 block discarded – undo
940 940
 	 *
941 941
 	 * @return array       The sanitized data, based off column defaults.
942 942
 	 */
943
-	private function sanitize_columns( $data ) {
943
+	private function sanitize_columns($data) {
944 944
 
945 945
 		$columns        = $this->db->get_columns();
946 946
 		$default_values = $this->db->get_column_defaults();
947 947
 
948
-		foreach ( $columns as $key => $type ) {
948
+		foreach ($columns as $key => $type) {
949 949
 
950 950
 			// Only sanitize data that we were provided
951
-			if ( ! array_key_exists( $key, $data ) ) {
951
+			if ( ! array_key_exists($key, $data)) {
952 952
 				continue;
953 953
 			}
954 954
 
955
-			switch ( $type ) {
955
+			switch ($type) {
956 956
 
957 957
 				case '%s':
958
-					if ( 'email' == $key ) {
959
-						$data[ $key ] = sanitize_email( $data[ $key ] );
960
-					} elseif ( 'notes' == $key ) {
961
-						$data[ $key ] = strip_tags( $data[ $key ] );
958
+					if ('email' == $key) {
959
+						$data[$key] = sanitize_email($data[$key]);
960
+					} elseif ('notes' == $key) {
961
+						$data[$key] = strip_tags($data[$key]);
962 962
 					} else {
963
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
963
+						$data[$key] = sanitize_text_field($data[$key]);
964 964
 					}
965 965
 					break;
966 966
 
967 967
 				case '%d':
968
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
969
-						$data[ $key ] = $default_values[ $key ];
968
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
969
+						$data[$key] = $default_values[$key];
970 970
 					} else {
971
-						$data[ $key ] = absint( $data[ $key ] );
971
+						$data[$key] = absint($data[$key]);
972 972
 					}
973 973
 					break;
974 974
 
975 975
 				case '%f':
976 976
 					// Convert what was given to a float
977
-					$value = floatval( $data[ $key ] );
977
+					$value = floatval($data[$key]);
978 978
 
979
-					if ( ! is_float( $value ) ) {
980
-						$data[ $key ] = $default_values[ $key ];
979
+					if ( ! is_float($value)) {
980
+						$data[$key] = $default_values[$key];
981 981
 					} else {
982
-						$data[ $key ] = $value;
982
+						$data[$key] = $value;
983 983
 					}
984 984
 					break;
985 985
 
986 986
 				default:
987
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
987
+					$data[$key] = sanitize_text_field($data[$key]);
988 988
 					break;
989 989
 
990 990
 			}
@@ -1002,33 +1002,33 @@  discard block
 block discarded – undo
1002 1002
 	 * @param  bool   $primary Allows setting the email added as the primary
1003 1003
 	 * @return bool            If the email was added successfully
1004 1004
 	 */
1005
-	public function add_email( $email = '', $primary = false ) {
1006
-		if( ! is_email( $email ) ) {
1005
+	public function add_email($email = '', $primary = false) {
1006
+		if ( ! is_email($email)) {
1007 1007
 			return false;
1008 1008
 		}
1009
-		$existing = new Give_Customer( $email );
1009
+		$existing = new Give_Customer($email);
1010 1010
 
1011
-		if( $existing->id > 0 ) {
1011
+		if ($existing->id > 0) {
1012 1012
 			// Email address already belongs to another customer
1013 1013
 			return false;
1014 1014
 		}
1015 1015
 
1016
-		if ( email_exists( $email ) ) {
1017
-			$user = get_user_by( 'email', $email );
1018
-			if ( $user->ID != $this->user_id ) {
1016
+		if (email_exists($email)) {
1017
+			$user = get_user_by('email', $email);
1018
+			if ($user->ID != $this->user_id) {
1019 1019
 				return false;
1020 1020
 			}
1021 1021
 		}
1022 1022
 
1023
-		do_action( 'give_donor_pre_add_email', $email, $this->id, $this );
1023
+		do_action('give_donor_pre_add_email', $email, $this->id, $this);
1024 1024
 
1025 1025
 		// Add is used to ensure duplicate emails are not added
1026
-		$ret = (bool) $this->add_meta( 'additional_email', $email );
1026
+		$ret = (bool) $this->add_meta('additional_email', $email);
1027 1027
 
1028
-		do_action( 'give_donor_post_add_email', $email, $this->id, $this );
1028
+		do_action('give_donor_post_add_email', $email, $this->id, $this);
1029 1029
 
1030
-		if ( $ret && true === $primary ) {
1031
-			$this->set_primary_email( $email );
1030
+		if ($ret && true === $primary) {
1031
+			$this->set_primary_email($email);
1032 1032
 		}
1033 1033
 
1034 1034
 		return $ret;
@@ -1042,16 +1042,16 @@  discard block
 block discarded – undo
1042 1042
 	 * @param  string $email The email address to remove from the customer
1043 1043
 	 * @return bool          If the email was removeed successfully
1044 1044
 	 */
1045
-	public function remove_email( $email = '' ) {
1046
-		if( ! is_email( $email ) ) {
1045
+	public function remove_email($email = '') {
1046
+		if ( ! is_email($email)) {
1047 1047
 			return false;
1048 1048
 		}
1049 1049
 
1050
-		do_action( 'give_donor_pre_remove_email', $email, $this->id, $this );
1050
+		do_action('give_donor_pre_remove_email', $email, $this->id, $this);
1051 1051
 
1052
-		$ret = (bool) $this->delete_meta( 'additional_email', $email );
1052
+		$ret = (bool) $this->delete_meta('additional_email', $email);
1053 1053
 
1054
-		do_action( 'give_donor_post_remove_email', $email, $this->id, $this );
1054
+		do_action('give_donor_post_remove_email', $email, $this->id, $this);
1055 1055
 
1056 1056
 		return $ret;
1057 1057
 	}
@@ -1065,16 +1065,16 @@  discard block
 block discarded – undo
1065 1065
 	 * @param  string $new_primary_email The email address to remove from the customer
1066 1066
 	 * @return bool                      If the email was set as primary successfully
1067 1067
 	 */
1068
-	public function set_primary_email( $new_primary_email = '' ) {
1069
-		if( ! is_email( $new_primary_email ) ) {
1068
+	public function set_primary_email($new_primary_email = '') {
1069
+		if ( ! is_email($new_primary_email)) {
1070 1070
 			return false;
1071 1071
 		}
1072 1072
 
1073
-		do_action( 'give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this );
1073
+		do_action('give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this);
1074 1074
 
1075
-		$existing = new Give_Customer( $new_primary_email );
1075
+		$existing = new Give_Customer($new_primary_email);
1076 1076
 
1077
-		if( $existing->id > 0 && (int) $existing->id !== (int) $this->id ) {
1077
+		if ($existing->id > 0 && (int) $existing->id !== (int) $this->id) {
1078 1078
 			// This email belongs to another customer
1079 1079
 			return false;
1080 1080
 		}
@@ -1082,21 +1082,21 @@  discard block
 block discarded – undo
1082 1082
 		$old_email = $this->email;
1083 1083
 
1084 1084
 		// Update customer record with new email
1085
-		$update = $this->update( array( 'email' => $new_primary_email ) );
1085
+		$update = $this->update(array('email' => $new_primary_email));
1086 1086
 
1087 1087
 		// Remove new primary from list of additional emails
1088
-		$remove = $this->remove_email( $new_primary_email );
1088
+		$remove = $this->remove_email($new_primary_email);
1089 1089
 
1090 1090
 		// Add old email to additional emails list
1091
-		$add = $this->add_email( $old_email );
1091
+		$add = $this->add_email($old_email);
1092 1092
 
1093 1093
 		$ret = $update && $remove && $add;
1094 1094
 
1095
-		if( $ret ) {
1095
+		if ($ret) {
1096 1096
 			$this->email = $new_primary_email;
1097 1097
 		}
1098 1098
 
1099
-		do_action( 'give_donor_post_set_primary_email', $new_primary_email, $this->id, $this );
1099
+		do_action('give_donor_post_set_primary_email', $new_primary_email, $this->id, $this);
1100 1100
 
1101 1101
 		return $ret;
1102 1102
 	}
Please login to merge, or discard this patch.
includes/forms/template.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param  array  $args An array of form arguments.
23 23
  *
24
- * @return string Donation form.
24
+ * @return false|null Donation form.
25 25
  */
26 26
 function give_get_donation_form( $args = array() ) {
27 27
 
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
  *
1360 1360
  * @param  int  $form_id The form ID.
1361 1361
  *
1362
- * @return void|bool
1362
+ * @return false|null
1363 1363
  */
1364 1364
 function give_terms_agreement( $form_id ) {
1365 1365
 	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
  * @param  int   $form_id The form ID.
1553 1553
  * @param  array $args    An array of form arguments.
1554 1554
  *
1555
- * @return mixed
1555
+ * @return boolean
1556 1556
  */
1557 1557
 function give_show_goal_progress( $form_id, $args ) {
1558 1558
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1033,9 +1033,12 @@
 block discarded – undo
1033 1033
 					}
1034 1034
 					?>
1035 1035
 				</select>
1036
-			<?php else : ?>
1036
+			<?php else {
1037
+	: ?>
1037 1038
 				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1038
-				       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1039
+				       placeholder="<?php esc_attr_e( 'State / Province', 'give' );
1040
+}
1041
+?>"/>
1039 1042
 			<?php endif; ?>
1040 1043
 		</p>
1041 1044
 		<?php
Please login to merge, or discard this patch.
Spacing   +393 added lines, -393 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,47 +23,47 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return string Donation form.
25 25
  */
26
-function give_get_donation_form( $args = array() ) {
26
+function give_get_donation_form($args = array()) {
27 27
 
28 28
 	global $post;
29 29
 
30
-	$form_id = is_object( $post ) ? $post->ID : 0;
30
+	$form_id = is_object($post) ? $post->ID : 0;
31 31
 
32
-	if ( isset( $args['id'] ) ) {
32
+	if (isset($args['id'])) {
33 33
 		$form_id = $args['id'];
34 34
 	}
35 35
 
36
-	$defaults = apply_filters( 'give_form_args_defaults', array(
36
+	$defaults = apply_filters('give_form_args_defaults', array(
37 37
 		'form_id' => $form_id,
38
-	) );
38
+	));
39 39
 
40
-	$args = wp_parse_args( $args, $defaults );
40
+	$args = wp_parse_args($args, $defaults);
41 41
 
42
-	$form = new Give_Donate_Form( $args['form_id'] );
42
+	$form = new Give_Donate_Form($args['form_id']);
43 43
 
44 44
 	//bail if no form ID.
45
-	if ( empty( $form->ID ) ) {
45
+	if (empty($form->ID)) {
46 46
 		return false;
47 47
 	}
48 48
 
49
-	$payment_mode = give_get_chosen_gateway( $form->ID );
49
+	$payment_mode = give_get_chosen_gateway($form->ID);
50 50
 
51
-	$form_action = add_query_arg( apply_filters( 'give_form_action_args', array(
51
+	$form_action = add_query_arg(apply_filters('give_form_action_args', array(
52 52
 		'payment-mode' => $payment_mode,
53
-	) ),
53
+	)),
54 54
 		give_get_current_page_url()
55 55
 	);
56 56
 
57 57
 	//Sanity Check: Donation form not published or user doesn't have permission to view drafts.
58
-	if ( 'publish' !== $form->post_status ) {
58
+	if ('publish' !== $form->post_status) {
59 59
 		return false;
60 60
 	}
61 61
 
62 62
 	//Get the form wrap CSS classes.
63
-	$form_wrap_classes = $form->get_form_wrap_classes( $args );
63
+	$form_wrap_classes = $form->get_form_wrap_classes($args);
64 64
 
65 65
 	//Get the <form> tag wrap CSS classes.
66
-	$form_classes = $form->get_form_classes( $args );
66
+	$form_classes = $form->get_form_classes($args);
67 67
 
68 68
 	ob_start();
69 69
 
@@ -75,23 +75,23 @@  discard block
 block discarded – undo
75 75
 	 * @param int   $form_id The form ID.
76 76
 	 * @param array $args    An array of form arguments.
77 77
 	 */
78
-	do_action( 'give_pre_form_output', $form->ID, $args );
78
+	do_action('give_pre_form_output', $form->ID, $args);
79 79
 
80 80
 	?>
81 81
 	<div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>">
82 82
 
83
-		<?php if ( $form->is_close_donation_form() ) {
83
+		<?php if ($form->is_close_donation_form()) {
84 84
 
85 85
 			//Get Goal thank you message.
86
-			$display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true );
87
-			$display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' );
86
+			$display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true);
87
+			$display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give');
88 88
 
89 89
 			//Print thank you message.
90
-			apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, true, 'success' ) );
90
+			apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, true, 'success'));
91 91
 
92 92
 		} else {
93 93
 
94
-			if ( isset( $args['show_title'] ) && $args['show_title'] == true ) {
94
+			if (isset($args['show_title']) && $args['show_title'] == true) {
95 95
 
96 96
 				/**
97 97
 				 * Filter the title
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 				 * @param int              $form_id
102 102
 				 * @param Give_Donate_Form $form
103 103
 				 */
104
-				echo apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>', $form_id,  $form );
104
+				echo apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>', $form_id, $form);
105 105
 
106 106
 			}
107 107
 
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
 			 * @param int   $form_id The form ID.
114 114
 			 * @param array $args    An array of form arguments.
115 115
 			 */
116
-			do_action( 'give_pre_form', $form->ID, $args );
116
+			do_action('give_pre_form', $form->ID, $args);
117 117
 			?>
118 118
 
119 119
 			<form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>"
120
-			      action="<?php echo esc_url_raw( $form_action ); ?>" method="post">
120
+			      action="<?php echo esc_url_raw($form_action); ?>" method="post">
121 121
 				<input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/>
122
-				<input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/>
122
+				<input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/>
123 123
 				<input type="hidden" name="give-current-url"
124
-				       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
124
+				       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
125 125
 				<input type="hidden" name="give-form-url"
126
-				       value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/>
126
+				       value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/>
127 127
 				<input type="hidden" name="give-form-minimum"
128
-				       value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/>
128
+				       value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/>
129 129
 
130 130
 				<!-- The following field is for robots only, invisible to humans: -->
131 131
 				<span class="give-hidden" style="display: none !important;">
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 				<?php
138 138
 
139 139
 				//Price ID hidden field for variable (mult-level) donation forms.
140
-				if ( give_has_variable_prices( $form_id ) ) {
140
+				if (give_has_variable_prices($form_id)) {
141 141
 					//get default selected price ID.
142
-					$prices   = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
142
+					$prices   = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
143 143
 					$price_id = 0;
144 144
 					//loop through prices.
145
-					foreach ( $prices as $price ) {
146
-						if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
145
+					foreach ($prices as $price) {
146
+						if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
147 147
 							$price_id = $price['_give_id']['level_id'];
148 148
 						};
149 149
 					}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 				 * @param int   $form_id The form ID.
160 160
 				 * @param array $args    An array of form arguments.
161 161
 				 */
162
-				do_action( 'give_checkout_form_top', $form->ID, $args );
162
+				do_action('give_checkout_form_top', $form->ID, $args);
163 163
 
164 164
 				/**
165 165
 				 * Fires while outputing donation form, for payment gatways fields.
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 				 * @param int   $form_id The form ID.
170 170
 				 * @param array $args    An array of form arguments.
171 171
 				 */
172
-				do_action( 'give_payment_mode_select', $form->ID, $args );
172
+				do_action('give_payment_mode_select', $form->ID, $args);
173 173
 
174 174
 				/**
175 175
 				 * Fires while outputing donation form, after all other fields.
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 				 * @param int   $form_id The form ID.
180 180
 				 * @param array $args    An array of form arguments.
181 181
 				 */
182
-				do_action( 'give_checkout_form_bottom', $form->ID, $args );
182
+				do_action('give_checkout_form_bottom', $form->ID, $args);
183 183
 
184 184
 				?>
185 185
 			</form>
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 			 * @param int   $form_id The form ID.
194 194
 			 * @param array $args    An array of form arguments.
195 195
 			 */
196
-			do_action( 'give_post_form', $form->ID, $args );
196
+			do_action('give_post_form', $form->ID, $args);
197 197
 
198 198
 		}
199 199
 		?>
200 200
 
201
-	</div><!--end #give-form-<?php echo absint( $form->ID ); ?>-->
201
+	</div><!--end #give-form-<?php echo absint($form->ID); ?>-->
202 202
 	<?php
203 203
 
204 204
 	/**
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 	 * @param int   $form_id The form ID.
210 210
 	 * @param array $args    An array of form arguments.
211 211
 	 */
212
-	do_action( 'give_post_form_output', $form->ID, $args );
212
+	do_action('give_post_form_output', $form->ID, $args);
213 213
 
214 214
 	$final_output = ob_get_clean();
215 215
 
216
-	echo apply_filters( 'give_donate_form', $final_output, $args );
216
+	echo apply_filters('give_donate_form', $final_output, $args);
217 217
 }
218 218
 
219 219
 /**
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
  *
231 231
  * @return string
232 232
  */
233
-function give_show_purchase_form( $form_id ) {
233
+function give_show_purchase_form($form_id) {
234 234
 
235
-	$payment_mode = give_get_chosen_gateway( $form_id );
235
+	$payment_mode = give_get_chosen_gateway($form_id);
236 236
 
237
-	if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) {
237
+	if ( ! isset($form_id) && isset($_POST['give_form_id'])) {
238 238
 		$form_id = $_POST['give_form_id'];
239 239
 	}
240 240
 
@@ -243,33 +243,33 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @since 1.7
245 245
 	 */
246
-	do_action( 'give_donation_form_top', $form_id );
246
+	do_action('give_donation_form_top', $form_id);
247 247
 
248
-	if ( give_can_checkout() && isset( $form_id ) ) {
248
+	if (give_can_checkout() && isset($form_id)) {
249 249
 
250 250
 		/**
251 251
 		 * Fires while displaying donation form, before registration login.
252 252
 		 *
253 253
 		 * @since 1.7
254 254
 		 */
255
-		do_action( 'give_donation_form_before_register_login', $form_id );
255
+		do_action('give_donation_form_before_register_login', $form_id);
256 256
 
257 257
 		/**
258 258
 		 * Fire when register/login form fields render.
259 259
 		 *
260 260
 		 * @since 1.7
261 261
 		 */
262
-		do_action( 'give_donation_form_register_login_fields', $form_id );
262
+		do_action('give_donation_form_register_login_fields', $form_id);
263 263
 
264 264
 		/**
265 265
 		 * Fire when credit card form fields render.
266 266
 		 *
267 267
 		 * @since 1.7
268 268
 		 */
269
-		do_action( 'give_donation_form_before_cc_form', $form_id );
269
+		do_action('give_donation_form_before_cc_form', $form_id);
270 270
 
271 271
 		// Load the credit card form and allow gateways to load their own if they wish.
272
-		if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) {
272
+		if (has_action('give_'.$payment_mode.'_cc_form')) {
273 273
 			/**
274 274
 			 * Fires while displaying donation form, credit card form fields for a given gateway.
275 275
 			 *
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 *
278 278
 			 * @param int $form_id The form ID.
279 279
 			 */
280
-			do_action( "give_{$payment_mode}_cc_form", $form_id );
280
+			do_action("give_{$payment_mode}_cc_form", $form_id);
281 281
 		} else {
282 282
 			/**
283 283
 			 * Fires while displaying donation form, credit card form fields.
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			 *
287 287
 			 * @param int $form_id The form ID.
288 288
 			 */
289
-			do_action( 'give_cc_form', $form_id );
289
+			do_action('give_cc_form', $form_id);
290 290
 		}
291 291
 
292 292
 		/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 *
295 295
 		 * @since 1.7
296 296
 		 */
297
-		do_action( 'give_donation_form_after_cc_form', $form_id );
297
+		do_action('give_donation_form_after_cc_form', $form_id);
298 298
 
299 299
 	} else {
300 300
 		/**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 		 *
303 303
 		 * @since 1.7
304 304
 		 */
305
-		do_action( 'give_donation_form_no_access', $form_id );
305
+		do_action('give_donation_form_no_access', $form_id);
306 306
 
307 307
 	}
308 308
 
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 	 *
312 312
 	 * @since 1.7
313 313
 	 */
314
-	do_action( 'give_donation_form_bottom', $form_id );
314
+	do_action('give_donation_form_bottom', $form_id);
315 315
 }
316 316
 
317
-add_action( 'give_donation_form', 'give_show_purchase_form' );
317
+add_action('give_donation_form', 'give_show_purchase_form');
318 318
 
319 319
 /**
320 320
  * Give Show Login/Register Form Fields.
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
  *
326 326
  * @return void
327 327
  */
328
-function give_show_register_login_fields( $form_id ) {
328
+function give_show_register_login_fields($form_id) {
329 329
 
330
-	$show_register_form = give_show_login_register_option( $form_id );
330
+	$show_register_form = give_show_login_register_option($form_id);
331 331
 
332
-	if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
332
+	if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) :
333 333
 		?>
334 334
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
335 335
 			<?php
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
 			 *
339 339
 			 * @since 1.7
340 340
 			 */
341
-			do_action( 'give_donation_form_register_fields', $form_id );
341
+			do_action('give_donation_form_register_fields', $form_id);
342 342
 			?>
343 343
 		</div>
344 344
 		<?php
345
-	elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) :
345
+	elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) :
346 346
 		?>
347 347
 		<div id="give-checkout-login-register-<?php echo $form_id; ?>">
348 348
 			<?php
@@ -351,23 +351,23 @@  discard block
 block discarded – undo
351 351
 			 *
352 352
 			 * @since 1.7
353 353
 			 */
354
-			do_action( 'give_donation_form_login_fields', $form_id );
354
+			do_action('give_donation_form_login_fields', $form_id);
355 355
 			?>
356 356
 		</div>
357 357
 		<?php
358 358
 	endif;
359 359
 
360
-	if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) {
360
+	if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) {
361 361
 		/**
362 362
 		 * Fire when user info render.
363 363
 		 *
364 364
 		 * @since 1.7
365 365
 		 */
366
-		do_action( 'give_donation_form_after_user_info', $form_id );
366
+		do_action('give_donation_form_after_user_info', $form_id);
367 367
 	}
368 368
 }
369 369
 
370
-add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' );
370
+add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields');
371 371
 
372 372
 /**
373 373
  * Donation Amount Field.
@@ -381,16 +381,16 @@  discard block
 block discarded – undo
381 381
  *
382 382
  * @return void
383 383
  */
384
-function give_output_donation_amount_top( $form_id = 0, $args = array() ) {
384
+function give_output_donation_amount_top($form_id = 0, $args = array()) {
385 385
 
386 386
 	$give_options        = give_get_settings();
387
-	$variable_pricing    = give_has_variable_prices( $form_id );
388
-	$allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true );
389
-	$currency_position   = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
390
-	$symbol              = give_currency_symbol( give_get_currency() );
391
-	$currency_output     = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>';
392
-	$default_amount      = give_format_amount( give_get_default_form_amount( $form_id ) );
393
-	$custom_amount_text  = get_post_meta( $form_id, '_give_custom_amount_text', true );
387
+	$variable_pricing    = give_has_variable_prices($form_id);
388
+	$allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true);
389
+	$currency_position   = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
390
+	$symbol              = give_currency_symbol(give_get_currency());
391
+	$currency_output     = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>';
392
+	$default_amount      = give_format_amount(give_get_default_form_amount($form_id));
393
+	$custom_amount_text  = get_post_meta($form_id, '_give_custom_amount_text', true);
394 394
 
395 395
 	/**
396 396
 	 * Fires while displaying donation form, before donation level fields.
@@ -400,20 +400,20 @@  discard block
 block discarded – undo
400 400
 	 * @param int   $form_id The form ID.
401 401
 	 * @param array $args    An array of form arguments.
402 402
 	 */
403
-	do_action( 'give_before_donation_levels', $form_id, $args );
403
+	do_action('give_before_donation_levels', $form_id, $args);
404 404
 
405 405
 	//Set Price, No Custom Amount Allowed means hidden price field.
406
-	if ( $allow_custom_amount == 'no' ) {
406
+	if ($allow_custom_amount == 'no') {
407 407
 		?>
408
-		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
408
+		<label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
409 409
 		<input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount"
410 410
 		       value="<?php echo $default_amount; ?>" required aria-required="true"/>
411 411
 		<div class="set-price give-donation-amount form-row-wide">
412
-			<?php if ( $currency_position == 'before' ) {
412
+			<?php if ($currency_position == 'before') {
413 413
 				echo $currency_output;
414 414
 			} ?>
415 415
 			<span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span>
416
-			<?php if ( $currency_position == 'after' ) {
416
+			<?php if ($currency_position == 'after') {
417 417
 				echo $currency_output;
418 418
 			} ?>
419 419
 		</div>
@@ -423,13 +423,13 @@  discard block
 block discarded – undo
423 423
 		?>
424 424
 		<div class="give-total-wrap">
425 425
 			<div class="give-donation-amount form-row-wide">
426
-				<?php if ( $currency_position == 'before' ) {
426
+				<?php if ($currency_position == 'before') {
427 427
 					echo $currency_output;
428 428
 				} ?>
429
-				<label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label>
429
+				<label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label>
430 430
 				<input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel"
431 431
 				       placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off">
432
-				<?php if ( $currency_position == 'after' ) {
432
+				<?php if ($currency_position == 'after') {
433 433
 					echo $currency_output;
434 434
 				} ?>
435 435
 			</div>
@@ -444,16 +444,16 @@  discard block
 block discarded – undo
444 444
 	 * @param int   $form_id The form ID.
445 445
 	 * @param array $args    An array of form arguments.
446 446
 	 */
447
-	do_action( 'give_after_donation_amount', $form_id, $args );
447
+	do_action('give_after_donation_amount', $form_id, $args);
448 448
 
449 449
 	//Custom Amount Text.
450
-	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty( $custom_amount_text ) ) { ?>
450
+	if ( ! $variable_pricing && $allow_custom_amount == 'yes' && ! empty($custom_amount_text)) { ?>
451 451
 		<p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p>
452 452
 	<?php }
453 453
 
454 454
 	//Output Variable Pricing Levels.
455
-	if ( $variable_pricing ) {
456
-		give_output_levels( $form_id );
455
+	if ($variable_pricing) {
456
+		give_output_levels($form_id);
457 457
 	}
458 458
 
459 459
 	/**
@@ -464,10 +464,10 @@  discard block
 block discarded – undo
464 464
 	 * @param int   $form_id The form ID.
465 465
 	 * @param array $args    An array of form arguments.
466 466
 	 */
467
-	do_action( 'give_after_donation_levels', $form_id, $args );
467
+	do_action('give_after_donation_levels', $form_id, $args);
468 468
 }
469 469
 
470
-add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 );
470
+add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2);
471 471
 
472 472
 /**
473 473
  * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons.
@@ -478,32 +478,32 @@  discard block
 block discarded – undo
478 478
  *
479 479
  * @return string Donation levels.
480 480
  */
481
-function give_output_levels( $form_id ) {
481
+function give_output_levels($form_id) {
482 482
 
483 483
 	//Get variable pricing.
484
-	$prices             = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
485
-	$display_style      = get_post_meta( $form_id, '_give_display_style', true );
486
-	$custom_amount      = get_post_meta( $form_id, '_give_custom_amount', true );
487
-	$custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true );
488
-	if ( empty( $custom_amount_text ) ) {
489
-		$custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' );
484
+	$prices             = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
485
+	$display_style      = get_post_meta($form_id, '_give_display_style', true);
486
+	$custom_amount      = get_post_meta($form_id, '_give_custom_amount', true);
487
+	$custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true);
488
+	if (empty($custom_amount_text)) {
489
+		$custom_amount_text = esc_html__('Give a Custom Amount', 'give');
490 490
 	}
491 491
 
492 492
 	$output  = '';
493 493
 	$counter = 0;
494 494
 
495
-	switch ( $display_style ) {
495
+	switch ($display_style) {
496 496
 		case 'buttons':
497 497
 
498 498
 			$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">';
499 499
 
500
-			foreach ( $prices as $price ) {
501
-				$counter ++;
502
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
503
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price );
500
+			foreach ($prices as $price) {
501
+				$counter++;
502
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
503
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price);
504 504
 
505 505
 				$output .= '<li>';
506
-				$output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">';
506
+				$output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">';
507 507
 				$output .= $level_text;
508 508
 				$output .= '</button>';
509 509
 				$output .= '</li>';
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 			}
512 512
 
513 513
 			//Custom Amount.
514
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
514
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
515 515
 				$output .= '<li>';
516 516
 				$output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">';
517 517
 				$output .= $custom_amount_text;
@@ -527,23 +527,23 @@  discard block
 block discarded – undo
527 527
 
528 528
 			$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">';
529 529
 
530
-			foreach ( $prices as $price ) {
531
-				$counter ++;
532
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
533
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
530
+			foreach ($prices as $price) {
531
+				$counter++;
532
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
533
+				$level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
534 534
 
535 535
 				$output .= '<li>';
536
-				$output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
537
-				$output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>';
536
+				$output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
537
+				$output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>';
538 538
 				$output .= '</li>';
539 539
 
540 540
 			}
541 541
 
542 542
 			//Custom Amount.
543
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
543
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
544 544
 				$output .= '<li>';
545 545
 				$output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">';
546
-				$output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>';
546
+				$output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>';
547 547
 				$output .= '</li>';
548 548
 			}
549 549
 
@@ -553,23 +553,23 @@  discard block
 block discarded – undo
553 553
 
554 554
 		case 'dropdown':
555 555
 
556
-			$output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>';
557
-			$output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">';
556
+			$output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>';
557
+			$output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">';
558 558
 
559 559
 			//first loop through prices.
560
-			foreach ( $prices as $price ) {
561
-				$level_text    = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price );
562
-				$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price );
560
+			foreach ($prices as $price) {
561
+				$level_text    = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price);
562
+				$level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price);
563 563
 
564
-				$output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">';
564
+				$output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">';
565 565
 				$output .= $level_text;
566 566
 				$output .= '</option>';
567 567
 
568 568
 			}
569 569
 
570 570
 			//Custom Amount.
571
-			if ( $custom_amount === 'yes' && ! empty( $custom_amount_text ) ) {
572
-				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>';
571
+			if ($custom_amount === 'yes' && ! empty($custom_amount_text)) {
572
+				$output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>';
573 573
 			}
574 574
 
575 575
 			$output .= '</select>';
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 			break;
578 578
 	}
579 579
 
580
-	echo apply_filters( 'give_form_level_output', $output, $form_id );
580
+	echo apply_filters('give_form_level_output', $output, $form_id);
581 581
 }
582 582
 
583 583
 /**
@@ -592,26 +592,26 @@  discard block
 block discarded – undo
592 592
  *
593 593
  * @return string Checkout button.
594 594
  */
595
-function give_display_checkout_button( $form_id, $args ) {
595
+function give_display_checkout_button($form_id, $args) {
596 596
 
597
-	$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
597
+	$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
598 598
 		? $args['display_style']
599
-		: get_post_meta( $form_id, '_give_payment_display', true );
599
+		: get_post_meta($form_id, '_give_payment_display', true);
600 600
 
601 601
 	//no btn for onpage.
602
-	if ( $display_option === 'onpage' ) {
602
+	if ($display_option === 'onpage') {
603 603
 		return;
604 604
 	}
605 605
 
606
-	$display_label_field = get_post_meta( $form_id, '_give_reveal_label', true );
607
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
606
+	$display_label_field = get_post_meta($form_id, '_give_reveal_label', true);
607
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
608 608
 
609
-	$output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>';
609
+	$output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>';
610 610
 
611
-	echo apply_filters( 'give_display_checkout_button', $output );
611
+	echo apply_filters('give_display_checkout_button', $output);
612 612
 }
613 613
 
614
-add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 );
614
+add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2);
615 615
 
616 616
 /**
617 617
  * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided.
@@ -622,57 +622,57 @@  discard block
 block discarded – undo
622 622
  *
623 623
  * @return void
624 624
  */
625
-function give_user_info_fields( $form_id ) {
625
+function give_user_info_fields($form_id) {
626 626
 	// Get user info.
627
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
627
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
628 628
 
629 629
 	/**
630 630
 	 * Fire before user personal information fields
631 631
 	 *
632 632
 	 * @since 1.7
633 633
 	 */
634
-	do_action( 'give_donation_form_before_personal_info', $form_id );
634
+	do_action('give_donation_form_before_personal_info', $form_id);
635 635
 	?>
636 636
 	<fieldset id="give_checkout_user_info">
637
-		<legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend>
637
+		<legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend>
638 638
 		<p id="give-first-name-wrap" class="form-row form-row-first">
639 639
 			<label class="give-label" for="give-first">
640
-				<?php esc_html_e( 'First Name', 'give' ); ?>
641
-				<?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?>
640
+				<?php esc_html_e('First Name', 'give'); ?>
641
+				<?php if (give_field_is_required('give_first', $form_id)) : ?>
642 642
 					<span class="give-required-indicator">*</span>
643 643
 				<?php endif ?>
644 644
 				<span class="give-tooltip give-icon give-icon-question"
645
-				      data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span>
645
+				      data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span>
646 646
 			</label>
647 647
 			<input
648 648
 				class="give-input required"
649 649
 				type="text"
650 650
 				name="give_first"
651
-				placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>"
651
+				placeholder="<?php esc_attr_e('First Name', 'give'); ?>"
652 652
 				id="give-first"
653
-				value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>"
654
-				<?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
653
+				value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>"
654
+				<?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?>
655 655
 			/>
656 656
 		</p>
657 657
 
658 658
 		<p id="give-last-name-wrap" class="form-row form-row-last">
659 659
 			<label class="give-label" for="give-last">
660
-				<?php esc_html_e( 'Last Name', 'give' ); ?>
661
-				<?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?>
660
+				<?php esc_html_e('Last Name', 'give'); ?>
661
+				<?php if (give_field_is_required('give_last', $form_id)) : ?>
662 662
 					<span class="give-required-indicator">*</span>
663 663
 				<?php endif ?>
664 664
 				<span class="give-tooltip give-icon give-icon-question"
665
-				      data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span>
665
+				      data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span>
666 666
 			</label>
667 667
 
668 668
 			<input
669
-				class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>"
669
+				class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>"
670 670
 				type="text"
671 671
 				name="give_last"
672 672
 				id="give-last"
673
-				placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>"
674
-				value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>"
675
-				<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
673
+				placeholder="<?php esc_attr_e('Last Name', 'give'); ?>"
674
+				value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>"
675
+				<?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?>
676 676
 			/>
677 677
 		</p>
678 678
 
@@ -682,26 +682,26 @@  discard block
 block discarded – undo
682 682
 		 *
683 683
 		 * @since 1.7
684 684
 		 */
685
-		do_action( 'give_donation_form_before_email', $form_id );
685
+		do_action('give_donation_form_before_email', $form_id);
686 686
 		?>
687 687
 		<p id="give-email-wrap" class="form-row form-row-wide">
688 688
 			<label class="give-label" for="give-email">
689
-				<?php esc_html_e( 'Email Address', 'give' ); ?>
690
-				<?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?>
689
+				<?php esc_html_e('Email Address', 'give'); ?>
690
+				<?php if (give_field_is_required('give_email', $form_id)) { ?>
691 691
 					<span class="give-required-indicator">*</span>
692 692
 				<?php } ?>
693 693
 				<span class="give-tooltip give-icon give-icon-question"
694
-				      data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span>
694
+				      data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span>
695 695
 			</label>
696 696
 
697 697
 			<input
698 698
 				class="give-input required"
699 699
 				type="email"
700 700
 				name="give_email"
701
-				placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>"
701
+				placeholder="<?php esc_attr_e('Email Address', 'give'); ?>"
702 702
 				id="give-email"
703
-				value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>"
704
-				<?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
703
+				value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>"
704
+				<?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?>
705 705
 			/>
706 706
 
707 707
 		</p>
@@ -711,14 +711,14 @@  discard block
 block discarded – undo
711 711
 		 *
712 712
 		 * @since 1.7
713 713
 		 */
714
-		do_action( 'give_donation_form_after_email', $form_id );
714
+		do_action('give_donation_form_after_email', $form_id);
715 715
 
716 716
 		/**
717 717
 		 * Fire after personal email field
718 718
 		 *
719 719
 		 * @since 1.7
720 720
 		 */
721
-		do_action( 'give_donation_form_user_info', $form_id );
721
+		do_action('give_donation_form_user_info', $form_id);
722 722
 		?>
723 723
 	</fieldset>
724 724
 	<?php
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
 	 *
728 728
 	 * @since 1.7
729 729
 	 */
730
-	do_action( 'give_donation_form_after_personal_info', $form_id );
730
+	do_action('give_donation_form_after_personal_info', $form_id);
731 731
 }
732 732
 
733
-add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' );
734
-add_action( 'give_register_fields_before', 'give_user_info_fields' );
733
+add_action('give_donation_form_after_user_info', 'give_user_info_fields');
734
+add_action('give_register_fields_before', 'give_user_info_fields');
735 735
 
736 736
 /**
737 737
  * Renders the credit card info form.
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
  *
743 743
  * @return void
744 744
  */
745
-function give_get_cc_form( $form_id ) {
745
+function give_get_cc_form($form_id) {
746 746
 
747 747
 	ob_start();
748 748
 
@@ -753,53 +753,53 @@  discard block
 block discarded – undo
753 753
 	 *
754 754
 	 * @param int $form_id The form ID.
755 755
 	 */
756
-	do_action( 'give_before_cc_fields', $form_id );
756
+	do_action('give_before_cc_fields', $form_id);
757 757
 	?>
758 758
 	<fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate">
759
-		<legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend>
760
-		<?php if ( is_ssl() ) : ?>
759
+		<legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend>
760
+		<?php if (is_ssl()) : ?>
761 761
 			<div id="give_secure_site_wrapper-<?php echo $form_id ?>">
762 762
 				<span class="give-icon padlock"></span>
763
-				<span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span>
763
+				<span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span>
764 764
 			</div>
765 765
 		<?php endif; ?>
766 766
 		<p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
767 767
 			<label for="card_number-<?php echo $form_id ?>" class="give-label">
768
-				<?php esc_html_e( 'Card Number', 'give' ); ?>
768
+				<?php esc_html_e('Card Number', 'give'); ?>
769 769
 				<span class="give-required-indicator">*</span>
770 770
 				<span class="give-tooltip give-icon give-icon-question"
771
-				      data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span>
771
+				      data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span>
772 772
 				<span class="card-type"></span>
773 773
 			</label>
774 774
 
775 775
 			<input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>"
776
-			       class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>"
776
+			       class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>"
777 777
 			       required aria-required="true"/>
778 778
 		</p>
779 779
 
780 780
 		<p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third">
781 781
 			<label for="card_cvc-<?php echo $form_id ?>" class="give-label">
782
-				<?php esc_html_e( 'CVC', 'give' ); ?>
782
+				<?php esc_html_e('CVC', 'give'); ?>
783 783
 				<span class="give-required-indicator">*</span>
784 784
 				<span class="give-tooltip give-icon give-icon-question"
785
-				      data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span>
785
+				      data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span>
786 786
 			</label>
787 787
 
788 788
 			<input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>"
789
-			       class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>"
789
+			       class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>"
790 790
 			       required aria-required="true"/>
791 791
 		</p>
792 792
 
793 793
 		<p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds">
794 794
 			<label for="card_name-<?php echo $form_id ?>" class="give-label">
795
-				<?php esc_html_e( 'Name on the Card', 'give' ); ?>
795
+				<?php esc_html_e('Name on the Card', 'give'); ?>
796 796
 				<span class="give-required-indicator">*</span>
797 797
 				<span class="give-tooltip give-icon give-icon-question"
798
-				      data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span>
798
+				      data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span>
799 799
 			</label>
800 800
 
801 801
 			<input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>"
802
-			       class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>"
802
+			       class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>"
803 803
 			       required aria-required="true"/>
804 804
 		</p>
805 805
 		<?php
@@ -810,14 +810,14 @@  discard block
 block discarded – undo
810 810
 		 *
811 811
 		 * @param int $form_id The form ID.
812 812
 		 */
813
-		do_action( 'give_before_cc_expiration' );
813
+		do_action('give_before_cc_expiration');
814 814
 		?>
815 815
 		<p class="card-expiration form-row form-row-one-third">
816 816
 			<label for="card_expiry-<?php echo $form_id ?>" class="give-label">
817
-				<?php esc_html_e( 'Expiration', 'give' ); ?>
817
+				<?php esc_html_e('Expiration', 'give'); ?>
818 818
 				<span class="give-required-indicator">*</span>
819 819
 				<span class="give-tooltip give-icon give-icon-question"
820
-				      data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span>
820
+				      data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span>
821 821
 			</label>
822 822
 
823 823
 			<input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month"
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
 			       class="card-expiry-year"/>
827 827
 
828 828
 			<input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>"
829
-			       class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>"
829
+			       class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>"
830 830
 			       required aria-required="true"/>
831 831
 		</p>
832 832
 		<?php
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		 *
838 838
 		 * @param int $form_id The form ID.
839 839
 		 */
840
-		do_action( 'give_after_cc_expiration', $form_id );
840
+		do_action('give_after_cc_expiration', $form_id);
841 841
 		?>
842 842
 	</fieldset>
843 843
 	<?php
@@ -848,12 +848,12 @@  discard block
 block discarded – undo
848 848
 	 *
849 849
 	 * @param int $form_id The form ID.
850 850
 	 */
851
-	do_action( 'give_after_cc_fields', $form_id );
851
+	do_action('give_after_cc_fields', $form_id);
852 852
 
853 853
 	echo ob_get_clean();
854 854
 }
855 855
 
856
-add_action( 'give_cc_form', 'give_get_cc_form' );
856
+add_action('give_cc_form', 'give_get_cc_form');
857 857
 
858 858
 /**
859 859
  * Outputs the default credit card address fields.
@@ -864,24 +864,24 @@  discard block
 block discarded – undo
864 864
  *
865 865
  * @return void
866 866
  */
867
-function give_default_cc_address_fields( $form_id ) {
867
+function give_default_cc_address_fields($form_id) {
868 868
 	// Get user info.
869
-	$give_user_info = _give_get_prefill_form_field_values( $form_id );
869
+	$give_user_info = _give_get_prefill_form_field_values($form_id);
870 870
 
871 871
 	$logged_in = is_user_logged_in();
872 872
 
873
-	if ( $logged_in ) {
874
-		$user_address = get_user_meta( get_current_user_id(), '_give_user_address', true );
873
+	if ($logged_in) {
874
+		$user_address = get_user_meta(get_current_user_id(), '_give_user_address', true);
875 875
 	}
876
-	$line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : '';
877
-	$line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : '';
878
-	$city  = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : '';
879
-	$zip   = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : '';
876
+	$line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : '';
877
+	$line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : '';
878
+	$city  = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : '';
879
+	$zip   = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : '';
880 880
 
881 881
 	ob_start();
882 882
 	?>
883 883
 	<fieldset id="give_cc_address" class="cc-address">
884
-		<legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend>
884
+		<legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend>
885 885
 		<?php
886 886
 		/**
887 887
 		 * Fires while rendering credit card billing form, before address fields.
@@ -890,79 +890,79 @@  discard block
 block discarded – undo
890 890
 		 *
891 891
 		 * @param int $form_id The form ID.
892 892
 		 */
893
-		do_action( 'give_cc_billing_top' );
893
+		do_action('give_cc_billing_top');
894 894
 		?>
895 895
 		<p id="give-card-address-wrap" class="form-row form-row-two-thirds">
896 896
 			<label for="card_address" class="give-label">
897
-				<?php esc_html_e( 'Address 1', 'give' ); ?>
897
+				<?php esc_html_e('Address 1', 'give'); ?>
898 898
 				<?php
899
-				if ( give_field_is_required( 'card_address', $form_id ) ) : ?>
899
+				if (give_field_is_required('card_address', $form_id)) : ?>
900 900
 					<span class="give-required-indicator">*</span>
901 901
 				<?php endif; ?>
902 902
 				<span class="give-tooltip give-icon give-icon-question"
903
-				      data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span>
903
+				      data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span>
904 904
 			</label>
905 905
 
906 906
 			<input
907 907
 				type="text"
908 908
 				id="card_address"
909 909
 				name="card_address"
910
-				class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>"
911
-				placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>"
912
-				value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>"
913
-				<?php echo( give_field_is_required( 'card_address', $form_id ) ? '  required aria-required="true" ' : '' ); ?>
910
+				class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>"
911
+				placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>"
912
+				value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>"
913
+				<?php echo(give_field_is_required('card_address', $form_id) ? '  required aria-required="true" ' : ''); ?>
914 914
 			/>
915 915
 		</p>
916 916
 
917 917
 		<p id="give-card-address-2-wrap" class="form-row form-row-one-third">
918 918
 			<label for="card_address_2" class="give-label">
919
-				<?php esc_html_e( 'Address 2', 'give' ); ?>
920
-				<?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?>
919
+				<?php esc_html_e('Address 2', 'give'); ?>
920
+				<?php if (give_field_is_required('card_address_2', $form_id)) : ?>
921 921
 					<span class="give-required-indicator">*</span>
922 922
 				<?php endif; ?>
923 923
 				<span class="give-tooltip give-icon give-icon-question"
924
-				      data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span>
924
+				      data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span>
925 925
 			</label>
926 926
 
927 927
 			<input
928 928
 				type="text"
929 929
 				id="card_address_2"
930 930
 				name="card_address_2"
931
-				class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>"
932
-				placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>"
933
-				value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>"
934
-				<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
931
+				class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>"
932
+				placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>"
933
+				value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>"
934
+				<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?>
935 935
 			/>
936 936
 		</p>
937 937
 
938 938
 		<p id="give-card-city-wrap" class="form-row form-row-two-thirds">
939 939
 			<label for="card_city" class="give-label">
940
-				<?php esc_html_e( 'City', 'give' ); ?>
941
-				<?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?>
940
+				<?php esc_html_e('City', 'give'); ?>
941
+				<?php if (give_field_is_required('card_city', $form_id)) : ?>
942 942
 					<span class="give-required-indicator">*</span>
943 943
 				<?php endif; ?>
944 944
 				<span class="give-tooltip give-icon give-icon-question"
945
-				      data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span>
945
+				      data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span>
946 946
 			</label>
947 947
 			<input
948 948
 				type="text"
949 949
 				id="card_city"
950 950
 				name="card_city"
951
-				class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>"
952
-				placeholder="<?php esc_attr_e( 'City', 'give' ); ?>"
953
-				value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>"
954
-				<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
951
+				class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>"
952
+				placeholder="<?php esc_attr_e('City', 'give'); ?>"
953
+				value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>"
954
+				<?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?>
955 955
 			/>
956 956
 		</p>
957 957
 
958 958
 		<p id="give-card-zip-wrap" class="form-row form-row-one-third">
959 959
 			<label for="card_zip" class="give-label">
960
-				<?php esc_html_e( 'Zip / Postal Code', 'give' ); ?>
961
-				<?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?>
960
+				<?php esc_html_e('Zip / Postal Code', 'give'); ?>
961
+				<?php if (give_field_is_required('card_zip', $form_id)) : ?>
962 962
 					<span class="give-required-indicator">*</span>
963 963
 				<?php endif; ?>
964 964
 				<span class="give-tooltip give-icon give-icon-question"
965
-				      data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span>
965
+				      data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span>
966 966
 			</label>
967 967
 
968 968
 			<input
@@ -970,40 +970,40 @@  discard block
 block discarded – undo
970 970
 				size="4"
971 971
 				id="card_zip"
972 972
 				name="card_zip"
973
-				class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>"
974
-				placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>"
975
-				value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>"
976
-				<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
973
+				class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>"
974
+				placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>"
975
+				value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>"
976
+				<?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?>
977 977
 			/>
978 978
 		</p>
979 979
 
980 980
 		<p id="give-card-country-wrap" class="form-row form-row-first">
981 981
 			<label for="billing_country" class="give-label">
982
-				<?php esc_html_e( 'Country', 'give' ); ?>
983
-				<?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?>
982
+				<?php esc_html_e('Country', 'give'); ?>
983
+				<?php if (give_field_is_required('billing_country', $form_id)) : ?>
984 984
 					<span class="give-required-indicator">*</span>
985 985
 				<?php endif; ?>
986 986
 				<span class="give-tooltip give-icon give-icon-question"
987
-				      data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span>
987
+				      data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span>
988 988
 			</label>
989 989
 
990 990
 			<select
991 991
 				name="billing_country"
992 992
 				id="billing_country"
993
-				class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>"
994
-				<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?>
993
+				class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>"
994
+				<?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?>
995 995
 			>
996 996
 				<?php
997 997
 
998 998
 				$selected_country = give_get_country();
999 999
 
1000
-				if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) {
1000
+				if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) {
1001 1001
 					$selected_country = $give_user_info['billing_country'];
1002 1002
 				}
1003 1003
 
1004 1004
 				$countries = give_get_country_list();
1005
-				foreach ( $countries as $country_code => $country ) {
1006
-					echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
1005
+				foreach ($countries as $country_code => $country) {
1006
+					echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
1007 1007
 				}
1008 1008
 				?>
1009 1009
 			</select>
@@ -1011,39 +1011,39 @@  discard block
 block discarded – undo
1011 1011
 
1012 1012
 		<p id="give-card-state-wrap" class="form-row form-row-last">
1013 1013
 			<label for="card_state" class="give-label">
1014
-				<?php esc_html_e( 'State / Province', 'give' ); ?>
1015
-				<?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?>
1014
+				<?php esc_html_e('State / Province', 'give'); ?>
1015
+				<?php if (give_field_is_required('card_state', $form_id)) : ?>
1016 1016
 					<span class="give-required-indicator">*</span>
1017 1017
 				<?php endif; ?>
1018 1018
 				<span class="give-tooltip give-icon give-icon-question"
1019
-				      data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span>
1019
+				      data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span>
1020 1020
 			</label>
1021 1021
 
1022 1022
 			<?php
1023 1023
 			$selected_state = give_get_state();
1024
-			$states         = give_get_states( $selected_country );
1024
+			$states         = give_get_states($selected_country);
1025 1025
 
1026
-			if ( ! empty( $give_user_info['card_state'] ) ) {
1026
+			if ( ! empty($give_user_info['card_state'])) {
1027 1027
 				$selected_state = $give_user_info['card_state'];
1028 1028
 			}
1029 1029
 
1030
-			if ( ! empty( $states ) ) : ?>
1030
+			if ( ! empty($states)) : ?>
1031 1031
 				<select
1032 1032
 					name="card_state"
1033 1033
 					id="card_state"
1034
-					class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>"
1035
-					<?php if ( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ) {
1034
+					class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>"
1035
+					<?php if (give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : '') {
1036 1036
 						;
1037 1037
 					} ?>>
1038 1038
 					<?php
1039
-					foreach ( $states as $state_code => $state ) {
1040
-						echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
1039
+					foreach ($states as $state_code => $state) {
1040
+						echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
1041 1041
 					}
1042 1042
 					?>
1043 1043
 				</select>
1044 1044
 			<?php else : ?>
1045 1045
 				<input type="text" size="6" name="card_state" id="card_state" class="card_state give-input"
1046
-				       placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/>
1046
+				       placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/>
1047 1047
 			<?php endif; ?>
1048 1048
 		</p>
1049 1049
 		<?php
@@ -1054,14 +1054,14 @@  discard block
 block discarded – undo
1054 1054
 		 *
1055 1055
 		 * @param int $form_id The form ID.
1056 1056
 		 */
1057
-		do_action( 'give_cc_billing_bottom' );
1057
+		do_action('give_cc_billing_bottom');
1058 1058
 		?>
1059 1059
 	</fieldset>
1060 1060
 	<?php
1061 1061
 	echo ob_get_clean();
1062 1062
 }
1063 1063
 
1064
-add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' );
1064
+add_action('give_after_cc_fields', 'give_default_cc_address_fields');
1065 1065
 
1066 1066
 
1067 1067
 /**
@@ -1073,27 +1073,27 @@  discard block
 block discarded – undo
1073 1073
  *
1074 1074
  * @return string
1075 1075
  */
1076
-function give_get_register_fields( $form_id ) {
1076
+function give_get_register_fields($form_id) {
1077 1077
 
1078 1078
 	global $user_ID;
1079 1079
 
1080
-	if ( is_user_logged_in() ) {
1081
-		$user_data = get_userdata( $user_ID );
1080
+	if (is_user_logged_in()) {
1081
+		$user_data = get_userdata($user_ID);
1082 1082
 	}
1083 1083
 
1084
-	$show_register_form = give_show_login_register_option( $form_id );
1084
+	$show_register_form = give_show_login_register_option($form_id);
1085 1085
 
1086 1086
 	ob_start(); ?>
1087 1087
 	<fieldset id="give-register-fields-<?php echo $form_id; ?>">
1088 1088
 
1089
-		<?php if ( $show_register_form == 'both' ) { ?>
1089
+		<?php if ($show_register_form == 'both') { ?>
1090 1090
 			<div class="give-login-account-wrap">
1091
-				<p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?>&nbsp;
1092
-					<a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login"
1093
-					   data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a>
1091
+				<p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?>&nbsp;
1092
+					<a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login"
1093
+					   data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a>
1094 1094
 				</p>
1095 1095
 				<p class="give-loading-text">
1096
-					<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p>
1096
+					<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p>
1097 1097
 			</div>
1098 1098
 		<?php } ?>
1099 1099
 
@@ -1105,15 +1105,15 @@  discard block
 block discarded – undo
1105 1105
 		 *
1106 1106
 		 * @param int $form_id The form ID.
1107 1107
 		 */
1108
-		do_action( 'give_register_fields_before', $form_id );
1108
+		do_action('give_register_fields_before', $form_id);
1109 1109
 		?>
1110 1110
 
1111 1111
 		<fieldset id="give-register-account-fields-<?php echo $form_id; ?>">
1112 1112
 			<legend>
1113 1113
 				<?php
1114
-				echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) );
1115
-				if ( ! give_logged_in_only( $form_id ) ) {
1116
-					echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1114
+				echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give'));
1115
+				if ( ! give_logged_in_only($form_id)) {
1116
+					echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1117 1117
 				}
1118 1118
 				?>
1119 1119
 			</legend>
@@ -1125,52 +1125,52 @@  discard block
 block discarded – undo
1125 1125
 			 *
1126 1126
 			 * @param int $form_id The form ID.
1127 1127
 			 */
1128
-			do_action( 'give_register_account_fields_before', $form_id );
1128
+			do_action('give_register_account_fields_before', $form_id);
1129 1129
 			?>
1130 1130
 			<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first">
1131 1131
 				<label for="give-user-login-<?php echo $form_id; ?>">
1132
-					<?php esc_html_e( 'Username', 'give' ); ?>
1133
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1132
+					<?php esc_html_e('Username', 'give'); ?>
1133
+					<?php if (give_logged_in_only($form_id)) { ?>
1134 1134
 						<span class="give-required-indicator">*</span>
1135 1135
 					<?php } ?>
1136 1136
 					<span class="give-tooltip give-icon give-icon-question"
1137
-					      data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span>
1137
+					      data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span>
1138 1138
 				</label>
1139 1139
 
1140 1140
 				<input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input"
1141 1141
 				       type="text"
1142
-				       placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1142
+				       placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1143 1143
 			</div>
1144 1144
 
1145 1145
 			<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third">
1146 1146
 				<label for="give-user-pass-<?php echo $form_id; ?>">
1147
-					<?php esc_html_e( 'Password', 'give' ); ?>
1148
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1147
+					<?php esc_html_e('Password', 'give'); ?>
1148
+					<?php if (give_logged_in_only($form_id)) { ?>
1149 1149
 						<span class="give-required-indicator">*</span>
1150 1150
 					<?php } ?>
1151 1151
 					<span class="give-tooltip give-icon give-icon-question"
1152
-					      data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span>
1152
+					      data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span>
1153 1153
 				</label>
1154 1154
 
1155 1155
 				<input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input"
1156
-				       placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>"
1157
-				       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1156
+				       placeholder="<?php esc_attr_e('Password', 'give'); ?>"
1157
+				       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1158 1158
 			</div>
1159 1159
 
1160 1160
 			<div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>"
1161 1161
 			     class="give-register-password form-row form-row-one-third">
1162 1162
 				<label for="give-user-pass-confirm-<?php echo $form_id; ?>">
1163
-					<?php esc_html_e( 'Confirm PW', 'give' ); ?>
1164
-					<?php if ( give_logged_in_only( $form_id ) ) { ?>
1163
+					<?php esc_html_e('Confirm PW', 'give'); ?>
1164
+					<?php if (give_logged_in_only($form_id)) { ?>
1165 1165
 						<span class="give-required-indicator">*</span>
1166 1166
 					<?php } ?>
1167 1167
 					<span class="give-tooltip give-icon give-icon-question"
1168
-					      data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span>
1168
+					      data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span>
1169 1169
 				</label>
1170 1170
 
1171 1171
 				<input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>"
1172
-				       class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>"
1173
-				       type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1172
+				       class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>"
1173
+				       type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1174 1174
 			</div>
1175 1175
 			<?php
1176 1176
 			/**
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
 			 *
1181 1181
 			 * @param int $form_id The form ID.
1182 1182
 			 */
1183
-			do_action( 'give_register_account_fields_after', $form_id );
1183
+			do_action('give_register_account_fields_after', $form_id);
1184 1184
 			?>
1185 1185
 		</fieldset>
1186 1186
 
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 		 *
1193 1193
 		 * @param int $form_id The form ID.
1194 1194
 		 */
1195
-		do_action( 'give_register_fields_after', $form_id );
1195
+		do_action('give_register_fields_after', $form_id);
1196 1196
 		?>
1197 1197
 
1198 1198
 		<input type="hidden" name="give-purchase-var" value="needs-to-register"/>
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
 		 *
1204 1204
 		 * @since 1.7
1205 1205
 		 */
1206
-		do_action( 'give_donation_form_user_info', $form_id );
1206
+		do_action('give_donation_form_user_info', $form_id);
1207 1207
 		?>
1208 1208
 
1209 1209
 	</fieldset>
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 	echo ob_get_clean();
1212 1212
 }
1213 1213
 
1214
-add_action( 'give_donation_form_register_fields', 'give_get_register_fields' );
1214
+add_action('give_donation_form_register_fields', 'give_get_register_fields');
1215 1215
 
1216 1216
 /**
1217 1217
  * Gets the login fields for the login form on the checkout. This function hooks
@@ -1224,32 +1224,32 @@  discard block
 block discarded – undo
1224 1224
  *
1225 1225
  * @return string
1226 1226
  */
1227
-function give_get_login_fields( $form_id ) {
1227
+function give_get_login_fields($form_id) {
1228 1228
 
1229
-	$form_id            = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id;
1230
-	$show_register_form = give_show_login_register_option( $form_id );
1229
+	$form_id            = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id;
1230
+	$show_register_form = give_show_login_register_option($form_id);
1231 1231
 
1232 1232
 	ob_start();
1233 1233
 	?>
1234 1234
 	<fieldset id="give-login-fields-<?php echo $form_id; ?>">
1235
-		<legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) );
1236
-			if ( ! give_logged_in_only( $form_id ) ) {
1237
-				echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>';
1235
+		<legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give'));
1236
+			if ( ! give_logged_in_only($form_id)) {
1237
+				echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>';
1238 1238
 			} ?>
1239 1239
 		</legend>
1240
-		<?php if ( $show_register_form == 'both' ) { ?>
1240
+		<?php if ($show_register_form == 'both') { ?>
1241 1241
 			<p class="give-new-account-link">
1242
-				<?php esc_html_e( 'Need to create an account?', 'give' ); ?>&nbsp;
1243
-				<a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel"
1242
+				<?php esc_html_e('Need to create an account?', 'give'); ?>&nbsp;
1243
+				<a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel"
1244 1244
 				   data-action="give_checkout_register">
1245
-					<?php esc_html_e( 'Register', 'give' );
1246
-					if ( ! give_logged_in_only( $form_id ) ) {
1247
-						echo ' ' . esc_html__( 'or checkout as a guest &raquo;', 'give' );
1245
+					<?php esc_html_e('Register', 'give');
1246
+					if ( ! give_logged_in_only($form_id)) {
1247
+						echo ' '.esc_html__('or checkout as a guest &raquo;', 'give');
1248 1248
 					} ?>
1249 1249
 				</a>
1250 1250
 			</p>
1251 1251
 			<p class="give-loading-text">
1252
-				<span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p>
1252
+				<span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p>
1253 1253
 		<?php } ?>
1254 1254
 		<?php
1255 1255
 		/**
@@ -1259,48 +1259,48 @@  discard block
 block discarded – undo
1259 1259
 		 *
1260 1260
 		 * @param int $form_id The form ID.
1261 1261
 		 */
1262
-		do_action( 'give_checkout_login_fields_before', $form_id );
1262
+		do_action('give_checkout_login_fields_before', $form_id);
1263 1263
 		?>
1264 1264
 		<div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first">
1265 1265
 			<label class="give-label" for="give-user-login-<?php echo $form_id; ?>">
1266
-				<?php esc_html_e( 'Username', 'give' ); ?>
1267
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1266
+				<?php esc_html_e('Username', 'give'); ?>
1267
+				<?php if (give_logged_in_only($form_id)) { ?>
1268 1268
 					<span class="give-required-indicator">*</span>
1269 1269
 				<?php } ?>
1270 1270
 			</label>
1271 1271
 
1272
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text"
1272
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text"
1273 1273
 			       name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value=""
1274
-			       placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1274
+			       placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1275 1275
 		</div>
1276 1276
 
1277 1277
 		<div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last">
1278 1278
 			<label class="give-label" for="give-user-pass-<?php echo $form_id; ?>">
1279
-				<?php esc_html_e( 'Password', 'give' ); ?>
1280
-				<?php if ( give_logged_in_only( $form_id ) ) { ?>
1279
+				<?php esc_html_e('Password', 'give'); ?>
1280
+				<?php if (give_logged_in_only($form_id)) { ?>
1281 1281
 					<span class="give-required-indicator">*</span>
1282 1282
 				<?php } ?>
1283 1283
 			</label>
1284
-			<input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>"
1284
+			<input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>"
1285 1285
 			       type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>"
1286
-			       placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/>
1286
+			       placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/>
1287 1287
 			<input type="hidden" name="give-purchase-var" value="needs-to-login"/>
1288 1288
 		</div>
1289 1289
 
1290 1290
 		<div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password">
1291 1291
 			 <span class="give-forgot-password ">
1292 1292
 				 <a href="<?php echo wp_lostpassword_url() ?>"
1293
-				    target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a>
1293
+				    target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a>
1294 1294
 			 </span>
1295 1295
 		</div>
1296 1296
 
1297 1297
 		<div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix">
1298 1298
 			<input type="submit" class="give-submit give-btn button" name="give_login_submit"
1299
-			       value="<?php esc_attr_e( 'Login', 'give' ); ?>"/>
1300
-			<?php if ( $show_register_form !== 'login' ) { ?>
1299
+			       value="<?php esc_attr_e('Login', 'give'); ?>"/>
1300
+			<?php if ($show_register_form !== 'login') { ?>
1301 1301
 				<input type="button" data-action="give_cancel_login"
1302 1302
 				       class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel"
1303
-				       value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/>
1303
+				       value="<?php esc_attr_e('Cancel', 'give'); ?>"/>
1304 1304
 			<?php } ?>
1305 1305
 			<span class="give-loading-animation"></span>
1306 1306
 		</div>
@@ -1312,14 +1312,14 @@  discard block
 block discarded – undo
1312 1312
 		 *
1313 1313
 		 * @param int $form_id The form ID.
1314 1314
 		 */
1315
-		do_action( 'give_checkout_login_fields_after', $form_id );
1315
+		do_action('give_checkout_login_fields_after', $form_id);
1316 1316
 		?>
1317 1317
 	</fieldset><!--end #give-login-fields-->
1318 1318
 	<?php
1319 1319
 	echo ob_get_clean();
1320 1320
 }
1321 1321
 
1322
-add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 );
1322
+add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1);
1323 1323
 
1324 1324
 /**
1325 1325
  * Payment Mode Select.
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
  *
1336 1336
  * @return void
1337 1337
  */
1338
-function give_payment_mode_select( $form_id ) {
1338
+function give_payment_mode_select($form_id) {
1339 1339
 
1340 1340
 	$gateways = give_get_enabled_payment_gateways();
1341 1341
 
@@ -1346,10 +1346,10 @@  discard block
 block discarded – undo
1346 1346
 	 *
1347 1347
 	 * @param int $form_id The form ID.
1348 1348
 	 */
1349
-	do_action( 'give_payment_mode_top', $form_id );
1349
+	do_action('give_payment_mode_top', $form_id);
1350 1350
 	?>
1351 1351
 
1352
-	<fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) {
1352
+	<fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) {
1353 1353
 		echo 'style="display: none;"';
1354 1354
 	} ?>>
1355 1355
 		<?php
@@ -1360,14 +1360,14 @@  discard block
 block discarded – undo
1360 1360
 		 *
1361 1361
 		 * @param int $form_id The form ID.
1362 1362
 		 */
1363
-		do_action( 'give_payment_mode_before_gateways_wrap' );
1363
+		do_action('give_payment_mode_before_gateways_wrap');
1364 1364
 		?>
1365 1365
 		<legend
1366
-			class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?></legend>
1366
+			class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?></legend>
1367 1367
 
1368 1368
 		<div id="give-payment-mode-wrap">
1369 1369
 			<span class="give-loading-text"><span
1370
-					class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span>
1370
+					class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span>
1371 1371
 
1372 1372
 			<?php
1373 1373
 			/**
@@ -1375,26 +1375,26 @@  discard block
 block discarded – undo
1375 1375
 			 *
1376 1376
 			 * @since 1.7
1377 1377
 			 */
1378
-			do_action( 'give_payment_mode_before_gateways' )
1378
+			do_action('give_payment_mode_before_gateways')
1379 1379
 			?>
1380 1380
 			<ul id="give-gateway-radio-list">
1381 1381
 				<?php
1382 1382
 				/**
1383 1383
 				 * Loop through the active payment gateways.
1384 1384
 				 */
1385
-				$selected_gateway = give_get_chosen_gateway( $form_id );
1385
+				$selected_gateway = give_get_chosen_gateway($form_id);
1386 1386
 
1387
-				foreach ( $gateways as $gateway_id => $gateway ) :
1387
+				foreach ($gateways as $gateway_id => $gateway) :
1388 1388
 					//Determine the default gateway.
1389
-					$checked       = checked( $gateway_id, $selected_gateway, false );
1389
+					$checked       = checked($gateway_id, $selected_gateway, false);
1390 1390
 					$checked_class = $checked ? ' give-gateway-option-selected' : ''; ?>
1391 1391
 					<li>
1392 1392
 						<input type="radio" name="payment-mode" class="give-gateway"
1393
-						       id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1394
-						       value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>>
1395
-						<label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>"
1393
+						       id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1394
+						       value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>>
1395
+						<label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>"
1396 1396
 						       class="give-gateway-option<?php echo $checked_class; ?>"
1397
-						       id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label>
1397
+						       id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label>
1398 1398
 					</li>
1399 1399
 					<?php
1400 1400
 				endforeach;
@@ -1406,7 +1406,7 @@  discard block
 block discarded – undo
1406 1406
 			 *
1407 1407
 			 * @since 1.7
1408 1408
 			 */
1409
-			do_action( 'give_payment_mode_after_gateways' );
1409
+			do_action('give_payment_mode_after_gateways');
1410 1410
 			?>
1411 1411
 		</div>
1412 1412
 		<?php
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
 		 *
1418 1418
 		 * @param int $form_id The form ID.
1419 1419
 		 */
1420
-		do_action( 'give_payment_mode_after_gateways_wrap' );
1420
+		do_action('give_payment_mode_after_gateways_wrap');
1421 1421
 		?>
1422 1422
 	</fieldset>
1423 1423
 
@@ -1429,7 +1429,7 @@  discard block
 block discarded – undo
1429 1429
 	 *
1430 1430
 	 * @param int $form_id The form ID.
1431 1431
 	 */
1432
-	do_action( 'give_payment_mode_bottom', $form_id );
1432
+	do_action('give_payment_mode_bottom', $form_id);
1433 1433
 	?>
1434 1434
 
1435 1435
 	<div id="give_purchase_form_wrap">
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 		 *
1441 1441
 		 * @since 1.7
1442 1442
 		 */
1443
-		do_action( 'give_donation_form', $form_id );
1443
+		do_action('give_donation_form', $form_id);
1444 1444
 		?>
1445 1445
 
1446 1446
 	</div>
@@ -1451,10 +1451,10 @@  discard block
 block discarded – undo
1451 1451
 	 *
1452 1452
 	 * @since 1.7
1453 1453
 	 */
1454
-	do_action( 'give_donation_form_wrap_bottom', $form_id );
1454
+	do_action('give_donation_form_wrap_bottom', $form_id);
1455 1455
 }
1456 1456
 
1457
-add_action( 'give_payment_mode_select', 'give_payment_mode_select' );
1457
+add_action('give_payment_mode_select', 'give_payment_mode_select');
1458 1458
 
1459 1459
 /**
1460 1460
  * Renders the Checkout Agree to Terms, this displays a checkbox for users to
@@ -1467,25 +1467,25 @@  discard block
 block discarded – undo
1467 1467
  *
1468 1468
  * @return void|bool
1469 1469
  */
1470
-function give_terms_agreement( $form_id ) {
1471
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1470
+function give_terms_agreement($form_id) {
1471
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1472 1472
 
1473 1473
 	// Bailout if per form and global term and conditions is not setup.
1474
-	if ( 'yes' !== $form_option ) {
1474
+	if ('yes' !== $form_option) {
1475 1475
 		return false;
1476 1476
 	}
1477 1477
 
1478
-	$label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1479
-	$terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );
1478
+	$label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give'));
1479
+	$terms = ($terms = get_post_meta($form_id, '_give_agree_text', true)) ? $terms : give_get_option('agreement_text', '');
1480 1480
 
1481 1481
 	// Set term and conditions label and text on basis of per form and global setting.
1482 1482
 	// $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) );
1483 1483
 	// $terms = ( $terms = get_post_meta( $form_id, '_give_agree_text', true ) ) ? $terms : give_get_option( 'agreement_text', '' );
1484 1484
 
1485 1485
 	// Bailout: Check if term and conditions text is empty or not.
1486
-	if ( empty( $terms ) ) {
1487
-		if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
1488
-			echo sprintf( __( 'Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), admin_url( 'post.php?post=' . $form_id . '&action=edit' ) );
1486
+	if (empty($terms)) {
1487
+		if (is_user_logged_in() && current_user_can('manage_options')) {
1488
+			echo sprintf(__('Please enter term and conditions in <a href="%s">this form\'s settings</a>.', 'give'), admin_url('post.php?post='.$form_id.'&action=edit'));
1489 1489
 		}
1490 1490
 
1491 1491
 		return false;
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
 
1494 1494
 	?>
1495 1495
 	<fieldset id="give_terms_agreement">
1496
-		<legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend>
1496
+		<legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend>
1497 1497
 		<div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;">
1498 1498
 			<?php
1499 1499
 			/**
@@ -1501,22 +1501,22 @@  discard block
 block discarded – undo
1501 1501
 			 *
1502 1502
 			 * @since 1.0
1503 1503
 			 */
1504
-			do_action( 'give_before_terms' );
1504
+			do_action('give_before_terms');
1505 1505
 
1506
-			echo wpautop( stripslashes( $terms ) );
1506
+			echo wpautop(stripslashes($terms));
1507 1507
 			/**
1508 1508
 			 * Fires while rendering terms of agreement, after the fields.
1509 1509
 			 *
1510 1510
 			 * @since 1.0
1511 1511
 			 */
1512
-			do_action( 'give_after_terms' );
1512
+			do_action('give_after_terms');
1513 1513
 			?>
1514 1514
 		</div>
1515 1515
 		<div id="give_show_terms">
1516 1516
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1517
-			   aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a>
1517
+			   aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a>
1518 1518
 			<a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button"
1519
-			   aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a>
1519
+			   aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a>
1520 1520
 		</div>
1521 1521
 
1522 1522
 		<input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms-<?php echo $form_id; ?>" value="1" required aria-required="true" />
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
 	<?php
1527 1527
 }
1528 1528
 
1529
-add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 );
1529
+add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1);
1530 1530
 
1531 1531
 /**
1532 1532
  * Checkout Final Total.
@@ -1539,29 +1539,29 @@  discard block
 block discarded – undo
1539 1539
  *
1540 1540
  * @return void
1541 1541
  */
1542
-function give_checkout_final_total( $form_id ) {
1542
+function give_checkout_final_total($form_id) {
1543 1543
 
1544
-	if ( isset( $_POST['give_total'] ) ) {
1545
-		$total = apply_filters( 'give_donation_total', $_POST['give_total'] );
1544
+	if (isset($_POST['give_total'])) {
1545
+		$total = apply_filters('give_donation_total', $_POST['give_total']);
1546 1546
 	} else {
1547 1547
 		//default total.
1548
-		$total = give_get_default_form_amount( $form_id );
1548
+		$total = give_get_default_form_amount($form_id);
1549 1549
 	}
1550 1550
 	//Only proceed if give_total available.
1551
-	if ( empty( $total ) ) {
1551
+	if (empty($total)) {
1552 1552
 		return;
1553 1553
 	}
1554 1554
 	?>
1555 1555
 	<p id="give-final-total-wrap" class="form-wrap ">
1556 1556
 		<span
1557
-			class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span>
1557
+			class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span>
1558 1558
 		<span class="give-final-total-amount"
1559
-		      data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span>
1559
+		      data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span>
1560 1560
 	</p>
1561 1561
 	<?php
1562 1562
 }
1563 1563
 
1564
-add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 );
1564
+add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999);
1565 1565
 
1566 1566
 /**
1567 1567
  * Renders the Checkout Submit section.
@@ -1572,7 +1572,7 @@  discard block
 block discarded – undo
1572 1572
  *
1573 1573
  * @return void
1574 1574
  */
1575
-function give_checkout_submit( $form_id ) {
1575
+function give_checkout_submit($form_id) {
1576 1576
 	?>
1577 1577
 	<fieldset id="give_purchase_submit">
1578 1578
 		<?php
@@ -1581,24 +1581,24 @@  discard block
 block discarded – undo
1581 1581
 		 *
1582 1582
 		 * @since 1.7
1583 1583
 		 */
1584
-		do_action( 'give_donation_form_before_submit', $form_id );
1584
+		do_action('give_donation_form_before_submit', $form_id);
1585 1585
 
1586
-		give_checkout_hidden_fields( $form_id );
1586
+		give_checkout_hidden_fields($form_id);
1587 1587
 
1588
-		echo give_checkout_button_purchase( $form_id );
1588
+		echo give_checkout_button_purchase($form_id);
1589 1589
 
1590 1590
 		/**
1591 1591
 		 * Fire after donation form submit.
1592 1592
 		 *
1593 1593
 		 * @since 1.7
1594 1594
 		 */
1595
-		do_action( 'give_donation_form_after_submit', $form_id );
1595
+		do_action('give_donation_form_after_submit', $form_id);
1596 1596
 		?>
1597 1597
 	</fieldset>
1598 1598
 	<?php
1599 1599
 }
1600 1600
 
1601
-add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 );
1601
+add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999);
1602 1602
 
1603 1603
 /**
1604 1604
  * Give Checkout Button.
@@ -1611,10 +1611,10 @@  discard block
 block discarded – undo
1611 1611
  *
1612 1612
  * @return string
1613 1613
  */
1614
-function give_checkout_button_purchase( $form_id ) {
1614
+function give_checkout_button_purchase($form_id) {
1615 1615
 
1616
-	$display_label_field = get_post_meta( $form_id, '_give_checkout_label', true );
1617
-	$display_label       = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) );
1616
+	$display_label_field = get_post_meta($form_id, '_give_checkout_label', true);
1617
+	$display_label       = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give'));
1618 1618
 	ob_start(); ?>
1619 1619
 	<div class="give-submit-button-wrap give-clearfix">
1620 1620
 		<input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase"
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 		<span class="give-loading-animation"></span>
1623 1623
 	</div>
1624 1624
 	<?php
1625
-	return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id );
1625
+	return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id);
1626 1626
 }
1627 1627
 
1628 1628
 /**
@@ -1636,18 +1636,18 @@  discard block
 block discarded – undo
1636 1636
  *
1637 1637
  * @return void
1638 1638
  */
1639
-function give_agree_to_terms_js( $form_id ) {
1639
+function give_agree_to_terms_js($form_id) {
1640 1640
 
1641
-	$form_option = get_post_meta( $form_id, '_give_terms_option', true );
1641
+	$form_option = get_post_meta($form_id, '_give_terms_option', true);
1642 1642
 
1643
-	if ( $form_option === 'yes' ) {
1643
+	if ($form_option === 'yes') {
1644 1644
 		?>
1645 1645
 		<script type="text/javascript">
1646 1646
 			jQuery(document).ready(function ($) {
1647
-				$('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) {
1647
+				$('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) {
1648 1648
 					e.preventDefault();
1649
-					$('.give_terms-<?php echo $form_id;?>').slideToggle();
1650
-					$('.give_terms_links-<?php echo $form_id;?>').toggle();
1649
+					$('.give_terms-<?php echo $form_id; ?>').slideToggle();
1650
+					$('.give_terms_links-<?php echo $form_id; ?>').toggle();
1651 1651
 					return false;
1652 1652
 				});
1653 1653
 			});
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 	}
1657 1657
 }
1658 1658
 
1659
-add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 );
1659
+add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2);
1660 1660
 
1661 1661
 /**
1662 1662
  * Show Give Goals.
@@ -1670,17 +1670,17 @@  discard block
 block discarded – undo
1670 1670
  *
1671 1671
  * @return mixed
1672 1672
  */
1673
-function give_show_goal_progress( $form_id, $args ) {
1673
+function give_show_goal_progress($form_id, $args) {
1674 1674
 
1675 1675
 	ob_start();
1676
-	give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) );
1676
+	give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args));
1677 1677
 
1678
-	echo apply_filters( 'give_goal_output', ob_get_clean() );
1678
+	echo apply_filters('give_goal_output', ob_get_clean());
1679 1679
 
1680 1680
 	return true;
1681 1681
 }
1682 1682
 
1683
-add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 );
1683
+add_action('give_pre_form', 'give_show_goal_progress', 10, 2);
1684 1684
 
1685 1685
 /**
1686 1686
  * Adds Actions to Render Form Content.
@@ -1692,19 +1692,19 @@  discard block
 block discarded – undo
1692 1692
  *
1693 1693
  * @return void
1694 1694
  */
1695
-function give_form_content( $form_id, $args ) {
1695
+function give_form_content($form_id, $args) {
1696 1696
 
1697
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1697
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1698 1698
 		? $args['show_content']
1699
-		: get_post_meta( $form_id, '_give_content_option', true );
1699
+		: get_post_meta($form_id, '_give_content_option', true);
1700 1700
 
1701
-	if ( $show_content !== 'none' ) {
1701
+	if ($show_content !== 'none') {
1702 1702
 		//add action according to value.
1703
-		add_action( $show_content, 'give_form_display_content', 10, 2 );
1703
+		add_action($show_content, 'give_form_display_content', 10, 2);
1704 1704
 	}
1705 1705
 }
1706 1706
 
1707
-add_action( 'give_pre_form_output', 'give_form_content', 10, 2 );
1707
+add_action('give_pre_form_output', 'give_form_content', 10, 2);
1708 1708
 
1709 1709
 /**
1710 1710
  * Renders Post Form Content.
@@ -1718,24 +1718,24 @@  discard block
 block discarded – undo
1718 1718
  *
1719 1719
  * @return void
1720 1720
  */
1721
-function give_form_display_content( $form_id, $args ) {
1721
+function give_form_display_content($form_id, $args) {
1722 1722
 
1723
-	$content      = wpautop( get_post_meta( $form_id, '_give_form_content', true ) );
1724
-	$show_content = ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) )
1723
+	$content      = wpautop(get_post_meta($form_id, '_give_form_content', true));
1724
+	$show_content = (isset($args['show_content']) && ! empty($args['show_content']))
1725 1725
 		? $args['show_content']
1726
-		: get_post_meta( $form_id, '_give_content_option', true );
1726
+		: get_post_meta($form_id, '_give_content_option', true);
1727 1727
 
1728
-	if ( give_get_option( 'disable_the_content_filter' ) !== 'on' ) {
1729
-		$content = apply_filters( 'the_content', $content );
1728
+	if (give_get_option('disable_the_content_filter') !== 'on') {
1729
+		$content = apply_filters('the_content', $content);
1730 1730
 	}
1731 1731
 
1732
-	$output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap" >' . $content . '</div>';
1732
+	$output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap" >'.$content.'</div>';
1733 1733
 
1734
-	echo apply_filters( 'give_form_content_output', $output );
1734
+	echo apply_filters('give_form_content_output', $output);
1735 1735
 
1736 1736
 	//remove action to prevent content output on addition forms on page.
1737 1737
 	//@see: https://github.com/WordImpress/Give/issues/634.
1738
-	remove_action( $show_content, 'give_form_display_content' );
1738
+	remove_action($show_content, 'give_form_display_content');
1739 1739
 }
1740 1740
 
1741 1741
 /**
@@ -1747,7 +1747,7 @@  discard block
 block discarded – undo
1747 1747
  *
1748 1748
  * @return void
1749 1749
  */
1750
-function give_checkout_hidden_fields( $form_id ) {
1750
+function give_checkout_hidden_fields($form_id) {
1751 1751
 
1752 1752
 	/**
1753 1753
 	 * Fires while rendering hidden checkout fields, before the fields.
@@ -1756,13 +1756,13 @@  discard block
 block discarded – undo
1756 1756
 	 *
1757 1757
 	 * @param int $form_id The form ID.
1758 1758
 	 */
1759
-	do_action( 'give_hidden_fields_before', $form_id );
1759
+	do_action('give_hidden_fields_before', $form_id);
1760 1760
 
1761
-	if ( is_user_logged_in() ) { ?>
1761
+	if (is_user_logged_in()) { ?>
1762 1762
 		<input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/>
1763 1763
 	<?php } ?>
1764 1764
 	<input type="hidden" name="give_action" value="purchase"/>
1765
-	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/>
1765
+	<input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/>
1766 1766
 	<?php
1767 1767
 	/**
1768 1768
 	 * Fires while rendering hidden checkout fields, after the fields.
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
 	 *
1772 1772
 	 * @param int $form_id The form ID.
1773 1773
 	 */
1774
-	do_action( 'give_hidden_fields_after', $form_id );
1774
+	do_action('give_hidden_fields_after', $form_id);
1775 1775
 
1776 1776
 }
1777 1777
 
@@ -1786,20 +1786,20 @@  discard block
 block discarded – undo
1786 1786
  *
1787 1787
  * @return string $content Filtered content.
1788 1788
  */
1789
-function give_filter_success_page_content( $content ) {
1789
+function give_filter_success_page_content($content) {
1790 1790
 
1791 1791
 	$give_options = give_get_settings();
1792 1792
 
1793
-	if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) {
1794
-		if ( has_filter( 'give_donation_confirm_' . $_GET['payment-confirmation'] ) ) {
1795
-			$content = apply_filters( 'give_donation_confirm_' . $_GET['payment-confirmation'], $content );
1793
+	if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) {
1794
+		if (has_filter('give_donation_confirm_'.$_GET['payment-confirmation'])) {
1795
+			$content = apply_filters('give_donation_confirm_'.$_GET['payment-confirmation'], $content);
1796 1796
 		}
1797 1797
 	}
1798 1798
 
1799 1799
 	return $content;
1800 1800
 }
1801 1801
 
1802
-add_filter( 'the_content', 'give_filter_success_page_content' );
1802
+add_filter('the_content', 'give_filter_success_page_content');
1803 1803
 
1804 1804
 /**
1805 1805
  * Test Mode Frontend Warning.
@@ -1810,12 +1810,12 @@  discard block
 block discarded – undo
1810 1810
  */
1811 1811
 function give_test_mode_frontend_warning() {
1812 1812
 
1813
-	if ( give_is_test_mode() ) {
1814
-		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>';
1813
+	if (give_is_test_mode()) {
1814
+		echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>';
1815 1815
 	}
1816 1816
 }
1817 1817
 
1818
-add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 );
1818
+add_action('give_pre_form', 'give_test_mode_frontend_warning', 10);
1819 1819
 
1820 1820
 /**
1821 1821
  * Members-only Form.
@@ -1829,21 +1829,21 @@  discard block
 block discarded – undo
1829 1829
  *
1830 1830
  * @return string
1831 1831
  */
1832
-function give_members_only_form( $final_output, $args ) {
1832
+function give_members_only_form($final_output, $args) {
1833 1833
 
1834
-	$form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0;
1834
+	$form_id = isset($args['form_id']) ? $args['form_id'] : 0;
1835 1835
 
1836 1836
 	//Sanity Check: Must have form_id & not be logged in.
1837
-	if ( empty( $form_id ) || is_user_logged_in() ) {
1837
+	if (empty($form_id) || is_user_logged_in()) {
1838 1838
 		return $final_output;
1839 1839
 	}
1840 1840
 
1841 1841
 	//Logged in only and Register / Login set to none.
1842
-	if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) {
1842
+	if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') {
1843 1843
 
1844
-		$final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false );
1844
+		$final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false);
1845 1845
 
1846
-		return apply_filters( 'give_members_only_output', $final_output, $form_id );
1846
+		return apply_filters('give_members_only_output', $final_output, $form_id);
1847 1847
 
1848 1848
 	}
1849 1849
 
@@ -1851,4 +1851,4 @@  discard block
 block discarded – undo
1851 1851
 
1852 1852
 }
1853 1853
 
1854
-add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 );
1854
+add_filter('give_donate_form', 'give_members_only_form', 10, 2);
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 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
 
Please login to merge, or discard this patch.
includes/class-give-gravatars.php 1 patch
Spacing   +95 added lines, -95 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[] = get_post_meta( $id, '_give_log_payment_id', true );
170
+				$payment_ids[] = get_post_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 = get_post_meta( $id, '_give_payment_user_email', true );
178
+				$email = get_post_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 ] = get_post_meta( $id, '_give_payment_user_email', true );
186
+				$unique_emails[$id] = get_post_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,51 +246,51 @@  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 = get_post_meta( $id, '_give_payment_meta', true );
270
+				$payment_meta = get_post_meta($id, '_give_payment_meta', true);
271 271
 
272 272
 				// unserialize the payment meta
273
-				$user_info = maybe_unserialize( $payment_meta['user_info'] );
273
+				$user_info = maybe_unserialize($payment_meta['user_info']);
274 274
 
275 275
 				// get donor's first name
276 276
 				$name = $user_info['first_name'];
277 277
 
278 278
 				// get donor's email
279
-				$email = get_post_meta( $id, '_give_payment_user_email', true );
279
+				$email = get_post_meta($id, '_give_payment_user_email', true);
280 280
 
281 281
 				// set gravatar size and provide filter
282
-				$size = isset( $give_options['give_donors_gravatars_gravatar_size'] ) ? apply_filters( 'give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size'] ) : '';
282
+				$size = isset($give_options['give_donors_gravatars_gravatar_size']) ? apply_filters('give_donors_gravatars_gravatar_size', $give_options['give_donors_gravatars_gravatar_size']) : '';
283 283
 
284 284
 				// default image
285
-				$default_image = apply_filters( 'give_donors_gravatars_gravatar_default_image', false );
285
+				$default_image = apply_filters('give_donors_gravatars_gravatar_default_image', false);
286 286
 
287 287
 				// assemble output
288 288
 				$output .= '<li>';
289 289
 
290
-				$output .= get_avatar( $email, $size, $default_image, $name );
290
+				$output .= get_avatar($email, $size, $default_image, $name);
291 291
 				$output .= '</li>';
292 292
 
293
-				$i ++;
293
+				$i++;
294 294
 
295 295
 			} // end foreach
296 296
 		}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 		echo '</ul>';
300 300
 		echo '</div>';
301 301
 
302
-		return apply_filters( 'give_donors_gravatars', ob_get_clean() );
302
+		return apply_filters('give_donors_gravatars', ob_get_clean());
303 303
 	}
304 304
 
305 305
 	/**
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	 * @return void
312 312
 	 */
313 313
 	public function register_widget() {
314
-		register_widget( 'Give_Donors_Gravatars_Widget' );
314
+		register_widget('Give_Donors_Gravatars_Widget');
315 315
 	}
316 316
 
317 317
 	/**
@@ -327,19 +327,19 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @todo   Set the ID to get_the_ID() if ID parameter is not passed through. Otherwise it will incorrectly get other gravatars
329 329
 	 */
330
-	public function shortcode( $atts, $content = null ) {
330
+	public function shortcode($atts, $content = null) {
331 331
 
332
-		$atts = shortcode_atts( array(
332
+		$atts = shortcode_atts(array(
333 333
 			'id'    => '',
334 334
 			'title' => ''
335
-		), $atts, 'give_donors_gravatars' );
335
+		), $atts, 'give_donors_gravatars');
336 336
 
337 337
 		// if no ID is passed on single give_forms pages, get the correct ID
338
-		if ( is_singular( 'give_forms' ) ) {
338
+		if (is_singular('give_forms')) {
339 339
 			$id = get_the_ID();
340 340
 		}
341 341
 
342
-		$content = $this->gravatars( $atts['id'], $atts['title'] );
342
+		$content = $this->gravatars($atts['id'], $atts['title']);
343 343
 
344 344
 		return $content;
345 345
 
@@ -355,56 +355,56 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
 	 * @return array           Gravatar settings.
357 357
 	 */
358
-	public function settings( $settings ) {
358
+	public function settings($settings) {
359 359
 
360 360
 		$give_gravatar_settings = array(
361 361
 			array(
362
-				'name' => esc_html__( 'Donator Gravatars', 'give' ),
362
+				'name' => esc_html__('Donator Gravatars', 'give'),
363 363
 				'desc' => '<hr>',
364 364
 				'id'   => 'give_title',
365 365
 				'type' => 'give_title'
366 366
 			),
367 367
 			array(
368
-				'name' => esc_html__( 'Heading', 'give' ),
369
-				'desc' => esc_html__( 'The heading to display above the Gravatars.', 'give' ),
368
+				'name' => esc_html__('Heading', 'give'),
369
+				'desc' => esc_html__('The heading to display above the Gravatars.', 'give'),
370 370
 				'type' => 'text',
371 371
 				'id'   => 'give_donors_gravatars_heading'
372 372
 			),
373 373
 			array(
374
-				'name'    => esc_html__( 'Gravatar Size', 'give' ),
375
-				'desc'    => esc_html__( 'The size of each Gravatar in pixels (512px maximum).', 'give' ),
374
+				'name'    => esc_html__('Gravatar Size', 'give'),
375
+				'desc'    => esc_html__('The size of each Gravatar in pixels (512px maximum).', 'give'),
376 376
 				'type'    => 'text_small',
377 377
 				'id'      => 'give_donors_gravatars_gravatar_size',
378 378
 				'default' => '64'
379 379
 			),
380 380
 			array(
381
-				'name' => esc_html__( 'Minimum Unique Donations Required', 'give' ),
382
-				'desc' => esc_html__( 'The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give' ),
381
+				'name' => esc_html__('Minimum Unique Donations Required', 'give'),
382
+				'desc' => esc_html__('The minimum number of unique donations a form must have before the Gravatars are shown. Leave blank for no minimum.', 'give'),
383 383
 				'type' => 'text_small',
384 384
 				'id'   => 'give_donors_gravatars_min_purchases_required',
385 385
 			),
386 386
 			array(
387
-				'name'    => esc_html__( 'Maximum Gravatars To Show', 'give' ),
388
-				'desc'    => esc_html__( 'The maximum number of gravatars to show. Leave blank for no limit.', 'give' ),
387
+				'name'    => esc_html__('Maximum Gravatars To Show', 'give'),
388
+				'desc'    => esc_html__('The maximum number of gravatars to show. Leave blank for no limit.', 'give'),
389 389
 				'type'    => 'text',
390 390
 				'id'      => 'give_donors_gravatars_maximum_number',
391 391
 				'default' => '20',
392 392
 			),
393 393
 			array(
394
-				'name' => esc_html__( 'Gravatar Visibility', 'give' ),
395
-				'desc' => esc_html__( 'Show only donors with a Gravatar account.', 'give' ),
394
+				'name' => esc_html__('Gravatar Visibility', 'give'),
395
+				'desc' => esc_html__('Show only donors with a Gravatar account.', 'give'),
396 396
 				'id'   => 'give_donors_gravatars_has_gravatar_account',
397 397
 				'type' => 'checkbox',
398 398
 			),
399 399
 			array(
400
-				'name' => esc_html__( 'Randomize Gravatars', 'give' ),
401
-				'desc' => esc_html__( 'Randomize the Gravatars.', 'give' ),
400
+				'name' => esc_html__('Randomize Gravatars', 'give'),
401
+				'desc' => esc_html__('Randomize the Gravatars.', 'give'),
402 402
 				'id'   => 'give_donors_gravatars_random_gravatars',
403 403
 				'type' => 'checkbox',
404 404
 			),
405 405
 		);
406 406
 
407
-		return array_merge( $settings, $give_gravatar_settings );
407
+		return array_merge($settings, $give_gravatar_settings);
408 408
 	}
409 409
 
410 410
 }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		// widget settings
431 431
 		$widget_ops = array(
432 432
 			'classname'   => 'give-donors-gravatars',
433
-			'description' => esc_html__( 'Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give' ),
433
+			'description' => esc_html__('Displays gravatars of people who have donated using your your form. Will only show on the single form page.', 'give'),
434 434
 		);
435 435
 
436 436
 		// widget control settings
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 		// create the widget
444 444
 		parent::__construct(
445 445
 			'give_donors_gravatars_widget',
446
-			esc_html__( 'Give Donors Gravatars', 'give' ),
446
+			esc_html__('Give Donors Gravatars', 'give'),
447 447
 			$widget_ops,
448 448
 			$control_ops
449 449
 		);
@@ -463,29 +463,29 @@  discard block
 block discarded – undo
463 463
 	 *
464 464
 	 * @return void
465 465
 	 */
466
-	public function widget( $args, $instance ) {
466
+	public function widget($args, $instance) {
467 467
 
468 468
 		//@TODO: Don't extract it!!!
469
-		extract( $args );
469
+		extract($args);
470 470
 
471
-		if ( ! is_singular( 'give_forms' ) ) {
471
+		if ( ! is_singular('give_forms')) {
472 472
 			return;
473 473
 		}
474 474
 
475 475
 		// Variables from widget settings
476
-		$title = apply_filters( 'widget_title', $instance['title'] );
476
+		$title = apply_filters('widget_title', $instance['title']);
477 477
 
478 478
 		// Used by themes. Opens the widget
479 479
 		echo $before_widget;
480 480
 
481 481
 		// Display the widget title
482
-		if ( $title ) {
483
-			echo $before_title . $title . $after_title;
482
+		if ($title) {
483
+			echo $before_title.$title.$after_title;
484 484
 		}
485 485
 
486 486
 		$gravatars = new Give_Donors_Gravatars();
487 487
 
488
-		echo $gravatars->gravatars( get_the_ID(), null ); // remove title
488
+		echo $gravatars->gravatars(get_the_ID(), null); // remove title
489 489
 
490 490
 		// Used by themes. Closes the widget
491 491
 		echo $after_widget;
@@ -505,11 +505,11 @@  discard block
 block discarded – undo
505 505
 	 *
506 506
 	 * @return array Updated settings to save.
507 507
 	 */
508
-	public function update( $new_instance, $old_instance ) {
508
+	public function update($new_instance, $old_instance) {
509 509
 
510 510
 		$instance = $old_instance;
511 511
 
512
-		$instance['title'] = strip_tags( $new_instance['title'] );
512
+		$instance['title'] = strip_tags($new_instance['title']);
513 513
 
514 514
 		return $instance;
515 515
 
@@ -527,19 +527,19 @@  discard block
 block discarded – undo
527 527
 	 *
528 528
 	 * @return void
529 529
 	 */
530
-	public function form( $instance ) {
530
+	public function form($instance) {
531 531
 
532 532
 		// Set up some default widget settings.
533 533
 		$defaults = array(
534 534
 			'title' => '',
535 535
 		);
536 536
 
537
-		$instance = wp_parse_args( (array) $instance, $defaults ); ?>
537
+		$instance = wp_parse_args((array) $instance, $defaults); ?>
538 538
 
539 539
 		<!-- Title -->
540 540
 		<p>
541
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ) ?></label>
542
-			<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']; ?>" />
541
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give') ?></label>
542
+			<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']; ?>" />
543 543
 		</p>
544 544
 
545 545
 		<?php
Please login to merge, or discard this patch.