Completed
Pull Request — master (#893)
by Rami
20:06
created
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +48 added lines, -48 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
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string Column Name
65 65
 	 */
66
-	public function column_default( $item, $column_name ) {
67
-		switch ( $column_name ) {
66
+	public function column_default($item, $column_name) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'error' :
71
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : esc_html__( 'Payment Error', 'give' );
71
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : esc_html__('Payment Error', 'give');
72 72
 			default:
73
-				return $item[ $column_name ];
73
+				return $item[$column_name];
74 74
 		}
75 75
 	}
76 76
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return void
86 86
 	 */
87
-	public function column_message( $item ) {
87
+	public function column_message($item) {
88 88
 
89 89
 		?>
90
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Log Message', 'give' ); ?></a>
90
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Log Message', 'give'); ?></a>
91 91
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
92 92
 			<?php
93 93
 
94
-			$log_message = get_post_field( 'post_content', $item['ID'] );
94
+			$log_message = get_post_field('post_content', $item['ID']);
95 95
 
96
-			$serialized  = strpos( $log_message, '{"' );
96
+			$serialized  = strpos($log_message, '{"');
97 97
 
98 98
 			// Check to see if the log message contains serialized information
99
-			if ( $serialized !== false ) {
100
-				$length = strlen( $log_message ) - $serialized;
101
-				$intro  = substr( $log_message, 0, - $length );
102
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
99
+			if ($serialized !== false) {
100
+				$length = strlen($log_message) - $serialized;
101
+				$intro  = substr($log_message, 0, - $length);
102
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
103 103
 
104
-				echo wpautop( $intro );
105
-				echo wpautop( '<strong>' . esc_html__( 'Log data:', 'give' ) . '</strong>' );
106
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
104
+				echo wpautop($intro);
105
+				echo wpautop('<strong>'.esc_html__('Log data:', 'give').'</strong>');
106
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
107 107
 			} else {
108 108
 				// No serialized data found
109
-				echo wpautop( $log_message );
109
+				echo wpautop($log_message);
110 110
 			}
111 111
 			?>
112 112
 		</div>
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function get_columns() {
124 124
 		$columns = array(
125
-			'ID'         => esc_html__( 'Log ID', 'give' ),
126
-			'payment_id' => esc_html__( 'Payment ID', 'give' ),
127
-			'error'      => esc_html__( 'Error', 'give' ),
128
-			'message'    => esc_html__( 'Error Message', 'give' ),
129
-			'gateway'    => esc_html__( 'Gateway', 'give' ),
130
-			'date'       => esc_html__( 'Date', 'give' )
125
+			'ID'         => esc_html__('Log ID', 'give'),
126
+			'payment_id' => esc_html__('Payment ID', 'give'),
127
+			'error'      => esc_html__('Error', 'give'),
128
+			'message'    => esc_html__('Error Message', 'give'),
129
+			'gateway'    => esc_html__('Gateway', 'give'),
130
+			'date'       => esc_html__('Date', 'give')
131 131
 		);
132 132
 
133 133
 		return $columns;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return int Current page number
142 142
 	 */
143 143
 	public function get_paged() {
144
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
144
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since  1.0
152 152
 	 * @return void
153 153
 	 */
154
-	public function bulk_actions( $which = '' ) {
154
+	public function bulk_actions($which = '') {
155 155
 		give_log_views();
156 156
 	}
157 157
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		global $give_logs;
168 168
 
169 169
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
170
-		wp_suspend_cache_addition( true );
170
+		wp_suspend_cache_addition(true);
171 171
 
172 172
 		$logs_data = array();
173 173
 		$paged     = $this->get_paged();
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 			'paged'    => $paged
177 177
 		);
178 178
 
179
-		$logs = $give_logs->get_connected_logs( $log_query );
179
+		$logs = $give_logs->get_connected_logs($log_query);
180 180
 
181
-		if ( $logs ) {
182
-			foreach ( $logs as $log ) {
181
+		if ($logs) {
182
+			foreach ($logs as $log) {
183 183
 
184 184
 				$logs_data[] = array(
185 185
 					'ID'         => $log->ID,
186
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
186
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
187 187
 					'payment_id' => $log->post_parent,
188 188
 					'error'      => 'error',
189
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
189
+					'gateway'    => give_get_payment_gateway($log->post_parent),
190 190
 					'date'       => $log->post_date
191 191
 				);
192 192
 			}
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $which
209 209
 	 */
210
-	protected function display_tablenav( $which ) {
211
-		if ( 'top' === $which ) {
212
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
210
+	protected function display_tablenav($which) {
211
+		if ('top' === $which) {
212
+			wp_nonce_field('bulk-'.$this->_args['plural']);
213 213
 		}
214 214
 		?>
215
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
215
+		<div class="tablenav <?php echo esc_attr($which); ?>">
216 216
 
217 217
 			<div class="alignleft actions bulkactions">
218
-				<?php $this->bulk_actions( $which ); ?>
218
+				<?php $this->bulk_actions($which); ?>
219 219
 			</div>
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 		$columns               = $this->get_columns();
247 247
 		$hidden                = array(); // No hidden columns
248 248
 		$sortable              = $this->get_sortable_columns();
249
-		$this->_column_headers = array( $columns, $hidden, $sortable );
249
+		$this->_column_headers = array($columns, $hidden, $sortable);
250 250
 		$current_page          = $this->get_pagenum();
251 251
 		$this->items           = $this->get_logs();
252
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
252
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
253 253
 
254
-		$this->set_pagination_args( array(
254
+		$this->set_pagination_args(array(
255 255
 				'total_items' => $total_items,
256 256
 				'per_page'    => $this->per_page,
257
-				'total_pages' => ceil( $total_items / $this->per_page )
257
+				'total_pages' => ceil($total_items / $this->per_page)
258 258
 			)
259 259
 		);
260 260
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/graphing.php 1 patch
Spacing   +243 added lines, -243 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
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	$dates = give_get_report_dates();
26 26
 
27 27
 	// Determine graph options
28
-	switch ( $dates['range'] ) :
28
+	switch ($dates['range']) :
29 29
 		case 'today' :
30 30
 		case 'yesterday' :
31 31
 			$day_by_day = true;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			$day_by_day = false;
38 38
 			break;
39 39
 		case 'other' :
40
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) {
40
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) {
41 41
 				$day_by_day = false;
42 42
 			} else {
43 43
 				$day_by_day = true;
@@ -49,61 +49,61 @@  discard block
 block discarded – undo
49 49
 	endswitch;
50 50
 
51 51
 	$earnings_totals = 0.00; // Total earnings for time period shown
52
-	$sales_totals    = 0;            // Total sales for time period shown
52
+	$sales_totals    = 0; // Total sales for time period shown
53 53
 
54 54
 	$earnings_data = array();
55 55
 	$sales_data    = array();
56 56
 
57
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
57
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
58 58
 		// Hour by hour
59 59
 		$hour  = 1;
60
-		$month = date( 'n', current_time( 'timestamp' ) );
61
-		while ( $hour <= 23 ) :
60
+		$month = date('n', current_time('timestamp'));
61
+		while ($hour <= 23) :
62 62
 
63
-			$sales    = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour );
64
-			$earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour );
63
+			$sales    = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour);
64
+			$earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour);
65 65
 
66 66
 			$sales_totals += $sales;
67 67
 			$earnings_totals += $earnings;
68 68
 
69
-			$date            = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000;
70
-			$sales_data[]    = array( $date, $sales );
71
-			$earnings_data[] = array( $date, $earnings );
69
+			$date            = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000;
70
+			$sales_data[]    = array($date, $sales);
71
+			$earnings_data[] = array($date, $earnings);
72 72
 
73
-			$hour ++;
73
+			$hour++;
74 74
 		endwhile;
75 75
 
76
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
76
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
77 77
 
78 78
 		// Day by day
79 79
 		$day     = $dates['day'];
80 80
 		$day_end = $dates['day_end'];
81 81
 		$month   = $dates['m_start'];
82
-		while ( $day <= $day_end ) :
83
-			$sales = give_get_sales_by_date( $day, $month, $dates['year'] );
82
+		while ($day <= $day_end) :
83
+			$sales = give_get_sales_by_date($day, $month, $dates['year']);
84 84
 			$sales_totals += $sales;
85 85
 
86
-			$earnings = give_get_earnings_by_date( $day, $month, $dates['year'] );
86
+			$earnings = give_get_earnings_by_date($day, $month, $dates['year']);
87 87
 			$earnings_totals += $earnings;
88 88
 
89
-			$date            = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000;
90
-			$sales_data[]    = array( $date, $sales );
91
-			$earnings_data[] = array( $date, $earnings );
92
-			$day ++;
89
+			$date            = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000;
90
+			$sales_data[]    = array($date, $sales);
91
+			$earnings_data[] = array($date, $earnings);
92
+			$day++;
93 93
 		endwhile;
94 94
 
95 95
 	} else {
96 96
 
97 97
 		$y = $dates['year'];
98
-		while ( $y <= $dates['year_end'] ) :
98
+		while ($y <= $dates['year_end']) :
99 99
 
100
-			if ( $dates['year'] == $dates['year_end'] ) {
100
+			if ($dates['year'] == $dates['year_end']) {
101 101
 				$month_start = $dates['m_start'];
102 102
 				$month_end   = $dates['m_end'];
103
-			} elseif ( $y == $dates['year'] ) {
103
+			} elseif ($y == $dates['year']) {
104 104
 				$month_start = $dates['m_start'];
105 105
 				$month_end   = 12;
106
-			} elseif ( $y == $dates['year_end'] ) {
106
+			} elseif ($y == $dates['year_end']) {
107 107
 				$month_start = 1;
108 108
 				$month_end   = $dates['m_end'];
109 109
 			} else {
@@ -112,48 +112,48 @@  discard block
 block discarded – undo
112 112
 			}
113 113
 
114 114
 			$i = $month_start;
115
-			while ( $i <= $month_end ) :
115
+			while ($i <= $month_end) :
116 116
 
117
-				if ( $day_by_day ) :
117
+				if ($day_by_day) :
118 118
 
119
-					if ( $i == $month_end ) {
119
+					if ($i == $month_end) {
120 120
 
121 121
 						$num_of_days = $dates['day_end'];
122 122
 
123 123
 					} else {
124 124
 
125
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
125
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
126 126
 
127 127
 					}
128 128
 
129 129
 					$d = $dates['day'];
130 130
 
131
-					while ( $d <= $num_of_days ) :
131
+					while ($d <= $num_of_days) :
132 132
 
133
-						$sales = give_get_sales_by_date( $d, $i, $y );
133
+						$sales = give_get_sales_by_date($d, $i, $y);
134 134
 						$sales_totals += $sales;
135 135
 
136
-						$earnings = give_get_earnings_by_date( $d, $i, $y );
136
+						$earnings = give_get_earnings_by_date($d, $i, $y);
137 137
 						$earnings_totals += $earnings;
138 138
 
139
-						$date            = mktime( 0, 0, 0, $i, $d, $y ) * 1000;
140
-						$sales_data[]    = array( $date, $sales );
141
-						$earnings_data[] = array( $date, $earnings );
142
-						$d ++;
139
+						$date            = mktime(0, 0, 0, $i, $d, $y) * 1000;
140
+						$sales_data[]    = array($date, $sales);
141
+						$earnings_data[] = array($date, $earnings);
142
+						$d++;
143 143
 
144 144
 					endwhile;
145 145
 
146 146
 				else :
147 147
 
148
-					$sales = give_get_sales_by_date( null, $i, $y );
148
+					$sales = give_get_sales_by_date(null, $i, $y);
149 149
 					$sales_totals += $sales;
150 150
 
151
-					$earnings = give_get_earnings_by_date( null, $i, $y );
151
+					$earnings = give_get_earnings_by_date(null, $i, $y);
152 152
 					$earnings_totals += $earnings;
153 153
 
154
-					if ( $i == $month_end ) {
154
+					if ($i == $month_end) {
155 155
 
156
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
156
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
157 157
 
158 158
 					} else {
159 159
 
@@ -161,24 +161,24 @@  discard block
 block discarded – undo
161 161
 
162 162
 					}
163 163
 
164
-					$date            = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000;
165
-					$sales_data[]    = array( $date, $sales );
166
-					$earnings_data[] = array( $date, $earnings );
164
+					$date            = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000;
165
+					$sales_data[]    = array($date, $sales);
166
+					$earnings_data[] = array($date, $earnings);
167 167
 
168 168
 				endif;
169 169
 
170
-				$i ++;
170
+				$i++;
171 171
 
172 172
 			endwhile;
173 173
 
174
-			$y ++;
174
+			$y++;
175 175
 		endwhile;
176 176
 
177 177
 	}
178 178
 
179 179
 	$data = array(
180
-		esc_html__( 'Income', 'give' )    => $earnings_data,
181
-		esc_html__( 'Donations', 'give' ) => $sales_data
180
+		esc_html__('Income', 'give')    => $earnings_data,
181
+		esc_html__('Donations', 'give') => $sales_data
182 182
 	);
183 183
 
184 184
 	// start our own output buffer
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 			<div class="postbox">
191 191
 				<div class="inside">
192 192
 					<?php
193
-					$graph = new Give_Graph( $data );
194
-					$graph->set( 'x_mode', 'time' );
195
-					$graph->set( 'multiple_y_axes', true );
193
+					$graph = new Give_Graph($data);
194
+					$graph->set('x_mode', 'time');
195
+					$graph->set('multiple_y_axes', true);
196 196
 					$graph->display();
197 197
 
198
-					if ( 'this_month' == $dates['range'] ) {
198
+					if ('this_month' == $dates['range']) {
199 199
 						$estimated = give_estimated_monthly_stats();
200 200
 					}
201 201
 					?>
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 				<tbody>
207 207
 				<tr>
208 208
 					<td class="row-title">
209
-						<label for="tablecell"><?php esc_html_e( 'Total income for period:', 'give' ); ?></label></td>
210
-					<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
209
+						<label for="tablecell"><?php esc_html_e('Total income for period:', 'give'); ?></label></td>
210
+					<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
211 211
 				</tr>
212 212
 				<tr class="alternate">
213 213
 					<td class="row-title">
214
-						<label for="tablecell"><?php esc_html_e( 'Total donations for period:', 'give' ); ?></label>
214
+						<label for="tablecell"><?php esc_html_e('Total donations for period:', 'give'); ?></label>
215 215
 					</td>
216 216
 					<td><?php echo $sales_totals; ?></td>
217 217
 				</tr>
218
-				<?php if ( 'this_month' == $dates['range'] ) : ?>
218
+				<?php if ('this_month' == $dates['range']) : ?>
219 219
 					<tr>
220 220
 						<td class="row-title">
221
-							<label for="tablecell"><?php esc_html_e( 'Estimated monthly income:', 'give' ); ?></label>
221
+							<label for="tablecell"><?php esc_html_e('Estimated monthly income:', 'give'); ?></label>
222 222
 						</td>
223
-						<td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td>
223
+						<td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td>
224 224
 					</tr>
225 225
 					<tr class="alternate">
226 226
 						<td class="row-title">
227
-							<label for="tablecell"><?php esc_html_e( 'Estimated monthly donations:', 'give' ); ?></label>
227
+							<label for="tablecell"><?php esc_html_e('Estimated monthly donations:', 'give'); ?></label>
228 228
 						</td>
229
-						<td><?php echo floor( $estimated['sales'] ); ?></td>
229
+						<td><?php echo floor($estimated['sales']); ?></td>
230 230
 					</tr>
231 231
 				<?php endif; ?>
232 232
 			</table>
233 233
 
234
-			<?php do_action( 'give_reports_graph_additional_stats' ); ?>
234
+			<?php do_action('give_reports_graph_additional_stats'); ?>
235 235
 
236 236
 		</div>
237 237
 	</div>
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
  * @since 1.0
250 250
  * @return void
251 251
  */
252
-function give_reports_graph_of_form( $form_id = 0 ) {
252
+function give_reports_graph_of_form($form_id = 0) {
253 253
 	// Retrieve the queried dates
254 254
 	$dates = give_get_report_dates();
255 255
 
256 256
 	// Determine graph options
257
-	switch ( $dates['range'] ) :
257
+	switch ($dates['range']) :
258 258
 		case 'today' :
259 259
 		case 'yesterday' :
260 260
 			$day_by_day = true;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 			$day_by_day = false;
273 273
 			break;
274 274
 		case 'other' :
275
-			if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) {
275
+			if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) {
276 276
 				$day_by_day = false;
277 277
 			} else {
278 278
 				$day_by_day = true;
@@ -284,75 +284,75 @@  discard block
 block discarded – undo
284 284
 	endswitch;
285 285
 
286 286
 	$earnings_totals = (float) 0.00; // Total earnings for time period shown
287
-	$sales_totals    = 0;            // Total sales for time period shown
287
+	$sales_totals    = 0; // Total sales for time period shown
288 288
 
289 289
 	$earnings_data = array();
290 290
 	$sales_data    = array();
291 291
 	$stats         = new Give_Payment_Stats;
292 292
 
293
-	if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) {
293
+	if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') {
294 294
 
295 295
 		// Hour by hour
296 296
 		$month  = $dates['m_start'];
297 297
 		$hour   = 1;
298 298
 		$minute = 0;
299 299
 		$second = 0;
300
-		while ( $hour <= 23 ) :
300
+		while ($hour <= 23) :
301 301
 
302
-			if ( $hour == 23 ) {
302
+			if ($hour == 23) {
303 303
 				$minute = $second = 59;
304 304
 			}
305 305
 
306
-			$date     = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] );
307
-			$date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] );
306
+			$date     = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']);
307
+			$date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']);
308 308
 
309
-			$sales = $stats->get_sales( $form_id, $date, $date_end );
309
+			$sales = $stats->get_sales($form_id, $date, $date_end);
310 310
 			$sales_totals += $sales;
311 311
 
312
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
312
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
313 313
 			$earnings_totals += $earnings;
314 314
 
315
-			$sales_data[]    = array( $date * 1000, $sales );
316
-			$earnings_data[] = array( $date * 1000, $earnings );
315
+			$sales_data[]    = array($date * 1000, $sales);
316
+			$earnings_data[] = array($date * 1000, $earnings);
317 317
 
318
-			$hour ++;
318
+			$hour++;
319 319
 		endwhile;
320 320
 
321
-	} elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) {
321
+	} elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') {
322 322
 
323 323
 		//Day by day
324 324
 		$day     = $dates['day'];
325 325
 		$day_end = $dates['day_end'];
326 326
 		$month   = $dates['m_start'];
327
-		while ( $day <= $day_end ) :
327
+		while ($day <= $day_end) :
328 328
 
329
-			$date     = mktime( 0, 0, 0, $month, $day, $dates['year'] );
330
-			$date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] );
331
-			$sales    = $stats->get_sales( $form_id, $date, $date_end );
329
+			$date     = mktime(0, 0, 0, $month, $day, $dates['year']);
330
+			$date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']);
331
+			$sales    = $stats->get_sales($form_id, $date, $date_end);
332 332
 			$sales_totals += $sales;
333 333
 
334
-			$earnings = $stats->get_earnings( $form_id, $date, $date_end );
334
+			$earnings = $stats->get_earnings($form_id, $date, $date_end);
335 335
 			$earnings_totals += $earnings;
336 336
 
337
-			$sales_data[]    = array( $date * 1000, $sales );
338
-			$earnings_data[] = array( $date * 1000, $earnings );
337
+			$sales_data[]    = array($date * 1000, $sales);
338
+			$earnings_data[] = array($date * 1000, $earnings);
339 339
 
340
-			$day ++;
340
+			$day++;
341 341
 		endwhile;
342 342
 
343 343
 	} else {
344 344
 
345 345
 		$y = $dates['year'];
346 346
 
347
-		while ( $y <= $dates['year_end'] ) :
347
+		while ($y <= $dates['year_end']) :
348 348
 
349 349
 			$last_year = false;
350 350
 
351
-			if ( $dates['year'] == $dates['year_end'] ) {
351
+			if ($dates['year'] == $dates['year_end']) {
352 352
 				$month_start = $dates['m_start'];
353 353
 				$month_end   = $dates['m_end'];
354 354
 				$last_year   = true;
355
-			} elseif ( $y == $dates['year'] ) {
355
+			} elseif ($y == $dates['year']) {
356 356
 				$month_start = $dates['m_start'];
357 357
 				$month_end   = 12;
358 358
 			} else {
@@ -361,75 +361,75 @@  discard block
 block discarded – undo
361 361
 			}
362 362
 
363 363
 			$i = $month_start;
364
-			while ( $i <= $month_end ) :
364
+			while ($i <= $month_end) :
365 365
 
366
-				if ( $day_by_day ) :
366
+				if ($day_by_day) :
367 367
 
368
-					if ( $i == $month_end && $last_year ) {
368
+					if ($i == $month_end && $last_year) {
369 369
 
370 370
 						$num_of_days = $dates['day_end'];
371 371
 
372 372
 					} else {
373 373
 
374
-						$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
374
+						$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
375 375
 
376 376
 					}
377 377
 
378 378
 					$d = $dates['day'];
379
-					while ( $d <= $num_of_days ) :
379
+					while ($d <= $num_of_days) :
380 380
 
381
-						$date     = mktime( 0, 0, 0, $i, $d, $y );
382
-						$end_date = mktime( 23, 59, 59, $i, $d, $y );
381
+						$date     = mktime(0, 0, 0, $i, $d, $y);
382
+						$end_date = mktime(23, 59, 59, $i, $d, $y);
383 383
 
384
-						$sales = $stats->get_sales( $form_id, $date, $end_date );
384
+						$sales = $stats->get_sales($form_id, $date, $end_date);
385 385
 						$sales_totals += $sales;
386 386
 
387
-						$earnings = $stats->get_earnings( $form_id, $date, $end_date );
387
+						$earnings = $stats->get_earnings($form_id, $date, $end_date);
388 388
 						$earnings_totals += $earnings;
389 389
 
390
-						$sales_data[]    = array( $date * 1000, $sales );
391
-						$earnings_data[] = array( $date * 1000, $earnings );
392
-						$d ++;
390
+						$sales_data[]    = array($date * 1000, $sales);
391
+						$earnings_data[] = array($date * 1000, $earnings);
392
+						$d++;
393 393
 
394 394
 					endwhile;
395 395
 
396 396
 				else :
397 397
 
398
-					$num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y );
398
+					$num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y);
399 399
 
400
-					$date     = mktime( 0, 0, 0, $i, 1, $y );
401
-					$end_date = mktime( 23, 59, 59, $i, $num_of_days, $y );
400
+					$date     = mktime(0, 0, 0, $i, 1, $y);
401
+					$end_date = mktime(23, 59, 59, $i, $num_of_days, $y);
402 402
 
403
-					$sales = $stats->get_sales( $form_id, $date, $end_date );
403
+					$sales = $stats->get_sales($form_id, $date, $end_date);
404 404
 					$sales_totals += $sales;
405 405
 
406
-					$earnings = $stats->get_earnings( $form_id, $date, $end_date );
406
+					$earnings = $stats->get_earnings($form_id, $date, $end_date);
407 407
 					$earnings_totals += $earnings;
408 408
 
409
-					$sales_data[]    = array( $date * 1000, $sales );
410
-					$earnings_data[] = array( $date * 1000, $earnings );
409
+					$sales_data[]    = array($date * 1000, $sales);
410
+					$earnings_data[] = array($date * 1000, $earnings);
411 411
 				endif;
412 412
 
413
-				$i ++;
413
+				$i++;
414 414
 
415 415
 			endwhile;
416 416
 
417
-			$y ++;
417
+			$y++;
418 418
 		endwhile;
419 419
 
420 420
 	}
421 421
 
422 422
 	$data = array(
423
-		esc_html__( 'Income', 'give' )    => $earnings_data,
424
-		esc_html__( 'Donations', 'give' ) => $sales_data
423
+		esc_html__('Income', 'give')    => $earnings_data,
424
+		esc_html__('Donations', 'give') => $sales_data
425 425
 	);
426 426
 
427 427
 	?>
428 428
 	<h3><span><?php
429 429
 		printf(
430 430
 			/* translators: %s: form title */
431
-			esc_html__( 'Income Over Time for %s', 'give' ),
432
-			get_the_title( $form_id )
431
+			esc_html__('Income Over Time for %s', 'give'),
432
+			get_the_title($form_id)
433 433
 		);
434 434
 	?></span></h3>
435 435
 
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
 		<div class="postbox">
438 438
 			<div class="inside">
439 439
 				<?php
440
-				$graph = new Give_Graph( $data );
441
-				$graph->set( 'x_mode', 'time' );
442
-				$graph->set( 'multiple_y_axes', true );
440
+				$graph = new Give_Graph($data);
441
+				$graph->set('x_mode', 'time');
442
+				$graph->set('multiple_y_axes', true);
443 443
 				$graph->display();
444 444
 				?>
445 445
 			</div>
@@ -449,26 +449,26 @@  discard block
 block discarded – undo
449 449
 			<tbody>
450 450
 			<tr>
451 451
 				<td class="row-title">
452
-					<label for="tablecell"><?php esc_html_e( 'Total income for period:', 'give' ); ?></label></td>
453
-				<td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td>
452
+					<label for="tablecell"><?php esc_html_e('Total income for period:', 'give'); ?></label></td>
453
+				<td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td>
454 454
 			</tr>
455 455
 			<tr class="alternate">
456 456
 				<td class="row-title">
457
-					<label for="tablecell"><?php esc_html_e( 'Total donations for period:', 'give' ); ?></label>
457
+					<label for="tablecell"><?php esc_html_e('Total donations for period:', 'give'); ?></label>
458 458
 				</td>
459 459
 				<td><?php echo $sales_totals; ?></td>
460 460
 			</tr>
461 461
 			<tr>
462 462
 				<td class="row-title">
463
-					<label for="tablecell"><?php esc_html_e( 'Average monthly income:', 'give' ); ?></label>
463
+					<label for="tablecell"><?php esc_html_e('Average monthly income:', 'give'); ?></label>
464 464
 				</td>
465
-				<td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td>
465
+				<td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td>
466 466
 			</tr>
467 467
 			<tr class="alternate">
468 468
 				<td class="row-title">
469
-					<label for="tablecell"><?php esc_html_e( 'Average monthly donations:', 'give' ); ?></label>
469
+					<label for="tablecell"><?php esc_html_e('Average monthly donations:', 'give'); ?></label>
470 470
 				</td>
471
-				<td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td>
471
+				<td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td>
472 472
 			</tr>
473 473
 			</tbody>
474 474
 		</table>
@@ -485,29 +485,29 @@  discard block
 block discarded – undo
485 485
  * @return void
486 486
  */
487 487
 function give_reports_graph_controls() {
488
-	$date_options = apply_filters( 'give_report_date_options', array(
489
-		'today'        => esc_html__( 'Today', 'give' ),
490
-		'yesterday'    => esc_html__( 'Yesterday', 'give' ),
491
-		'this_week'    => esc_html__( 'This Week', 'give' ),
492
-		'last_week'    => esc_html__( 'Last Week', 'give' ),
493
-		'this_month'   => esc_html__( 'This Month', 'give' ),
494
-		'last_month'   => esc_html__( 'Last Month', 'give' ),
495
-		'this_quarter' => esc_html__( 'This Quarter', 'give' ),
496
-		'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
497
-		'this_year'    => esc_html__( 'This Year', 'give' ),
498
-		'last_year'    => esc_html__( 'Last Year', 'give' ),
499
-		'other'        => esc_html__( 'Custom', 'give' )
500
-	) );
488
+	$date_options = apply_filters('give_report_date_options', array(
489
+		'today'        => esc_html__('Today', 'give'),
490
+		'yesterday'    => esc_html__('Yesterday', 'give'),
491
+		'this_week'    => esc_html__('This Week', 'give'),
492
+		'last_week'    => esc_html__('Last Week', 'give'),
493
+		'this_month'   => esc_html__('This Month', 'give'),
494
+		'last_month'   => esc_html__('Last Month', 'give'),
495
+		'this_quarter' => esc_html__('This Quarter', 'give'),
496
+		'last_quarter' => esc_html__('Last Quarter', 'give'),
497
+		'this_year'    => esc_html__('This Year', 'give'),
498
+		'last_year'    => esc_html__('Last Year', 'give'),
499
+		'other'        => esc_html__('Custom', 'give')
500
+	));
501 501
 
502 502
 	$dates   = give_get_report_dates();
503 503
 	$display = $dates['range'] == 'other' ? '' : 'style="display:none;"';
504 504
 	$view    = give_get_reporting_view();
505 505
 
506
-	if ( empty( $dates['day_end'] ) ) {
507
-		$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) );
506
+	if (empty($dates['day_end'])) {
507
+		$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y'));
508 508
 	}
509 509
 
510
-	do_action( 'give_report_graph_controls_before' );
510
+	do_action('give_report_graph_controls_before');
511 511
 	?>
512 512
 	<form id="give-graphs-filter" method="get" class="alignright">
513 513
 		<div class="tablenav top alignright">
@@ -515,53 +515,53 @@  discard block
 block discarded – undo
515 515
 
516 516
 				<input type="hidden" name="post_type" value="give_forms" />
517 517
 				<input type="hidden" name="page" value="give-reports" />
518
-				<input type="hidden" name="view" value="<?php echo esc_attr( $view ); ?>" />
518
+				<input type="hidden" name="view" value="<?php echo esc_attr($view); ?>" />
519 519
 
520
-				<?php if ( isset( $_GET['form-id'] ) ) : ?>
521
-					<input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" />
520
+				<?php if (isset($_GET['form-id'])) : ?>
521
+					<input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" />
522 522
 				<?php endif; ?>
523 523
 
524 524
 				<div id="give-graphs-date-options-wrap" class="alignright">
525 525
 					<select id="give-graphs-date-options" name="range">
526
-						<?php foreach ( $date_options as $key => $option ) : ?>
527
-							<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option>
526
+						<?php foreach ($date_options as $key => $option) : ?>
527
+							<option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option>
528 528
 						<?php endforeach; ?>
529 529
 					</select>
530 530
 
531
-					<input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" />
531
+					<input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" />
532 532
 				</div>
533 533
 
534 534
 				<div id="give-date-range-options" <?php echo $display; ?>>
535
-					<span><?php esc_html_e( 'From', 'give' ); ?>&nbsp;</span>
535
+					<span><?php esc_html_e('From', 'give'); ?>&nbsp;</span>
536 536
 					<select id="give-graphs-month-start" name="m_start">
537
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
538
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_start'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
537
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
538
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_start']); ?>><?php echo give_month_num_to_name($i); ?></option>
539 539
 						<?php endfor; ?>
540 540
 					</select>
541 541
 					<select id="give-graphs-day-start" name="day">
542
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
543
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day'] ); ?>><?php echo $i; ?></option>
542
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
543
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day']); ?>><?php echo $i; ?></option>
544 544
 						<?php endfor; ?>
545 545
 					</select>
546 546
 					<select id="give-graphs-year-start" name="year">
547
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
548
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year'] ); ?>><?php echo $i; ?></option>
547
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
548
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year']); ?>><?php echo $i; ?></option>
549 549
 						<?php endfor; ?>
550 550
 					</select>
551
-					<span><?php esc_html_e( 'To', 'give' ); ?>&nbsp;</span>
551
+					<span><?php esc_html_e('To', 'give'); ?>&nbsp;</span>
552 552
 					<select id="give-graphs-month-end" name="m_end">
553
-						<?php for ( $i = 1; $i <= 12; $i ++ ) : ?>
554
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['m_end'] ); ?>><?php echo give_month_num_to_name( $i ); ?></option>
553
+						<?php for ($i = 1; $i <= 12; $i++) : ?>
554
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['m_end']); ?>><?php echo give_month_num_to_name($i); ?></option>
555 555
 						<?php endfor; ?>
556 556
 					</select>
557 557
 					<select id="give-graphs-day-end" name="day_end">
558
-						<?php for ( $i = 1; $i <= 31; $i ++ ) : ?>
559
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['day_end'] ); ?>><?php echo $i; ?></option>
558
+						<?php for ($i = 1; $i <= 31; $i++) : ?>
559
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['day_end']); ?>><?php echo $i; ?></option>
560 560
 						<?php endfor; ?>
561 561
 					</select>
562 562
 					<select id="give-graphs-year-end" name="year_end">
563
-						<?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?>
564
-							<option value="<?php echo absint( $i ); ?>" <?php selected( $i, $dates['year_end'] ); ?>><?php echo $i; ?></option>
563
+						<?php for ($i = 2007; $i <= date('Y'); $i++) : ?>
564
+							<option value="<?php echo absint($i); ?>" <?php selected($i, $dates['year_end']); ?>><?php echo $i; ?></option>
565 565
 						<?php endfor; ?>
566 566
 					</select>
567 567
 				</div>
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		</div>
572 572
 	</form>
573 573
 	<?php
574
-	do_action( 'give_report_graph_controls_after' );
574
+	do_action('give_report_graph_controls_after');
575 575
 }
576 576
 
577 577
 /**
@@ -586,65 +586,65 @@  discard block
 block discarded – undo
586 586
 function give_get_report_dates() {
587 587
 	$dates = array();
588 588
 
589
-	$current_time = current_time( 'timestamp' );
589
+	$current_time = current_time('timestamp');
590 590
 
591
-	$dates['range']    = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month';
592
-	$dates['year']     = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' );
593
-	$dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' );
594
-	$dates['m_start']  = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1;
595
-	$dates['m_end']    = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12;
596
-	$dates['day']      = isset( $_GET['day'] ) ? $_GET['day'] : 1;
597
-	$dates['day_end']  = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
591
+	$dates['range']    = isset($_GET['range']) ? $_GET['range'] : 'this_month';
592
+	$dates['year']     = isset($_GET['year']) ? $_GET['year'] : date('Y');
593
+	$dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y');
594
+	$dates['m_start']  = isset($_GET['m_start']) ? $_GET['m_start'] : 1;
595
+	$dates['m_end']    = isset($_GET['m_end']) ? $_GET['m_end'] : 12;
596
+	$dates['day']      = isset($_GET['day']) ? $_GET['day'] : 1;
597
+	$dates['day_end']  = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
598 598
 
599 599
 	// Modify dates based on predefined ranges
600
-	switch ( $dates['range'] ) :
600
+	switch ($dates['range']) :
601 601
 
602 602
 		case 'this_month' :
603
-			$dates['m_start']  = date( 'n', $current_time );
604
-			$dates['m_end']    = date( 'n', $current_time );
603
+			$dates['m_start']  = date('n', $current_time);
604
+			$dates['m_end']    = date('n', $current_time);
605 605
 			$dates['day']      = 1;
606
-			$dates['day_end']  = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
607
-			$dates['year']     = date( 'Y' );
608
-			$dates['year_end'] = date( 'Y' );
606
+			$dates['day_end']  = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
607
+			$dates['year']     = date('Y');
608
+			$dates['year_end'] = date('Y');
609 609
 			break;
610 610
 
611 611
 		case 'last_month' :
612
-			if ( date( 'n' ) == 1 ) {
612
+			if (date('n') == 1) {
613 613
 				$dates['m_start']  = 12;
614 614
 				$dates['m_end']    = 12;
615
-				$dates['year']     = date( 'Y', $current_time ) - 1;
616
-				$dates['year_end'] = date( 'Y', $current_time ) - 1;
615
+				$dates['year']     = date('Y', $current_time) - 1;
616
+				$dates['year_end'] = date('Y', $current_time) - 1;
617 617
 			} else {
618
-				$dates['m_start']  = date( 'n' ) - 1;
619
-				$dates['m_end']    = date( 'n' ) - 1;
618
+				$dates['m_start']  = date('n') - 1;
619
+				$dates['m_end']    = date('n') - 1;
620 620
 				$dates['year_end'] = $dates['year'];
621 621
 			}
622
-			$dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] );
622
+			$dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']);
623 623
 			break;
624 624
 
625 625
 		case 'today' :
626
-			$dates['day']     = date( 'd', $current_time );
627
-			$dates['m_start'] = date( 'n', $current_time );
628
-			$dates['m_end']   = date( 'n', $current_time );
629
-			$dates['year']    = date( 'Y', $current_time );
626
+			$dates['day']     = date('d', $current_time);
627
+			$dates['m_start'] = date('n', $current_time);
628
+			$dates['m_end']   = date('n', $current_time);
629
+			$dates['year']    = date('Y', $current_time);
630 630
 			break;
631 631
 
632 632
 		case 'yesterday' :
633 633
 
634
-			$year  = date( 'Y', $current_time );
635
-			$month = date( 'n', $current_time );
636
-			$day   = date( 'd', $current_time );
634
+			$year  = date('Y', $current_time);
635
+			$month = date('n', $current_time);
636
+			$day   = date('d', $current_time);
637 637
 
638
-			if ( $month == 1 && $day == 1 ) {
638
+			if ($month == 1 && $day == 1) {
639 639
 
640 640
 				$year -= 1;
641 641
 				$month = 12;
642
-				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
642
+				$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
643 643
 
644
-			} elseif ( $month > 1 && $day == 1 ) {
644
+			} elseif ($month > 1 && $day == 1) {
645 645
 
646 646
 				$month -= 1;
647
-				$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
647
+				$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
648 648
 
649 649
 			} else {
650 650
 
@@ -660,91 +660,91 @@  discard block
 block discarded – undo
660 660
 			break;
661 661
 
662 662
 		case 'this_week' :
663
-			$dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;
664
-			$dates['day'] += get_option( 'start_of_week' );
663
+			$dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1;
664
+			$dates['day'] += get_option('start_of_week');
665 665
 			$dates['day_end'] = $dates['day'] + 6;
666
-			$dates['m_start'] = date( 'n', $current_time );
667
-			$dates['m_end']   = date( 'n', $current_time );
668
-			$dates['year']    = date( 'Y', $current_time );
666
+			$dates['m_start'] = date('n', $current_time);
667
+			$dates['m_end']   = date('n', $current_time);
668
+			$dates['year']    = date('Y', $current_time);
669 669
 			break;
670 670
 
671 671
 		case 'last_week' :
672
-			$dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8;
673
-			$dates['day'] += get_option( 'start_of_week' );
672
+			$dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8;
673
+			$dates['day'] += get_option('start_of_week');
674 674
 			$dates['day_end'] = $dates['day'] + 6;
675
-			$dates['year']    = date( 'Y' );
676
-
677
-			if ( date( 'j', $current_time ) <= 7 ) {
678
-				$dates['m_start'] = date( 'n', $current_time ) - 1;
679
-				$dates['m_end']   = date( 'n', $current_time ) - 1;
680
-				if ( $dates['m_start'] <= 1 ) {
681
-					$dates['year']     = date( 'Y', $current_time ) - 1;
682
-					$dates['year_end'] = date( 'Y', $current_time ) - 1;
675
+			$dates['year']    = date('Y');
676
+
677
+			if (date('j', $current_time) <= 7) {
678
+				$dates['m_start'] = date('n', $current_time) - 1;
679
+				$dates['m_end']   = date('n', $current_time) - 1;
680
+				if ($dates['m_start'] <= 1) {
681
+					$dates['year']     = date('Y', $current_time) - 1;
682
+					$dates['year_end'] = date('Y', $current_time) - 1;
683 683
 				}
684 684
 			} else {
685
-				$dates['m_start'] = date( 'n', $current_time );
686
-				$dates['m_end']   = date( 'n', $current_time );
685
+				$dates['m_start'] = date('n', $current_time);
686
+				$dates['m_end']   = date('n', $current_time);
687 687
 			}
688 688
 			break;
689 689
 
690 690
 		case 'this_quarter' :
691
-			$month_now = date( 'n', $current_time );
691
+			$month_now = date('n', $current_time);
692 692
 
693
-			if ( $month_now <= 3 ) {
693
+			if ($month_now <= 3) {
694 694
 
695 695
 				$dates['m_start'] = 1;
696 696
 				$dates['m_end']   = 4;
697
-				$dates['year']    = date( 'Y', $current_time );
697
+				$dates['year']    = date('Y', $current_time);
698 698
 
699
-			} else if ( $month_now <= 6 ) {
699
+			} else if ($month_now <= 6) {
700 700
 
701 701
 				$dates['m_start'] = 4;
702 702
 				$dates['m_end']   = 7;
703
-				$dates['year']    = date( 'Y', $current_time );
703
+				$dates['year']    = date('Y', $current_time);
704 704
 
705
-			} else if ( $month_now <= 9 ) {
705
+			} else if ($month_now <= 9) {
706 706
 
707 707
 				$dates['m_start'] = 7;
708 708
 				$dates['m_end']   = 10;
709
-				$dates['year']    = date( 'Y', $current_time );
709
+				$dates['year']    = date('Y', $current_time);
710 710
 
711 711
 			} else {
712 712
 
713 713
 				$dates['m_start']  = 10;
714 714
 				$dates['m_end']    = 1;
715
-				$dates['year']     = date( 'Y', $current_time );
716
-				$dates['year_end'] = date( 'Y', $current_time ) + 1;
715
+				$dates['year']     = date('Y', $current_time);
716
+				$dates['year_end'] = date('Y', $current_time) + 1;
717 717
 
718 718
 			}
719 719
 			break;
720 720
 
721 721
 		case 'last_quarter' :
722
-			$month_now = date( 'n' );
722
+			$month_now = date('n');
723 723
 
724
-			if ( $month_now <= 3 ) {
724
+			if ($month_now <= 3) {
725 725
 
726 726
 				$dates['m_start']  = 10;
727 727
 				$dates['m_end']    = 12;
728
-				$dates['year']     = date( 'Y', $current_time ) - 1; // Previous year
729
-				$dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year
728
+				$dates['year']     = date('Y', $current_time) - 1; // Previous year
729
+				$dates['year_end'] = date('Y', $current_time) - 1; // Previous year
730 730
 
731
-			} else if ( $month_now <= 6 ) {
731
+			} else if ($month_now <= 6) {
732 732
 
733 733
 				$dates['m_start'] = 1;
734 734
 				$dates['m_end']   = 3;
735
-				$dates['year']    = date( 'Y', $current_time );
735
+				$dates['year']    = date('Y', $current_time);
736 736
 
737
-			} else if ( $month_now <= 9 ) {
737
+			} else if ($month_now <= 9) {
738 738
 
739 739
 				$dates['m_start'] = 4;
740 740
 				$dates['m_end']   = 6;
741
-				$dates['year']    = date( 'Y', $current_time );
741
+				$dates['year']    = date('Y', $current_time);
742 742
 
743 743
 			} else {
744 744
 
745 745
 				$dates['m_start'] = 7;
746 746
 				$dates['m_end']   = 9;
747
-				$dates['year']    = date( 'Y', $current_time );
747
+				$dates['year']    = date('Y', $current_time);
748 748
 
749 749
 			}
750 750
 			break;
@@ -752,19 +752,19 @@  discard block
 block discarded – undo
752 752
 		case 'this_year' :
753 753
 			$dates['m_start'] = 1;
754 754
 			$dates['m_end']   = 12;
755
-			$dates['year']    = date( 'Y', $current_time );
755
+			$dates['year']    = date('Y', $current_time);
756 756
 			break;
757 757
 
758 758
 		case 'last_year' :
759 759
 			$dates['m_start']  = 1;
760 760
 			$dates['m_end']    = 12;
761
-			$dates['year']     = date( 'Y', $current_time ) - 1;
762
-			$dates['year_end'] = date( 'Y', $current_time ) - 1;
761
+			$dates['year']     = date('Y', $current_time) - 1;
762
+			$dates['year_end'] = date('Y', $current_time) - 1;
763 763
 			break;
764 764
 
765 765
 	endswitch;
766 766
 
767
-	return apply_filters( 'give_report_dates', $dates );
767
+	return apply_filters('give_report_dates', $dates);
768 768
 }
769 769
 
770 770
 /**
@@ -774,17 +774,17 @@  discard block
 block discarded – undo
774 774
  *
775 775
  * @param $data
776 776
  */
777
-function give_parse_report_dates( $data ) {
777
+function give_parse_report_dates($data) {
778 778
 	$dates = give_get_report_dates();
779 779
 
780 780
 	$view = give_get_reporting_view();
781
-	$id   = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null;
781
+	$id   = isset($_GET['form-id']) ? $_GET['form-id'] : null;
782 782
 
783
-	wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) );
783
+	wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&view='.esc_attr($view).'&form-id='.absint($id))));
784 784
 	give_die();
785 785
 }
786 786
 
787
-add_action( 'give_filter_reports', 'give_parse_report_dates' );
787
+add_action('give_filter_reports', 'give_parse_report_dates');
788 788
 
789 789
 
790 790
 /**
@@ -796,16 +796,16 @@  discard block
 block discarded – undo
796 796
  */
797 797
 function give_reports_refresh_button() {
798 798
 
799
-	$url = wp_nonce_url( add_query_arg( array(
799
+	$url = wp_nonce_url(add_query_arg(array(
800 800
 		'give_action'  => 'refresh_reports_transients',
801 801
 		'give-message' => 'refreshed-reports'
802
-	) ), 'give-refresh-reports' );
802
+	)), 'give-refresh-reports');
803 803
 
804
-	echo '<a href="' . $url . '" data-tooltip="' . esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) . '" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">' . esc_html__( 'Refresh Reports', 'give' ) . '</a>';
804
+	echo '<a href="'.$url.'" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give').'" data-tooltip-my-position="right center"  data-tooltip-target-position="left center" class="button alignright give-refresh-reports-button give-tooltip">'.esc_html__('Refresh Reports', 'give').'</a>';
805 805
 
806 806
 }
807 807
 
808
-add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' );
808
+add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button');
809 809
 
810 810
 /**
811 811
  * Trigger the refresh of reports transients
@@ -816,18 +816,18 @@  discard block
 block discarded – undo
816 816
  *
817 817
  * @return void
818 818
  */
819
-function give_run_refresh_reports_transients( $data ) {
819
+function give_run_refresh_reports_transients($data) {
820 820
 
821
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) {
821
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) {
822 822
 		return;
823 823
 	}
824 824
 
825 825
 	//Delete transients
826
-	delete_transient( 'give_estimated_monthly_stats' );
827
-	delete_transient( 'give_earnings_total' );
828
-	delete_transient( md5( 'give_earnings_this_monththis_month' ) );
829
-	delete_transient( md5( 'give_earnings_todaytoday' ) );
826
+	delete_transient('give_estimated_monthly_stats');
827
+	delete_transient('give_earnings_total');
828
+	delete_transient(md5('give_earnings_this_monththis_month'));
829
+	delete_transient(md5('give_earnings_todaytoday'));
830 830
 
831 831
 }
832 832
 
833
-add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' );
834 833
\ No newline at end of file
834
+add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients');
835 835
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/customers/customer-actions.php 1 patch
Spacing   +128 added lines, -128 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
 
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
 		'user_id' => 0
55 55
 	);
56 56
 
57
-	$customer_info = wp_parse_args( $customer_info, $defaults );
57
+	$customer_info = wp_parse_args($customer_info, $defaults);
58 58
 
59
-	if ( ! is_email( $customer_info['email'] ) ) {
60
-		give_set_error( 'give-invalid-email', esc_html__( 'Please enter a valid email address.', 'give' ) );
59
+	if ( ! is_email($customer_info['email'])) {
60
+		give_set_error('give-invalid-email', esc_html__('Please enter a valid email address.', 'give'));
61 61
 	}
62 62
 
63
-	if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) {
63
+	if ((int) $customer_info['user_id'] != (int) $customer->user_id) {
64 64
 
65 65
 		// Make sure we don't already have this user attached to a customer
66
-		if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) {
67
-			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'] ) );
66
+		if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) {
67
+			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']));
68 68
 		}
69 69
 
70 70
 		// Make sure it's actually a user
71
-		$user = get_user_by( 'id', $customer_info['user_id'] );
72
-		if ( ! empty( $customer_info['user_id'] ) && false === $user ) {
73
-			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'] ) );
71
+		$user = get_user_by('id', $customer_info['user_id']);
72
+		if ( ! empty($customer_info['user_id']) && false === $user) {
73
+			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']));
74 74
 		}
75 75
 
76 76
 	}
@@ -78,53 +78,53 @@  discard block
 block discarded – undo
78 78
 	// Record this for later
79 79
 	$previous_user_id = $customer->user_id;
80 80
 
81
-	if ( give_get_errors() ) {
81
+	if (give_get_errors()) {
82 82
 		return;
83 83
 	}
84 84
 
85 85
 	// Setup the customer address, if present
86 86
 	$address = array();
87
-	if ( intval( $customer_info['user_id'] ) > 0 ) {
87
+	if (intval($customer_info['user_id']) > 0) {
88 88
 
89
-		$current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true );
89
+		$current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true);
90 90
 
91
-		if ( false === $current_address ) {
92
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : '';
93
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : '';
94
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : '';
95
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : '';
96
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : '';
97
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : '';
91
+		if (false === $current_address) {
92
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : '';
93
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : '';
94
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : '';
95
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : '';
96
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : '';
97
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : '';
98 98
 		} else {
99
-			$current_address    = wp_parse_args( $current_address, array(
99
+			$current_address    = wp_parse_args($current_address, array(
100 100
 				'line1',
101 101
 				'line2',
102 102
 				'city',
103 103
 				'zip',
104 104
 				'state',
105 105
 				'country'
106
-			) );
107
-			$address['line1']   = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1'];
108
-			$address['line2']   = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2'];
109
-			$address['city']    = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city'];
110
-			$address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country'];
111
-			$address['zip']     = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip'];
112
-			$address['state']   = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state'];
106
+			));
107
+			$address['line1']   = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1'];
108
+			$address['line2']   = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2'];
109
+			$address['city']    = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city'];
110
+			$address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country'];
111
+			$address['zip']     = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip'];
112
+			$address['state']   = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state'];
113 113
 		}
114 114
 
115 115
 	}
116 116
 
117 117
 	// Sanitize the inputs
118 118
 	$customer_data            = array();
119
-	$customer_data['name']    = strip_tags( stripslashes( $customer_info['name'] ) );
119
+	$customer_data['name']    = strip_tags(stripslashes($customer_info['name']));
120 120
 	$customer_data['email']   = $customer_info['email'];
121 121
 	$customer_data['user_id'] = $customer_info['user_id'];
122 122
 
123
-	$customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id );
124
-	$address       = apply_filters( 'give_edit_customer_address', $address, $customer_id );
123
+	$customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id);
124
+	$address       = apply_filters('give_edit_customer_address', $address, $customer_id);
125 125
 
126
-	$customer_data = array_map( 'sanitize_text_field', $customer_data );
127
-	$address       = array_map( 'sanitize_text_field', $address );
126
+	$customer_data = array_map('sanitize_text_field', $customer_data);
127
+	$address       = array_map('sanitize_text_field', $address);
128 128
 
129 129
 
130 130
 	/**
@@ -136,34 +136,34 @@  discard block
 block discarded – undo
136 136
 	 * @param array $customer_data The customer data.
137 137
 	 * @param array $address       The customer address.
138 138
 	 */
139
-	do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address );
139
+	do_action('give_pre_edit_customer', $customer_id, $customer_data, $address);
140 140
 
141 141
 	$output         = array();
142 142
 	$previous_email = $customer->email;
143 143
 
144
-	if ( $customer->update( $customer_data ) ) {
144
+	if ($customer->update($customer_data)) {
145 145
 
146
-		if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) {
147
-			update_user_meta( $customer->user_id, '_give_user_address', $address );
146
+		if ( ! empty($customer->user_id) && $customer->user_id > 0) {
147
+			update_user_meta($customer->user_id, '_give_user_address', $address);
148 148
 		}
149 149
 
150 150
 		// Update some payment meta if we need to
151
-		$payments_array = explode( ',', $customer->payment_ids );
151
+		$payments_array = explode(',', $customer->payment_ids);
152 152
 
153
-		if ( $customer->email != $previous_email ) {
154
-			foreach ( $payments_array as $payment_id ) {
155
-				give_update_payment_meta( $payment_id, 'email', $customer->email );
153
+		if ($customer->email != $previous_email) {
154
+			foreach ($payments_array as $payment_id) {
155
+				give_update_payment_meta($payment_id, 'email', $customer->email);
156 156
 			}
157 157
 		}
158 158
 
159
-		if ( $customer->user_id != $previous_user_id ) {
160
-			foreach ( $payments_array as $payment_id ) {
161
-				give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id );
159
+		if ($customer->user_id != $previous_user_id) {
160
+			foreach ($payments_array as $payment_id) {
161
+				give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id);
162 162
 			}
163 163
 		}
164 164
 
165 165
 		$output['success']       = true;
166
-		$customer_data           = array_merge( $customer_data, $address );
166
+		$customer_data           = array_merge($customer_data, $address);
167 167
 		$output['customer_info'] = $customer_data;
168 168
 
169 169
 	} else {
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 	 * @param int   $customer_id   The ID of the customer.
181 181
 	 * @param array $customer_data The customer data.
182 182
 	 */
183
-	do_action( 'give_post_edit_customer', $customer_id, $customer_data );
183
+	do_action('give_post_edit_customer', $customer_id, $customer_data);
184 184
 
185
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
186
-		header( 'Content-Type: application/json' );
187
-		echo json_encode( $output );
185
+	if (defined('DOING_AJAX') && DOING_AJAX) {
186
+		header('Content-Type: application/json');
187
+		echo json_encode($output);
188 188
 		wp_die();
189 189
 	}
190 190
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 }
194 194
 
195
-add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 );
195
+add_action('give_edit-customer', 'give_edit_customer', 10, 1);
196 196
 
197 197
 /**
198 198
  * Save a customer note being added
@@ -203,36 +203,36 @@  discard block
 block discarded – undo
203 203
  *
204 204
  * @return int         The Note ID that was saved, or 0 if nothing was saved
205 205
  */
206
-function give_customer_save_note( $args ) {
206
+function give_customer_save_note($args) {
207 207
 
208
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
208
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
209 209
 
210
-	if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) {
211
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
210
+	if ( ! is_admin() || ! current_user_can($customer_view_role)) {
211
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
212 212
 	}
213 213
 
214
-	if ( empty( $args ) ) {
214
+	if (empty($args)) {
215 215
 		return;
216 216
 	}
217 217
 
218
-	$customer_note = trim( sanitize_text_field( $args['customer_note'] ) );
218
+	$customer_note = trim(sanitize_text_field($args['customer_note']));
219 219
 	$customer_id   = (int) $args['customer_id'];
220 220
 	$nonce         = $args['add_customer_note_nonce'];
221 221
 
222
-	if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) {
223
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
222
+	if ( ! wp_verify_nonce($nonce, 'add-customer-note')) {
223
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
224 224
 	}
225 225
 
226
-	if ( empty( $customer_note ) ) {
227
-		give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) );
226
+	if (empty($customer_note)) {
227
+		give_set_error('empty-customer-note', esc_html__('A note is required.', 'give'));
228 228
 	}
229 229
 
230
-	if ( give_get_errors() ) {
230
+	if (give_get_errors()) {
231 231
 		return;
232 232
 	}
233 233
 
234
-	$customer = new Give_Customer( $customer_id );
235
-	$new_note = $customer->add_note( $customer_note );
234
+	$customer = new Give_Customer($customer_id);
235
+	$new_note = $customer->add_note($customer_note);
236 236
 
237 237
 	/**
238 238
 	 * Fires before inserting customer note.
@@ -242,22 +242,22 @@  discard block
 block discarded – undo
242 242
 	 * @param int    $customer_id The ID of the customer.
243 243
 	 * @param string $new_note    Note content.
244 244
 	 */
245
-	do_action( 'give_pre_insert_customer_note', $customer_id, $new_note );
245
+	do_action('give_pre_insert_customer_note', $customer_id, $new_note);
246 246
 
247
-	if ( ! empty( $new_note ) && ! empty( $customer->id ) ) {
247
+	if ( ! empty($new_note) && ! empty($customer->id)) {
248 248
 
249 249
 		ob_start();
250 250
 		?>
251 251
 		<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
252 252
 			<span class="note-content-wrap">
253
-				<?php echo stripslashes( $new_note ); ?>
253
+				<?php echo stripslashes($new_note); ?>
254 254
 			</span>
255 255
 		</div>
256 256
 		<?php
257 257
 		$output = ob_get_contents();
258 258
 		ob_end_clean();
259 259
 
260
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
260
+		if (defined('DOING_AJAX') && DOING_AJAX) {
261 261
 			echo $output;
262 262
 			exit;
263 263
 		}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 }
272 272
 
273
-add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 );
273
+add_action('give_add-customer-note', 'give_customer_save_note', 10, 1);
274 274
 
275 275
 /**
276 276
  * Delete a customer
@@ -281,37 +281,37 @@  discard block
 block discarded – undo
281 281
  *
282 282
  * @return int Whether it was a successful deletion
283 283
  */
284
-function give_customer_delete( $args ) {
284
+function give_customer_delete($args) {
285 285
 
286
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
286
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
287 287
 
288
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
289
-		wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
288
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
289
+		wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
290 290
 	}
291 291
 
292
-	if ( empty( $args ) ) {
292
+	if (empty($args)) {
293 293
 		return;
294 294
 	}
295 295
 
296 296
 	$customer_id = (int) $args['customer_id'];
297
-	$confirm     = ! empty( $args['give-customer-delete-confirm'] ) ? true : false;
298
-	$remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false;
297
+	$confirm     = ! empty($args['give-customer-delete-confirm']) ? true : false;
298
+	$remove_data = ! empty($args['give-customer-delete-records']) ? true : false;
299 299
 	$nonce       = $args['_wpnonce'];
300 300
 
301
-	if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) {
302
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
301
+	if ( ! wp_verify_nonce($nonce, 'delete-customer')) {
302
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
303 303
 	}
304 304
 
305
-	if ( ! $confirm ) {
306
-		give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) );
305
+	if ( ! $confirm) {
306
+		give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give'));
307 307
 	}
308 308
 
309
-	if ( give_get_errors() ) {
310
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) );
309
+	if (give_get_errors()) {
310
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id));
311 311
 		exit;
312 312
 	}
313 313
 
314
-	$customer = new Give_Customer( $customer_id );
314
+	$customer = new Give_Customer($customer_id);
315 315
 
316 316
 	/**
317 317
 	 * Fires before deleting customer.
@@ -322,55 +322,55 @@  discard block
 block discarded – undo
322 322
 	 * @param bool $confirm     Delete confirmation.
323 323
 	 * @param bool $remove_data Records delete confirmation.
324 324
 	 */
325
-	do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data );
325
+	do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data);
326 326
 
327 327
 	$success = false;
328 328
 
329
-	if ( $customer->id > 0 ) {
329
+	if ($customer->id > 0) {
330 330
 
331
-		$payments_array = explode( ',', $customer->payment_ids );
332
-		$success        = Give()->customers->delete( $customer->id );
331
+		$payments_array = explode(',', $customer->payment_ids);
332
+		$success        = Give()->customers->delete($customer->id);
333 333
 
334
-		if ( $success ) {
334
+		if ($success) {
335 335
 
336
-			if ( $remove_data ) {
336
+			if ($remove_data) {
337 337
 
338 338
 				// Remove all payments, logs, etc
339
-				foreach ( $payments_array as $payment_id ) {
340
-					give_delete_purchase( $payment_id );
339
+				foreach ($payments_array as $payment_id) {
340
+					give_delete_purchase($payment_id);
341 341
 				}
342 342
 
343 343
 			} else {
344 344
 
345 345
 				// Just set the payments to customer_id of 0
346
-				foreach ( $payments_array as $payment_id ) {
347
-					give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 );
346
+				foreach ($payments_array as $payment_id) {
347
+					give_update_payment_meta($payment_id, '_give_payment_customer_id', 0);
348 348
 				}
349 349
 
350 350
 			}
351 351
 
352
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' );
352
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted');
353 353
 
354 354
 		} else {
355 355
 
356
-			give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) );
357
-			$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id );
356
+			give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give'));
357
+			$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id);
358 358
 
359 359
 		}
360 360
 
361 361
 	} else {
362 362
 
363
-		give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) );
364
-		$redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' );
363
+		give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give'));
364
+		$redirect = admin_url('edit.php?post_type=give_forms&page=give-donors');
365 365
 
366 366
 	}
367 367
 
368
-	wp_redirect( $redirect );
368
+	wp_redirect($redirect);
369 369
 	exit;
370 370
 
371 371
 }
372 372
 
373
-add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 );
373
+add_action('give_delete-customer', 'give_customer_delete', 10, 1);
374 374
 
375 375
 /**
376 376
  * Disconnect a user ID from a donor
@@ -381,27 +381,27 @@  discard block
 block discarded – undo
381 381
  *
382 382
  * @return bool        If the disconnect was successful
383 383
  */
384
-function give_disconnect_customer_user_id( $args ) {
384
+function give_disconnect_customer_user_id($args) {
385 385
 
386
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
386
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
387 387
 
388
-	if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) {
389
-		wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
388
+	if ( ! is_admin() || ! current_user_can($customer_edit_role)) {
389
+		wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
390 390
 	}
391 391
 
392
-	if ( empty( $args ) ) {
392
+	if (empty($args)) {
393 393
 		return;
394 394
 	}
395 395
 
396 396
 	$customer_id = (int) $args['customer_id'];
397 397
 	$nonce       = $args['_wpnonce'];
398 398
 
399
-	if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) {
400
-		wp_die( esc_html__( 'Cheatin&#8217; uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
399
+	if ( ! wp_verify_nonce($nonce, 'edit-customer')) {
400
+		wp_die(esc_html__('Cheatin&#8217; uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400));
401 401
 	}
402 402
 
403
-	$customer = new Give_Customer( $customer_id );
404
-	if ( empty( $customer->id ) ) {
403
+	$customer = new Give_Customer($customer_id);
404
+	if (empty($customer->id)) {
405 405
 		return false;
406 406
 	}
407 407
 
@@ -415,15 +415,15 @@  discard block
 block discarded – undo
415 415
 	 * @param int $customer_id The ID of the customer.
416 416
 	 * @param int $user_id     The ID of the user.
417 417
 	 */
418
-	do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id );
418
+	do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id);
419 419
 
420
-	$customer_args = array( 'user_id' => 0 );
420
+	$customer_args = array('user_id' => 0);
421 421
 
422
-	if ( $customer->update( $customer_args ) ) {
422
+	if ($customer->update($customer_args)) {
423 423
 		global $wpdb;
424 424
 
425
-		if ( ! empty( $customer->payment_ids ) ) {
426
-			$wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" );
425
+		if ( ! empty($customer->payment_ids)) {
426
+			$wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )");
427 427
 		}
428 428
 
429 429
 		$output['success'] = true;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	} else {
432 432
 
433 433
 		$output['success'] = false;
434
-		give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) );
434
+		give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give'));
435 435
 	}
436 436
 
437 437
 	/**
@@ -441,11 +441,11 @@  discard block
 block discarded – undo
441 441
 	 *
442 442
 	 * @param int $customer_id The ID of the customer.
443 443
 	 */
444
-	do_action( 'give_post_customer_disconnect_user_id', $customer_id );
444
+	do_action('give_post_customer_disconnect_user_id', $customer_id);
445 445
 
446
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
447
-		header( 'Content-Type: application/json' );
448
-		echo json_encode( $output );
446
+	if (defined('DOING_AJAX') && DOING_AJAX) {
447
+		header('Content-Type: application/json');
448
+		echo json_encode($output);
449 449
 		wp_die();
450 450
 	}
451 451
 
@@ -453,4 +453,4 @@  discard block
 block discarded – undo
453 453
 
454 454
 }
455 455
 
456
-add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 );
456
+add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1);
Please login to merge, or discard this patch.
includes/admin/customers/customers.php 2 patches
Spacing   +141 added lines, -141 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,9 +24,9 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function give_customers_page() {
26 26
 	$default_views  = give_customer_views();
27
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'customers';
28
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
29
-		give_render_customer_view( $requested_view, $default_views );
27
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'customers';
28
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
29
+		give_render_customer_view($requested_view, $default_views);
30 30
 	} else {
31 31
 		give_customers_list();
32 32
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 	$views = array();
44 44
 
45
-	return apply_filters( 'give_customer_views', $views );
45
+	return apply_filters('give_customer_views', $views);
46 46
 
47 47
 }
48 48
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 	$tabs = array();
58 58
 
59
-	return apply_filters( 'give_customer_tabs', $tabs );
59
+	return apply_filters('give_customer_tabs', $tabs);
60 60
 
61 61
 }
62 62
 
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
  * @return void
68 68
  */
69 69
 function give_customers_list() {
70
-	include( dirname( __FILE__ ) . '/class-customer-table.php' );
70
+	include(dirname(__FILE__).'/class-customer-table.php');
71 71
 
72 72
 	$customers_table = new Give_Customer_Reports_Table();
73 73
 	$customers_table->prepare_items();
74 74
 	?>
75 75
 	<div class="wrap">
76
-		<h1><?php esc_html_e( 'Donors', 'give' ); ?></h1>
76
+		<h1><?php esc_html_e('Donors', 'give'); ?></h1>
77 77
 		<?php
78 78
 		/**
79 79
 		 * Fires in donors screen, above the table.
80 80
 		 *
81 81
 		 * @since 1.0
82 82
 		 */
83
-		do_action( 'give_donors_table_top' );
83
+		do_action('give_donors_table_top');
84 84
 		?>
85
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
85
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
86 86
 			<?php
87
-			$customers_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' );
87
+			$customers_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors');
88 88
 			$customers_table->display();
89 89
 			?>
90 90
 			<input type="hidden" name="post_type" value="give_forms" />
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		 *
98 98
 		 * @since 1.0
99 99
 		 */
100
-		do_action( 'give_donors_table_bottom' );
100
+		do_action('give_donors_table_bottom');
101 101
 		?>
102 102
 	</div>
103 103
 	<?php
@@ -113,27 +113,27 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return void
115 115
  */
116
-function give_render_customer_view( $view, $callbacks ) {
116
+function give_render_customer_view($view, $callbacks) {
117 117
 
118 118
 	$render = true;
119 119
 
120
-	$customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' );
120
+	$customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports');
121 121
 
122
-	if ( ! current_user_can( $customer_view_role ) ) {
123
-		give_set_error( 'give-no-access', esc_html__( 'You are not permitted to view this data.', 'give' ) );
122
+	if ( ! current_user_can($customer_view_role)) {
123
+		give_set_error('give-no-access', esc_html__('You are not permitted to view this data.', 'give'));
124 124
 		$render = false;
125 125
 	}
126 126
  
127
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
128
-		give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) );
127
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
128
+		give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give'));
129 129
 		$render = false;
130 130
 	}
131 131
 
132 132
 	$customer_id = (int) $_GET['id'];
133
-	$customer    = new Give_Customer( $customer_id );
133
+	$customer    = new Give_Customer($customer_id);
134 134
 
135
-	if ( empty( $customer->id ) ) {
136
-		give_set_error( 'give-invalid_customer', esc_html__( 'Invalid Donor ID.', 'give' ) );
135
+	if (empty($customer->id)) {
136
+		give_set_error('give-invalid_customer', esc_html__('Invalid Donor ID.', 'give'));
137 137
 		$render = false;
138 138
 	}
139 139
 
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 
143 143
 	<div class='wrap'>
144 144
 
145
-		<?php if ( give_get_errors() ) : ?>
145
+		<?php if (give_get_errors()) : ?>
146 146
 			<div class="error settings-error">
147
-				<?php give_print_errors( 0 ); ?>
147
+				<?php give_print_errors(0); ?>
148 148
 			</div>
149 149
 		<?php endif; ?>
150 150
 
151
-		<?php if ( $customer && $render ) : ?>
151
+		<?php if ($customer && $render) : ?>
152 152
 
153 153
 			<div id="customer-tab-wrapper">
154 154
 				<ul id="customer-tab-wrapper-list" class="nav-tab-wrapper">
155
-					<?php foreach ( $customer_tabs as $key => $tab ) : ?>
155
+					<?php foreach ($customer_tabs as $key => $tab) : ?>
156 156
 						<?php $active = $key === $view ? true : false; ?>
157 157
 						<?php $class = $active ? 'active' : 'inactive'; ?>
158 158
 
159
-						<li class="<?php echo sanitize_html_class( $class ); ?>">
160
-							<?php if ( ! $active ) : ?>
161
-							<a aria-label="<?php esc_attr_e( $tab['title'] ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $customer->id ) ); ?>">
159
+						<li class="<?php echo sanitize_html_class($class); ?>">
160
+							<?php if ( ! $active) : ?>
161
+							<a aria-label="<?php esc_attr_e($tab['title']); ?>" href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$customer->id)); ?>">
162 162
 								<?php endif; ?>
163 163
 
164
-								<span class="dashicons <?php echo sanitize_html_class( $tab['dashicon'] ); ?>"></span> <?php esc_html_e( $tab['title'] ); ?>
165
-								<?php if ( ! $active ) : ?>
164
+								<span class="dashicons <?php echo sanitize_html_class($tab['dashicon']); ?>"></span> <?php esc_html_e($tab['title']); ?>
165
+								<?php if ( ! $active) : ?>
166 166
 							</a>
167 167
 						<?php endif; ?>
168 168
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 			</div>
175 175
 
176 176
 			<div id="give-customer-card-wrapper">
177
-				<?php $callbacks[ $view ]( $customer ) ?>
177
+				<?php $callbacks[$view]($customer) ?>
178 178
 			</div>
179 179
 
180 180
 		<?php endif; ?>
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return void
196 196
  */
197
-function give_customers_view( $customer ) {
197
+function give_customers_view($customer) {
198 198
 
199
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
199
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
200 200
 
201 201
 	/**
202 202
 	 * Fires in donor profile screen, above the donor card.
@@ -205,32 +205,32 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @param object $customer The customer object being displayed.
207 207
 	 */
208
-	do_action( 'give_donor_card_top', $customer );
208
+	do_action('give_donor_card_top', $customer);
209 209
 	?>
210 210
 
211 211
 	<div id="donor-summary" class="info-wrapper customer-section postbox">
212 212
 
213
-		<form id="edit-customer-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>">
213
+		<form id="edit-customer-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>">
214 214
 
215 215
 			<div class="customer-info">
216 216
 
217 217
 				<div class="donor-bio-header clearfix">
218 218
 
219 219
 					<div class="avatar-wrap left" id="customer-avatar">
220
-						<?php echo get_avatar( $customer->email ); ?>
220
+						<?php echo get_avatar($customer->email); ?>
221 221
 					</div>
222 222
 
223 223
 					<div id="customer-name-wrap" class="left">
224 224
 						<span class="customer-id">#<?php echo $customer->id; ?></span>
225
-						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e( $customer->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span>
225
+						<span class="customer-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php esc_attr_e($customer->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span>
226 226
 						<span class="customer-name info-item editable"><span data-key="name"><?php echo $customer->name; ?></span></span>
227 227
 					</div>
228 228
 					<p class="customer-since info-item">
229
-						<?php esc_html_e( 'Donor since', 'give' ); ?>
230
-						<?php echo date_i18n( get_option( 'date_format' ), strtotime( $customer->date_created ) ) ?>
229
+						<?php esc_html_e('Donor since', 'give'); ?>
230
+						<?php echo date_i18n(get_option('date_format'), strtotime($customer->date_created)) ?>
231 231
 					</p>
232
-					<?php if ( current_user_can( $customer_edit_role ) ): ?>
233
-						<a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a>
232
+					<?php if (current_user_can($customer_edit_role)): ?>
233
+						<a href="#" id="edit-customer" class="button info-item editable customer-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a>
234 234
 					<?php endif; ?>
235 235
 				</div>
236 236
 				<!-- /donor-bio-header -->
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
 					<table class="widefat">
241 241
 						<tbody>
242 242
 						<tr>
243
-							<td><label for="tablecell"><?php esc_html_e( 'Email', 'give' ); ?></label>:</td>
243
+							<td><label for="tablecell"><?php esc_html_e('Email', 'give'); ?></label>:</td>
244 244
 							<td class="row-title">
245
-								<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php esc_attr_e( 'Donor Email', 'give' ); ?>" /></span>
245
+								<span class="customer-name info-item edit-item"><input size="20" data-key="email" name="customerinfo[email]" type="text" value="<?php echo $customer->email; ?>" placeholder="<?php esc_attr_e('Donor Email', 'give'); ?>" /></span>
246 246
 								<span class="customer-email info-item editable" data-key="email"><?php echo $customer->email; ?></span>
247 247
 							</td>
248 248
 						</tr>
249 249
 						<tr class="alternate">
250
-							<td><label for="tablecell"><?php esc_html_e( 'User ID', 'give' ); ?></label>:</td>
250
+							<td><label for="tablecell"><?php esc_html_e('User ID', 'give'); ?></label>:</td>
251 251
 							<td class="row-title">
252 252
 								<span class="customer-user-id info-item edit-item">
253 253
 									<?php
@@ -263,38 +263,38 @@  discard block
 block discarded – undo
263 263
 										'data'  => $data_atts,
264 264
 									);
265 265
 
266
-									if ( ! empty( $user_id ) ) {
267
-										$userdata           = get_userdata( $user_id );
266
+									if ( ! empty($user_id)) {
267
+										$userdata           = get_userdata($user_id);
268 268
 										$user_args['value'] = $userdata->user_login;
269 269
 									}
270 270
 
271
-									echo Give()->html->ajax_user_search( $user_args );
271
+									echo Give()->html->ajax_user_search($user_args);
272 272
 									?>
273 273
 									<input type="hidden" name="customerinfo[user_id]" data-key="user_id" value="<?php echo $customer->user_id; ?>" />
274 274
 								</span>
275 275
 			
276 276
 								<span class="customer-user-id info-item editable">
277
-									<?php if ( intval( $customer->user_id ) > 0 ) : ?>
277
+									<?php if (intval($customer->user_id) > 0) : ?>
278 278
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
279 279
 									<?php else : ?>
280
-										<span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span>
280
+										<span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span>
281 281
 									<?php endif; ?>
282
-									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?>
283
-										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span>
282
+									<?php if (current_user_can($customer_edit_role) && intval($customer->user_id) > 0) : ?>
283
+										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e('Disconnects the current user ID from this customer record', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span>
284 284
 									<?php endif; ?>
285 285
 								</span>
286 286
 							</td>
287 287
 						</tr>
288
-						<?php if ( isset( $customer->user_id ) && $customer->user_id > 0 ) : ?>
288
+						<?php if (isset($customer->user_id) && $customer->user_id > 0) : ?>
289 289
 
290 290
 							<tr>
291
-								<td><?php esc_html_e( 'Address:', 'give' ); ?></td>
291
+								<td><?php esc_html_e('Address:', 'give'); ?></td>
292 292
 								<td class="row-title">
293 293
 
294 294
 									<div class="customer-address-wrapper">
295 295
 
296 296
 										<?php
297
-										$address  = get_user_meta( $customer->user_id, '_give_user_address', true );
297
+										$address  = get_user_meta($customer->user_id, '_give_user_address', true);
298 298
 										$defaults = array(
299 299
 											'line1'   => '',
300 300
 											'line2'   => '',
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 											'zip'     => ''
305 305
 										);
306 306
 
307
-										$address = wp_parse_args( $address, $defaults );
307
+										$address = wp_parse_args($address, $defaults);
308 308
 										?>
309 309
 
310
-										<?php if ( ! empty( $address ) ) { ?>
310
+										<?php if ( ! empty($address)) { ?>
311 311
 											<span class="customer-address info-item editable">
312 312
 												<span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span>
313 313
 												<span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span>
@@ -318,38 +318,38 @@  discard block
 block discarded – undo
318 318
 											</span>
319 319
 										<?php } ?>
320 320
 										<span class="customer-address info-item edit-item">
321
-											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" />
322
-											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" />
323
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
321
+											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" />
322
+											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" />
323
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" />
324 324
 											<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item">
325 325
 												<?php
326 326
 
327 327
 												$selected_country = $address['country'];
328 328
 
329 329
 												$countries = give_get_country_list();
330
-												foreach ( $countries as $country_code => $country ) {
331
-													echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
330
+												foreach ($countries as $country_code => $country) {
331
+													echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
332 332
 												}
333 333
 												?>
334 334
 											</select>
335 335
 											<?php
336 336
 											$selected_state = give_get_state();
337
-											$states         = give_get_states( $selected_country );
337
+											$states         = give_get_states($selected_country);
338 338
 
339
-											$selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state;
339
+											$selected_state = isset($address['state']) ? $address['state'] : $selected_state;
340 340
 
341
-											if ( ! empty( $states ) ) : ?>
341
+											if ( ! empty($states)) : ?>
342 342
 												<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item">
343 343
 													<?php
344
-													foreach ( $states as $state_code => $state ) {
345
-														echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
344
+													foreach ($states as $state_code => $state) {
345
+														echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
346 346
 													}
347 347
 													?>
348 348
 												</select>
349 349
 											<?php else : ?>
350
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" />
350
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province', 'give'); ?>" />
351 351
 											<?php endif; ?>
352
-											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
352
+											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" />
353 353
 													</span>
354 354
 
355 355
 									</div>
@@ -366,10 +366,10 @@  discard block
 block discarded – undo
366 366
 
367 367
 			<span id="customer-edit-actions" class="edit-item">
368 368
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $customer->id; ?>" />
369
-				<?php wp_nonce_field( 'edit-customer', '_wpnonce', false, true ); ?>
369
+				<?php wp_nonce_field('edit-customer', '_wpnonce', false, true); ?>
370 370
 				<input type="hidden" name="give_action" value="edit-customer" />
371
-				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" />
372
-				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
371
+				<input type="submit" id="give-edit-customer-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" />
372
+				<a id="give-edit-customer-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
373 373
 			</span>
374 374
 
375 375
 		</form>
@@ -384,24 +384,24 @@  discard block
 block discarded – undo
384 384
 	 *
385 385
 	 * @param object $customer The customer object being displayed.
386 386
 	 */
387
-	do_action( 'give_donor_before_stats', $customer );
387
+	do_action('give_donor_before_stats', $customer);
388 388
 	?>
389 389
 
390 390
 	<div id="customer-stats-wrapper" class="customer-section postbox clear">
391 391
 		<ul>
392 392
 			<li>
393
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $customer->email ) ); ?>">
393
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($customer->email)); ?>">
394 394
 					<span class="dashicons dashicons-heart"></span>
395 395
 					<?php
396 396
 					//Completed Donations
397
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give' ), $customer->purchase_count );
398
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $customer );
397
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $customer->purchase_count, 'give'), $customer->purchase_count);
398
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $customer);
399 399
 					?>
400 400
 				</a>
401 401
 			</li>
402 402
 			<li>
403 403
 				<span class="dashicons dashicons-chart-area"></span>
404
-				<?php echo give_currency_filter( give_format_amount( $customer->purchase_value ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?>
404
+				<?php echo give_currency_filter(give_format_amount($customer->purchase_value)); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?>
405 405
 			</li>
406 406
 			<?php
407 407
 			/**
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			 *
414 414
 			 * @param object $customer The customer object being displayed.
415 415
 			 */
416
-			do_action( 'give_donor_stats_list', $customer );
416
+			do_action('give_donor_stats_list', $customer);
417 417
 			?>
418 418
 		</ul>
419 419
 	</div>
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 *
427 427
 	 * @param object $customer The customer object being displayed.
428 428
 	 */
429
-	do_action( 'give_donor_before_tables_wrapper', $customer );
429
+	do_action('give_donor_before_tables_wrapper', $customer);
430 430
 	?>
431 431
 
432 432
 	<div id="customer-tables-wrapper" class="customer-section">
@@ -439,36 +439,36 @@  discard block
 block discarded – undo
439 439
 		 *
440 440
 		 * @param object $customer The customer object being displayed.
441 441
 		 */
442
-		do_action( 'give_donor_before_tables', $customer );
442
+		do_action('give_donor_before_tables', $customer);
443 443
 		?>
444 444
 
445
-		<h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3>
445
+		<h3><?php esc_html_e('Recent Donations', 'give'); ?></h3>
446 446
 		<?php
447
-		$payment_ids = explode( ',', $customer->payment_ids );
448
-		$payments    = give_get_payments( array( 'post__in' => $payment_ids ) );
449
-		$payments    = array_slice( $payments, 0, 10 );
447
+		$payment_ids = explode(',', $customer->payment_ids);
448
+		$payments    = give_get_payments(array('post__in' => $payment_ids));
449
+		$payments    = array_slice($payments, 0, 10);
450 450
 		?>
451 451
 		<table class="wp-list-table widefat striped payments">
452 452
 			<thead>
453 453
 			<tr>
454
-				<th><?php esc_html_e( 'ID', 'give' ); ?></th>
455
-				<th><?php esc_html_e( 'Amount', 'give' ); ?></th>
456
-				<th><?php esc_html_e( 'Date', 'give' ); ?></th>
457
-				<th><?php esc_html_e( 'Status', 'give' ); ?></th>
458
-				<th><?php esc_html_e( 'Actions', 'give' ); ?></th>
454
+				<th><?php esc_html_e('ID', 'give'); ?></th>
455
+				<th><?php esc_html_e('Amount', 'give'); ?></th>
456
+				<th><?php esc_html_e('Date', 'give'); ?></th>
457
+				<th><?php esc_html_e('Status', 'give'); ?></th>
458
+				<th><?php esc_html_e('Actions', 'give'); ?></th>
459 459
 			</tr>
460 460
 			</thead>
461 461
 			<tbody>
462
-			<?php if ( ! empty( $payments ) ) : ?>
463
-				<?php foreach ( $payments as $payment ) : ?>
462
+			<?php if ( ! empty($payments)) : ?>
463
+				<?php foreach ($payments as $payment) : ?>
464 464
 					<tr>
465 465
 						<td><?php echo $payment->ID; ?></td>
466
-						<td><?php echo give_payment_amount( $payment->ID ); ?></td>
467
-						<td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $payment->post_date ) ); ?></td>
468
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
466
+						<td><?php echo give_payment_amount($payment->ID); ?></td>
467
+						<td><?php echo date_i18n(get_option('date_format'), strtotime($payment->post_date)); ?></td>
468
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
469 469
 						<td>
470
-							<a title="<?php sprintf( esc_attr_e( 'View Details for Donation %s', 'give' ), $payment->ID ); ?>" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment->ID ); ?>">
471
-								<?php esc_html_e( 'View Details', 'give' ); ?>
470
+							<a title="<?php sprintf(esc_attr_e('View Details for Donation %s', 'give'), $payment->ID); ?>" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment->ID); ?>">
471
+								<?php esc_html_e('View Details', 'give'); ?>
472 472
 							</a>
473 473
 							<?php
474 474
 							/**
@@ -481,47 +481,47 @@  discard block
 block discarded – undo
481 481
 							 * @param object $customer The customer object being displayed.
482 482
 							 * @param object $payment  The payment object being displayed.
483 483
 							 */
484
-							do_action( 'give_donor_recent_purchases_actions', $customer, $payment );
484
+							do_action('give_donor_recent_purchases_actions', $customer, $payment);
485 485
 							?>
486 486
 						</td>
487 487
 					</tr>
488 488
 				<?php endforeach; ?>
489 489
 			<?php else: ?>
490 490
 				<tr>
491
-					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td>
491
+					<td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td>
492 492
 				</tr>
493 493
 			<?php endif; ?>
494 494
 			</tbody>
495 495
 		</table>
496 496
 
497
-		<h3><?php esc_html_e( 'Completed Donations', 'give' ); ?></h3>
497
+		<h3><?php esc_html_e('Completed Donations', 'give'); ?></h3>
498 498
 		<?php
499
-		$donations = give_get_users_completed_donations( $customer->email );
499
+		$donations = give_get_users_completed_donations($customer->email);
500 500
 		?>
501 501
 		<table class="wp-list-table widefat striped donations">
502 502
 			<thead>
503 503
 			<tr>
504 504
 				<th><?php echo give_get_forms_label_singular(); ?></th>
505
-				<th width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th>
505
+				<th width="120px"><?php esc_html_e('Actions', 'give'); ?></th>
506 506
 			</tr>
507 507
 			</thead>
508 508
 			<tbody>
509
-			<?php if ( ! empty( $donations ) ) : ?>
510
-				<?php foreach ( $donations as $donation ) : ?>
509
+			<?php if ( ! empty($donations)) : ?>
510
+				<?php foreach ($donations as $donation) : ?>
511 511
 					<tr>
512 512
 						<td><?php echo $donation->post_title; ?></td>
513 513
 						<td>
514 514
 							<a title="<?php
515 515
 								printf(
516 516
 									/* translators: %s: post title */
517
-									esc_attr__( 'View %s', 'give' ),
517
+									esc_attr__('View %s', 'give'),
518 518
 									$donation->post_title
519
-								); ?>" href="<?php echo esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) );
519
+								); ?>" href="<?php echo esc_url(admin_url('post.php?action=edit&post='.$donation->ID));
520 520
 							?>">
521 521
 								<?php
522 522
 									printf(
523 523
 										/* translators: %s: forms singular label */
524
-										esc_html__( 'View %s', 'give' ),
524
+										esc_html__('View %s', 'give'),
525 525
 										give_get_forms_label_singular()
526 526
 									);
527 527
 								?>
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 				<?php endforeach; ?>
532 532
 			<?php else: ?>
533 533
 				<tr>
534
-					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td>
534
+					<td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td>
535 535
 				</tr>
536 536
 			<?php endif; ?>
537 537
 			</tbody>
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 		 *
546 546
 		 * @param object $customer The customer object being displayed.
547 547
 		 */
548
-		do_action( 'give_donor_after_tables', $customer );
548
+		do_action('give_donor_after_tables', $customer);
549 549
 		?>
550 550
 
551 551
 	</div>
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 *
559 559
 	 * @param object $customer The customer object being displayed.
560 560
 	 */
561
-	do_action( 'give_donor_card_bottom', $customer );
561
+	do_action('give_donor_card_bottom', $customer);
562 562
 
563 563
 }
564 564
 
@@ -571,30 +571,30 @@  discard block
 block discarded – undo
571 571
  *
572 572
  * @return void
573 573
  */
574
-function give_customer_notes_view( $customer ) {
574
+function give_customer_notes_view($customer) {
575 575
 
576
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
577
-	$paged          = absint( $paged );
576
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
577
+	$paged          = absint($paged);
578 578
 	$note_count     = $customer->get_notes_count();
579
-	$per_page       = apply_filters( 'give_customer_notes_per_page', 20 );
580
-	$total_pages    = ceil( $note_count / $per_page );
581
-	$customer_notes = $customer->get_notes( $per_page, $paged );
579
+	$per_page       = apply_filters('give_customer_notes_per_page', 20);
580
+	$total_pages    = ceil($note_count / $per_page);
581
+	$customer_notes = $customer->get_notes($per_page, $paged);
582 582
 	?>
583 583
 
584 584
 	<div id="customer-notes-wrapper">
585 585
 		<div class="customer-notes-header">
586
-			<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
586
+			<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
587 587
 		</div>
588
-		<h3><?php esc_html_e( 'Notes', 'give' ); ?></h3>
588
+		<h3><?php esc_html_e('Notes', 'give'); ?></h3>
589 589
 
590
-		<?php if ( 1 == $paged ) : ?>
590
+		<?php if (1 == $paged) : ?>
591 591
 			<div style="display: block; margin-bottom: 55px;">
592
-				<form id="give-add-customer-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $customer->id ); ?>">
592
+				<form id="give-add-customer-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$customer->id); ?>">
593 593
 					<textarea id="customer-note" name="customer_note" class="customer-note-input" rows="10"></textarea>
594 594
 					<br />
595 595
 					<input type="hidden" id="customer-id" name="customer_id" value="<?php echo $customer->id; ?>" />
596 596
 					<input type="hidden" name="give_action" value="add-customer-note" />
597
-					<?php wp_nonce_field( 'add-customer-note', 'add_customer_note_nonce', true, true ); ?>
597
+					<?php wp_nonce_field('add-customer-note', 'add_customer_note_nonce', true, true); ?>
598 598
 					<input id="add-customer-note" class="right button-primary" type="submit" value="Add Note" />
599 599
 				</form>
600 600
 			</div>
@@ -609,26 +609,26 @@  discard block
 block discarded – undo
609 609
 			'show_all' => true
610 610
 		);
611 611
 
612
-		echo paginate_links( $pagination_args );
612
+		echo paginate_links($pagination_args);
613 613
 		?>
614 614
 
615 615
 		<div id="give-customer-notes" class="postbox">
616
-			<?php if ( count( $customer_notes ) > 0 ) : ?>
617
-				<?php foreach ( $customer_notes as $key => $note ) : ?>
616
+			<?php if (count($customer_notes) > 0) : ?>
617
+				<?php foreach ($customer_notes as $key => $note) : ?>
618 618
 					<div class="customer-note-wrapper dashboard-comment-wrap comment-item">
619 619
 					<span class="note-content-wrap">
620
-						<?php echo stripslashes( $note ); ?>
620
+						<?php echo stripslashes($note); ?>
621 621
 					</span>
622 622
 					</div>
623 623
 				<?php endforeach; ?>
624 624
 			<?php else: ?>
625 625
 				<div class="give-no-customer-notes">
626
-					<?php esc_html_e( 'No donor notes found.', 'give' ); ?>
626
+					<?php esc_html_e('No donor notes found.', 'give'); ?>
627 627
 				</div>
628 628
 			<?php endif; ?>
629 629
 		</div>
630 630
 
631
-		<?php echo paginate_links( $pagination_args ); ?>
631
+		<?php echo paginate_links($pagination_args); ?>
632 632
 
633 633
 	</div>
634 634
 
@@ -644,9 +644,9 @@  discard block
 block discarded – undo
644 644
  *
645 645
  * @return void
646 646
  */
647
-function give_customers_delete_view( $customer ) {
647
+function give_customers_delete_view($customer) {
648 648
 
649
-	$customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' );
649
+	$customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments');
650 650
 
651 651
 	/**
652 652
 	 * Fires in donor delete screen, above the content.
@@ -655,15 +655,15 @@  discard block
 block discarded – undo
655 655
 	 *
656 656
 	 * @param object $customer The customer object being displayed.
657 657
 	 */
658
-	do_action( 'give_customer_delete_top', $customer );
658
+	do_action('give_customer_delete_top', $customer);
659 659
 	?>
660 660
 
661 661
 	<div class="info-wrapper customer-section">
662 662
 
663
-		<form id="delete-customer" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer->id ); ?>">
663
+		<form id="delete-customer" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer->id); ?>">
664 664
 
665 665
 			<div class="customer-notes-header">
666
-				<?php echo get_avatar( $customer->email, 30 ); ?> <span><?php echo $customer->name; ?></span>
666
+				<?php echo get_avatar($customer->email, 30); ?> <span><?php echo $customer->name; ?></span>
667 667
 			</div>
668 668
 
669 669
 
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 
672 672
 				<span class="delete-customer-options">
673 673
 					<p>
674
-						<?php echo Give()->html->checkbox( array( 'name' => 'give-customer-delete-confirm' ) ); ?>
675
-						<label for="give-customer-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
674
+						<?php echo Give()->html->checkbox(array('name' => 'give-customer-delete-confirm')); ?>
675
+						<label for="give-customer-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label>
676 676
 					</p>
677 677
 
678 678
 					<p>
679
-						<?php echo Give()->html->checkbox( array(
679
+						<?php echo Give()->html->checkbox(array(
680 680
 							'name'    => 'give-customer-delete-records',
681
-							'options' => array( 'disabled' => true )
682
-						) ); ?>
683
-						<label for="give-customer-delete-records"><?php esc_html_e( 'Delete all associated payments and records?', 'give' ); ?></label>
681
+							'options' => array('disabled' => true)
682
+						)); ?>
683
+						<label for="give-customer-delete-records"><?php esc_html_e('Delete all associated payments and records?', 'give'); ?></label>
684 684
 					</p>
685 685
 
686 686
 					<?php
@@ -693,16 +693,16 @@  discard block
 block discarded – undo
693 693
 					 *
694 694
 					 * @param object $customer The customer object being displayed.
695 695
 					 */
696
-					do_action( 'give_customer_delete_inputs', $customer );
696
+					do_action('give_customer_delete_inputs', $customer);
697 697
 					?>
698 698
 				</span>
699 699
 
700 700
 				<span id="customer-edit-actions">
701 701
 					<input type="hidden" name="customer_id" value="<?php echo $customer->id; ?>" />
702
-					<?php wp_nonce_field( 'delete-customer', '_wpnonce', false, true ); ?>
702
+					<?php wp_nonce_field('delete-customer', '_wpnonce', false, true); ?>
703 703
 					<input type="hidden" name="give_action" value="delete-customer" />
704
-					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" />
705
-					<a id="give-delete-customer-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
704
+					<input type="submit" disabled="disabled" id="give-delete-customer" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" />
705
+					<a id="give-delete-customer-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
706 706
 				</span>
707 707
 
708 708
 			</div>
@@ -718,5 +718,5 @@  discard block
 block discarded – undo
718 718
 	 *
719 719
 	 * @param object $customer The customer object being displayed.
720 720
 	 */
721
-	do_action( 'give_customer_delete_bottom', $customer );
721
+	do_action('give_customer_delete_bottom', $customer);
722 722
 }
Please login to merge, or discard this patch.
Braces   +25 added lines, -10 removed lines patch added patch discarded remove patch
@@ -276,8 +276,11 @@  discard block
 block discarded – undo
276 276
 								<span class="customer-user-id info-item editable">
277 277
 									<?php if ( intval( $customer->user_id ) > 0 ) : ?>
278 278
 										<span data-key="user_id"><?php echo $customer->user_id; ?></span>
279
-									<?php else : ?>
280
-										<span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span>
279
+									<?php else {
280
+	: ?>
281
+										<span data-key="user_id"><?php esc_html_e( 'None', 'give' );
282
+}
283
+?></span>
281 284
 									<?php endif; ?>
282 285
 									<?php if ( current_user_can( $customer_edit_role ) && intval( $customer->user_id ) > 0 ) : ?>
283 286
 										<span class="disconnect-user"> - <a id="disconnect-customer" href="#disconnect" title="<?php esc_attr_e( 'Disconnects the current user ID from this customer record', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span>
@@ -346,8 +349,11 @@  discard block
 block discarded – undo
346 349
 													}
347 350
 													?>
348 351
 												</select>
349
-											<?php else : ?>
350
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>" />
352
+											<?php else {
353
+	: ?>
354
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province', 'give' );
355
+}
356
+?>" />
351 357
 											<?php endif; ?>
352 358
 											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
353 359
 													</span>
@@ -486,9 +492,12 @@  discard block
 block discarded – undo
486 492
 						</td>
487 493
 					</tr>
488 494
 				<?php endforeach; ?>
489
-			<?php else: ?>
495
+			<?php else {
496
+	: ?>
490 497
 				<tr>
491
-					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td>
498
+					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' );
499
+}
500
+?></td>
492 501
 				</tr>
493 502
 			<?php endif; ?>
494 503
 			</tbody>
@@ -529,9 +538,12 @@  discard block
 block discarded – undo
529 538
 						</td>
530 539
 					</tr>
531 540
 				<?php endforeach; ?>
532
-			<?php else: ?>
541
+			<?php else {
542
+	: ?>
533 543
 				<tr>
534
-					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td>
544
+					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' );
545
+}
546
+?></td>
535 547
 				</tr>
536 548
 			<?php endif; ?>
537 549
 			</tbody>
@@ -621,9 +633,12 @@  discard block
 block discarded – undo
621 633
 					</span>
622 634
 					</div>
623 635
 				<?php endforeach; ?>
624
-			<?php else: ?>
636
+			<?php else {
637
+	: ?>
625 638
 				<div class="give-no-customer-notes">
626
-					<?php esc_html_e( 'No donor notes found.', 'give' ); ?>
639
+					<?php esc_html_e( 'No donor notes found.', 'give' );
640
+}
641
+?>
627 642
 				</div>
628 643
 			<?php endif; ?>
629 644
 		</div>
Please login to merge, or discard this patch.
includes/admin/class-give-settings.php 1 patch
Spacing   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -47,26 +47,26 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 	public function __construct() {
49 49
 
50
-		add_action( 'admin_init', array( $this, 'init' ) );
50
+		add_action('admin_init', array($this, 'init'));
51 51
 
52 52
 		//Customize CMB2 URL
53
-		add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) );
53
+		add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url'));
54 54
 
55 55
 		//Custom CMB2 Settings Fields
56
-		add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 );
57
-		add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 );
58
-		add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 );
59
-		add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 );
60
-		add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 );
61
-		add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 );
62
-		add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 );
63
-		add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 );
64
-		add_action( 'admin_notices', array( $this, 'settings_notices' ) );
56
+		add_action('cmb2_render_give_title', 'give_title_callback', 10, 5);
57
+		add_action('cmb2_render_give_description', 'give_description_callback', 10, 5);
58
+		add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5);
59
+		add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5);
60
+		add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5);
61
+		add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5);
62
+		add_action('cmb2_render_api', 'give_api_callback', 10, 5);
63
+		add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5);
64
+		add_action('admin_notices', array($this, 'settings_notices'));
65 65
 
66 66
 		// Include CMB CSS in the head to avoid FOUC
67
-		add_action( 'admin_print_styles-give_forms_page_give-settings', array( 'CMB2_hookup', 'enqueue_cmb_css' ) );
67
+		add_action('admin_print_styles-give_forms_page_give-settings', array('CMB2_hookup', 'enqueue_cmb_css'));
68 68
 
69
-		add_filter( 'cmb2_get_metabox_form_format', array( $this, 'give_modify_cmb2_form_output' ), 10, 3 );
69
+		add_filter('cmb2_get_metabox_form_format', array($this, 'give_modify_cmb2_form_output'), 10, 3);
70 70
 
71 71
 	}
72 72
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @since  1.0
78 78
 	 */
79 79
 	public function init() {
80
-		register_setting( $this->key, $this->key );
80
+		register_setting($this->key, $this->key);
81 81
 
82 82
 	}
83 83
 
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 * @return mixed
93 93
 	 */
94
-	public function give_update_cmb_meta_box_url( $url ) {
94
+	public function give_update_cmb_meta_box_url($url) {
95 95
 		//Path to Give's CMB
96
-		return GIVE_PLUGIN_URL . '/includes/libraries/cmb2';
96
+		return GIVE_PLUGIN_URL.'/includes/libraries/cmb2';
97 97
 	}
98 98
 
99 99
 
@@ -105,27 +105,27 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function give_get_settings_tabs() {
107 107
 
108
-		$settings = $this->give_settings( null );
108
+		$settings = $this->give_settings(null);
109 109
 
110 110
 		$tabs             = array();
111
-		$tabs['general']  = esc_html__( 'General', 'give' );
112
-		$tabs['gateways'] = esc_html__( 'Payment Gateways', 'give' );
113
-		$tabs['display']  = esc_html__( 'Display Options', 'give' );
114
-		$tabs['emails']   = esc_html__( 'Emails', 'give' );
111
+		$tabs['general']  = esc_html__('General', 'give');
112
+		$tabs['gateways'] = esc_html__('Payment Gateways', 'give');
113
+		$tabs['display']  = esc_html__('Display Options', 'give');
114
+		$tabs['emails']   = esc_html__('Emails', 'give');
115 115
 
116
-		if ( ! empty( $settings['addons']['fields'] ) ) {
117
-			$tabs['addons'] = esc_html__( 'Add-ons', 'give' );
116
+		if ( ! empty($settings['addons']['fields'])) {
117
+			$tabs['addons'] = esc_html__('Add-ons', 'give');
118 118
 		}
119 119
 
120
-		if ( ! empty( $settings['licenses']['fields'] ) ) {
121
-			$tabs['licenses'] = esc_html__( 'Licenses', 'give' );
120
+		if ( ! empty($settings['licenses']['fields'])) {
121
+			$tabs['licenses'] = esc_html__('Licenses', 'give');
122 122
 		}
123 123
 
124
-		$tabs['advanced']    = esc_html__( 'Advanced', 'give' );
125
-		$tabs['api']         = esc_html__( 'API', 'give' );
126
-		$tabs['system_info'] = esc_html__( 'System Info', 'give' );
124
+		$tabs['advanced']    = esc_html__('Advanced', 'give');
125
+		$tabs['api']         = esc_html__('API', 'give');
126
+		$tabs['system_info'] = esc_html__('System Info', 'give');
127 127
 
128
-		return apply_filters( 'give_settings_tabs', $tabs );
128
+		return apply_filters('give_settings_tabs', $tabs);
129 129
 	}
130 130
 
131 131
 
@@ -135,30 +135,30 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function admin_page_display() {
137 137
 
138
-		$active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general';
138
+		$active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general';
139 139
 
140 140
 		?>
141 141
 
142 142
 		<div class="wrap give_settings_page cmb2_options_page <?php echo $this->key; ?>">
143 143
 
144
-			<h1 class="screen-reader-text"><?php esc_html_e( 'Give Settings', 'give' ); ?></h1>
144
+			<h1 class="screen-reader-text"><?php esc_html_e('Give Settings', 'give'); ?></h1>
145 145
 
146 146
 			<h2 class="nav-tab-wrapper">
147 147
 				<?php
148
-				foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
148
+				foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
149 149
 
150 150
 					//Support legacy tab creation conditions based off $_GET parameter
151 151
 					//We pass the $_GET['tab'] to conditions executed later
152 152
 					$_GET['tab'] = $tab_id;
153 153
 
154
-					$tab_url = esc_url( add_query_arg( array(
154
+					$tab_url = esc_url(add_query_arg(array(
155 155
 						'settings-updated' => false,
156 156
 						'tab'              => $tab_id
157
-					) ) );
157
+					)));
158 158
 
159 159
 					$active = $active_tab == $tab_id ? ' nav-tab-active' : '';
160 160
 
161
-					echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>';
161
+					echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>';
162 162
 
163 163
 				}
164 164
 				?>
@@ -166,20 +166,20 @@  discard block
 block discarded – undo
166 166
 
167 167
 			<?php
168 168
 			//Loop through and output settings
169
-			foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) {
169
+			foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) {
170 170
 
171 171
 				//Support legacy tab creation conditions based off $_GET parameter
172 172
 				//We 'trick' the conditions into thinking this is the tab
173 173
 				$_GET['tab'] = $tab_id;
174 174
 
175
-				$tab_settings = $this->give_settings( $tab_id );
175
+				$tab_settings = $this->give_settings($tab_id);
176 176
 
177 177
 				//Pass active tab within $tab_settings so we can hide with CSS via PHP
178
-				if ( $active_tab == $tab_id ) {
178
+				if ($active_tab == $tab_id) {
179 179
 					$tab_settings['active_tab'] = true;
180 180
 				}
181 181
 
182
-				cmb2_metabox_form( $tab_settings, $this->key );
182
+				cmb2_metabox_form($tab_settings, $this->key);
183 183
 
184 184
 			} ?>
185 185
 
@@ -197,34 +197,34 @@  discard block
 block discarded – undo
197 197
 	 * @since 1.5 Modified to CSS hide non-active tabs
198 198
 	 * @since 1.0
199 199
 	 */
200
-	function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) {
200
+	function give_modify_cmb2_form_output($form_format, $object_id, $cmb) {
201 201
 
202 202
 
203
-		$pagenow = isset( $_GET['page'] ) ? $_GET['page'] : '';
203
+		$pagenow = isset($_GET['page']) ? $_GET['page'] : '';
204 204
 
205 205
 		//only modify the give settings form
206
-		if ( 'give_settings' == $object_id && $pagenow == 'give-settings' ) {
206
+		if ('give_settings' == $object_id && $pagenow == 'give-settings') {
207 207
 
208 208
 			$style = '';
209
-			if ( ! isset( $cmb->meta_box['active_tab'] ) ) {
209
+			if ( ! isset($cmb->meta_box['active_tab'])) {
210 210
 				$style = 'style="display:none;"';
211 211
 			}
212 212
 
213 213
 			//Set ID based off tab name - protects backwards compatibility
214
-			$tab_id = isset( $_GET['tab'] ) ? $_GET['tab'] : $cmb->meta_box['id'];
214
+			$tab_id = isset($_GET['tab']) ? $_GET['tab'] : $cmb->meta_box['id'];
215 215
 
216
-			$save_button = apply_filters( 'give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div>' );
216
+			$save_button = apply_filters('give_save_button_markup', '<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div>');
217 217
 
218 218
 			//Filter so some tabs won't have save settings
219
-			$no_save_button = apply_filters( 'give_settings_no_save_output', array(
219
+			$no_save_button = apply_filters('give_settings_no_save_output', array(
220 220
 				'system_info'
221
-			) );
221
+			));
222 222
 
223
-			if ( in_array( $tab_id, $no_save_button ) ) {
223
+			if (in_array($tab_id, $no_save_button)) {
224 224
 				$save_button = '';
225 225
 			}
226 226
 
227
-			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" ' . $style . ' data-tab="' . $tab_id . '"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s' . $save_button . '</form>';
227
+			$form_format = '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data" '.$style.' data-tab="'.$tab_id.'"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s'.$save_button.'</form>';
228 228
 
229 229
 		}
230 230
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 *
242 242
 	 * @return array
243 243
 	 */
244
-	public function give_settings( $active_tab ) {
244
+	public function give_settings($active_tab) {
245 245
 
246 246
 		$give_settings = array(
247 247
 			/**
@@ -249,99 +249,99 @@  discard block
 block discarded – undo
249 249
 			 */
250 250
 			'general'     => array(
251 251
 				'id'         => 'general_settings',
252
-				'give_title' => esc_html__( 'General Settings', 'give' ),
253
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
254
-				'fields'     => apply_filters( 'give_settings_general', array(
252
+				'give_title' => esc_html__('General Settings', 'give'),
253
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
254
+				'fields'     => apply_filters('give_settings_general', array(
255 255
 						array(
256
-							'name' => esc_html__( 'General Settings', 'give' ),
256
+							'name' => esc_html__('General Settings', 'give'),
257 257
 							'desc' => '',
258 258
 							'type' => 'give_title',
259 259
 							'id'   => 'give_title_general_settings_1'
260 260
 						),
261 261
 						array(
262
-							'name'    => esc_html__( 'Success Page', 'give' ),
262
+							'name'    => esc_html__('Success Page', 'give'),
263 263
 							/* translators: %s: [give_receipt] */
264
-							'desc'    => sprintf( __( 'This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
264
+							'desc'    => sprintf(__('This is the page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
265 265
 							'id'      => 'success_page',
266 266
 							'type'    => 'select',
267
-							'options' => give_cmb2_get_post_options( array(
267
+							'options' => give_cmb2_get_post_options(array(
268 268
 								'post_type'   => 'page',
269
-								'numberposts' => - 1
270
-							) ),
269
+								'numberposts' => -1
270
+							)),
271 271
 						),
272 272
 						array(
273
-							'name'    => esc_html__( 'Failed Transaction Page', 'give' ),
274
-							'desc'    => esc_html__( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ),
273
+							'name'    => esc_html__('Failed Transaction Page', 'give'),
274
+							'desc'    => esc_html__('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'),
275 275
 							'id'      => 'failure_page',
276 276
 							'type'    => 'select',
277
-							'options' => give_cmb2_get_post_options( array(
277
+							'options' => give_cmb2_get_post_options(array(
278 278
 								'post_type'   => 'page',
279
-								'numberposts' => - 1
280
-							) ),
279
+								'numberposts' => -1
280
+							)),
281 281
 						),
282 282
 						array(
283
-							'name'    => esc_html__( 'Donation History Page', 'give' ),
283
+							'name'    => esc_html__('Donation History Page', 'give'),
284 284
 							/* translators: %s: [donation_history] */
285
-							'desc'    => sprintf( __( 'This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
285
+							'desc'    => sprintf(__('This page shows a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
286 286
 							'id'      => 'history_page',
287 287
 							'type'    => 'select',
288
-							'options' => give_cmb2_get_post_options( array(
288
+							'options' => give_cmb2_get_post_options(array(
289 289
 								'post_type'   => 'page',
290
-								'numberposts' => - 1
291
-							) ),
290
+								'numberposts' => -1
291
+							)),
292 292
 						),
293 293
 						array(
294
-							'name'    => esc_html__( 'Base Country', 'give' ),
295
-							'desc'    => esc_html__( 'Where does your site operate from?', 'give' ),
294
+							'name'    => esc_html__('Base Country', 'give'),
295
+							'desc'    => esc_html__('Where does your site operate from?', 'give'),
296 296
 							'id'      => 'base_country',
297 297
 							'type'    => 'select',
298 298
 							'options' => give_get_country_list(),
299 299
 						),
300 300
 						array(
301
-							'name' => esc_html__( 'Currency Settings', 'give' ),
301
+							'name' => esc_html__('Currency Settings', 'give'),
302 302
 							'desc' => '',
303 303
 							'type' => 'give_title',
304 304
 							'id'   => 'give_title_general_settings_2'
305 305
 						),
306 306
 						array(
307
-							'name'    => esc_html__( 'Currency', 'give' ),
308
-							'desc'    => esc_html__( 'Choose your currency. Note that some payment gateways have currency restrictions.', 'give' ),
307
+							'name'    => esc_html__('Currency', 'give'),
308
+							'desc'    => esc_html__('Choose your currency. Note that some payment gateways have currency restrictions.', 'give'),
309 309
 							'id'      => 'currency',
310 310
 							'type'    => 'select',
311 311
 							'options' => give_get_currencies(),
312 312
 							'default' => 'USD',
313 313
 						),
314 314
 						array(
315
-							'name'    => esc_html__( 'Currency Position', 'give' ),
316
-							'desc'    => esc_html__( 'Choose the position of the currency sign.', 'give' ),
315
+							'name'    => esc_html__('Currency Position', 'give'),
316
+							'desc'    => esc_html__('Choose the position of the currency sign.', 'give'),
317 317
 							'id'      => 'currency_position',
318 318
 							'type'    => 'select',
319 319
 							'options' => array(
320 320
 								/* translators: %s: currency symbol */
321
-								'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ),
321
+								'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())),
322 322
 								/* translators: %s: currency symbol */
323
-								'after'  => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) )
323
+								'after'  => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency()))
324 324
 							),
325 325
 							'default' => 'before',
326 326
 						),
327 327
 						array(
328
-							'name'            => esc_html__( 'Thousands Separator', 'give' ),
329
-							'desc'            => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ),
328
+							'name'            => esc_html__('Thousands Separator', 'give'),
329
+							'desc'            => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'),
330 330
 							'id'              => 'thousands_separator',
331 331
 							'type'            => 'text_small',
332 332
 							'sanitization_cb' => 'give_sanitize_thousand_separator',
333 333
 							'default'         => ',',
334 334
 						),
335 335
 						array(
336
-							'name'    => esc_html__( 'Decimal Separator', 'give' ),
337
-							'desc'    => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
336
+							'name'    => esc_html__('Decimal Separator', 'give'),
337
+							'desc'    => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'),
338 338
 							'id'      => 'decimal_separator',
339 339
 							'type'    => 'text_small',
340 340
 							'default' => '.',
341 341
 						),
342 342
 						array(
343
-							'name'            => __( 'Number of Decimals', 'give' ),
344
-							'desc'            => __( 'This sets the number of decimal points shown in displayed prices.', 'give' ),
343
+							'name'            => __('Number of Decimals', 'give'),
344
+							'desc'            => __('This sets the number of decimal points shown in displayed prices.', 'give'),
345 345
 							'id'              => 'number_decimals',
346 346
 							'type'            => 'text_small',
347 347
 							'default'         => 2,
@@ -355,83 +355,83 @@  discard block
 block discarded – undo
355 355
 			 */
356 356
 			'gateways'    => array(
357 357
 				'id'         => 'payment_gateways',
358
-				'give_title' => esc_html__( 'Payment Gateways', 'give' ),
359
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
360
-				'fields'     => apply_filters( 'give_settings_gateways', array(
358
+				'give_title' => esc_html__('Payment Gateways', 'give'),
359
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
360
+				'fields'     => apply_filters('give_settings_gateways', array(
361 361
 						array(
362
-							'name' => esc_html__( 'Gateways Settings', 'give' ),
362
+							'name' => esc_html__('Gateways Settings', 'give'),
363 363
 							'desc' => '',
364 364
 							'id'   => 'give_title_gateway_settings_1',
365 365
 							'type' => 'give_title'
366 366
 						),
367 367
 						array(
368
-							'name' => esc_html__( 'Test Mode', 'give' ),
369
-							'desc' => esc_html__( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
368
+							'name' => esc_html__('Test Mode', 'give'),
369
+							'desc' => esc_html__('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
370 370
 							'id'   => 'test_mode',
371 371
 							'type' => 'checkbox'
372 372
 						),
373 373
 						array(
374
-							'name' => esc_html__( 'Enabled Gateways', 'give' ),
375
-							'desc' => esc_html__( 'Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give' ),
374
+							'name' => esc_html__('Enabled Gateways', 'give'),
375
+							'desc' => esc_html__('Choose the payment gateways you would like enabled. You can drag-and-drop payment gateways to reorder them.', 'give'),
376 376
 							'id'   => 'gateways',
377 377
 							'type' => 'enabled_gateways'
378 378
 						),
379 379
 						array(
380
-							'name' => esc_html__( 'Default Gateway', 'give' ),
381
-							'desc' => esc_html__( 'This is the gateway that will be selected by default.', 'give' ),
380
+							'name' => esc_html__('Default Gateway', 'give'),
381
+							'desc' => esc_html__('This is the gateway that will be selected by default.', 'give'),
382 382
 							'id'   => 'default_gateway',
383 383
 							'type' => 'default_gateway'
384 384
 						),
385 385
 						array(
386
-							'name' => esc_html__( 'PayPal Standard', 'give' ),
386
+							'name' => esc_html__('PayPal Standard', 'give'),
387 387
 							'desc' => '',
388 388
 							'type' => 'give_title',
389 389
 							'id'   => 'give_title_gateway_settings_2',
390 390
 						),
391 391
 						array(
392
-							'name' => esc_html__( 'PayPal Email', 'give' ),
393
-							'desc' => esc_html__( 'Enter your PayPal account\'s email.', 'give' ),
392
+							'name' => esc_html__('PayPal Email', 'give'),
393
+							'desc' => esc_html__('Enter your PayPal account\'s email.', 'give'),
394 394
 							'id'   => 'paypal_email',
395 395
 							'type' => 'text_email',
396 396
 						),
397 397
 						array(
398
-							'name' => esc_html__( 'PayPal Page Style', 'give' ),
399
-							'desc' => esc_html__( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ),
398
+							'name' => esc_html__('PayPal Page Style', 'give'),
399
+							'desc' => esc_html__('Enter the name of the page style to use, or leave blank to use the default.', 'give'),
400 400
 							'id'   => 'paypal_page_style',
401 401
 							'type' => 'text',
402 402
 						),
403 403
 						array(
404
-							'name'    => esc_html__( 'PayPal Transaction Type', 'give' ),
405
-							'desc'    => esc_html__( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
404
+							'name'    => esc_html__('PayPal Transaction Type', 'give'),
405
+							'desc'    => esc_html__('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
406 406
 							'id'      => 'paypal_button_type',
407 407
 							'type'    => 'radio_inline',
408 408
 							'options' => array(
409
-								'donation' => esc_html__( 'Donation', 'give' ),
410
-								'standard' => esc_html__( 'Standard Transaction', 'give' )
409
+								'donation' => esc_html__('Donation', 'give'),
410
+								'standard' => esc_html__('Standard Transaction', 'give')
411 411
 							),
412 412
 							'default' => 'donation',
413 413
 						),
414 414
 						array(
415
-							'name' => esc_html__( 'Disable PayPal IPN Verification', 'give' ),
416
-							'desc' => esc_html__( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ),
415
+							'name' => esc_html__('Disable PayPal IPN Verification', 'give'),
416
+							'desc' => esc_html__('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'),
417 417
 							'id'   => 'disable_paypal_verification',
418 418
 							'type' => 'checkbox'
419 419
 						),
420 420
 						array(
421
-							'name' => esc_html__( 'Offline Donations', 'give' ),
421
+							'name' => esc_html__('Offline Donations', 'give'),
422 422
 							'desc' => '',
423 423
 							'type' => 'give_title',
424 424
 							'id'   => 'give_title_gateway_settings_3',
425 425
 						),
426 426
 						array(
427
-							'name' => esc_html__( 'Collect Billing Details', 'give' ),
428
-							'desc' => esc_html__( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ),
427
+							'name' => esc_html__('Collect Billing Details', 'give'),
428
+							'desc' => esc_html__('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'),
429 429
 							'id'   => 'give_offline_donation_enable_billing_fields',
430 430
 							'type' => 'checkbox'
431 431
 						),
432 432
 						array(
433
-							'name'    => esc_html__( 'Offline Donation Instructions', 'give' ),
434
-							'desc'    => esc_html__( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
433
+							'name'    => esc_html__('Offline Donation Instructions', 'give'),
434
+							'desc'    => esc_html__('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
435 435
 							'id'      => 'global_offline_donation_content',
436 436
 							'default' => give_get_default_offline_donation_content(),
437 437
 							'type'    => 'wysiwyg',
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
 							)
441 441
 						),
442 442
 						array(
443
-							'name'    => esc_html__( 'Offline Donation Email Instructions Subject', 'give' ),
444
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
443
+							'name'    => esc_html__('Offline Donation Email Instructions Subject', 'give'),
444
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
445 445
 							'id'      => 'offline_donation_subject',
446
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
446
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
447 447
 							'type'    => 'text'
448 448
 						),
449 449
 						array(
450
-							'name'    => esc_html__( 'Offline Donation Email Instructions', 'give' ),
451
-							'desc'    => esc_html__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
450
+							'name'    => esc_html__('Offline Donation Email Instructions', 'give'),
451
+							'desc'    => esc_html__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
452 452
 							'id'      => 'global_offline_donation_email',
453 453
 							'default' => give_get_default_offline_donation_email_content(),
454 454
 							'type'    => 'wysiwyg',
@@ -462,95 +462,95 @@  discard block
 block discarded – undo
462 462
 			/** Display Settings */
463 463
 			'display'     => array(
464 464
 				'id'         => 'display_settings',
465
-				'give_title' => esc_html__( 'Display Settings', 'give' ),
466
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
467
-				'fields'     => apply_filters( 'give_settings_display', array(
465
+				'give_title' => esc_html__('Display Settings', 'give'),
466
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
467
+				'fields'     => apply_filters('give_settings_display', array(
468 468
 						array(
469
-							'name' => esc_html__( 'Display Settings', 'give' ),
469
+							'name' => esc_html__('Display Settings', 'give'),
470 470
 							'desc' => '',
471 471
 							'id'   => 'give_title_display_settings_1',
472 472
 							'type' => 'give_title'
473 473
 						),
474 474
 						array(
475
-							'name' => esc_html__( 'Disable CSS', 'give' ),
476
-							'desc' => esc_html__( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ),
475
+							'name' => esc_html__('Disable CSS', 'give'),
476
+							'desc' => esc_html__('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'),
477 477
 							'id'   => 'disable_css',
478 478
 							'type' => 'checkbox'
479 479
 						),
480 480
 						array(
481
-							'name' => esc_html__( 'Enable Floating Labels', 'give' ),
481
+							'name' => esc_html__('Enable Floating Labels', 'give'),
482 482
 							/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
483
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
483
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. <br />Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
484 484
 							'id'   => 'enable_floatlabels',
485 485
 							'type' => 'checkbox'
486 486
 						),
487 487
 						array(
488
-							'name' => esc_html__( 'Disable Welcome Screen', 'give' ),
488
+							'name' => esc_html__('Disable Welcome Screen', 'give'),
489 489
 							/* translators: %s: about page URL */
490
-							'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
490
+							'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the <a href="%s">Welcome Screen</a> if you want in the future.', 'give'), array('a' => array('href' => array()))), esc_url(admin_url('index.php?page=give-about'))),
491 491
 							'id'   => 'disable_welcome',
492 492
 							'type' => 'checkbox'
493 493
 						),
494 494
 						array(
495
-							'name' => esc_html__( 'Post Types', 'give' ),
495
+							'name' => esc_html__('Post Types', 'give'),
496 496
 							'desc' => '',
497 497
 							'id'   => 'give_title_display_settings_2',
498 498
 							'type' => 'give_title'
499 499
 						),
500 500
 						array(
501
-							'name' => esc_html__( 'Disable Form Single Views', 'give' ),
502
-							'desc' => esc_html__( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
501
+							'name' => esc_html__('Disable Form Single Views', 'give'),
502
+							'desc' => esc_html__('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
503 503
 							'id'   => 'disable_forms_singular',
504 504
 							'type' => 'checkbox'
505 505
 						),
506 506
 						array(
507
-							'name' => esc_html__( 'Disable Form Archives', 'give' ),
508
-							'desc' => esc_html__( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
507
+							'name' => esc_html__('Disable Form Archives', 'give'),
508
+							'desc' => esc_html__('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
509 509
 							'id'   => 'disable_forms_archives',
510 510
 							'type' => 'checkbox'
511 511
 						),
512 512
 						array(
513
-							'name' => esc_html__( 'Disable Form Excerpts', 'give' ),
514
-							'desc' => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
513
+							'name' => esc_html__('Disable Form Excerpts', 'give'),
514
+							'desc' => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
515 515
 							'id'   => 'disable_forms_excerpt',
516 516
 							'type' => 'checkbox'
517 517
 						),
518 518
 
519 519
 						array(
520
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
521
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give' ),
520
+							'name'    => esc_html__('Featured Image Size', 'give'),
521
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation forms\' featured image.', 'give'),
522 522
 							'id'      => 'featured_image_size',
523 523
 							'type'    => 'select',
524 524
 							'default' => 'large',
525 525
 							'options' => give_get_featured_image_sizes()
526 526
 						),
527 527
 						array(
528
-							'name' => esc_html__( 'Disable Form Featured Image', 'give' ),
529
-							'desc' => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
528
+							'name' => esc_html__('Disable Form Featured Image', 'give'),
529
+							'desc' => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
530 530
 							'id'   => 'disable_form_featured_img',
531 531
 							'type' => 'checkbox'
532 532
 						),
533 533
 						array(
534
-							'name' => esc_html__( 'Disable Single Form Sidebar', 'give' ),
535
-							'desc' => esc_html__( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
534
+							'name' => esc_html__('Disable Single Form Sidebar', 'give'),
535
+							'desc' => esc_html__('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
536 536
 							'id'   => 'disable_form_sidebar',
537 537
 							'type' => 'checkbox'
538 538
 						),
539 539
 						array(
540
-							'name' => esc_html__( 'Taxonomies', 'give' ),
540
+							'name' => esc_html__('Taxonomies', 'give'),
541 541
 							'desc' => '',
542 542
 							'id'   => 'give_title_display_settings_3',
543 543
 							'type' => 'give_title'
544 544
 						),
545 545
 						array(
546
-							'name' => esc_html__( 'Enable Form Categories', 'give' ),
547
-							'desc' => esc_html__( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ),
546
+							'name' => esc_html__('Enable Form Categories', 'give'),
547
+							'desc' => esc_html__('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'),
548 548
 							'id'   => 'enable_categories',
549 549
 							'type' => 'checkbox'
550 550
 						),
551 551
 						array(
552
-							'name' => esc_html__( 'Enable Form Tags', 'give' ),
553
-							'desc' => esc_html__( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ),
552
+							'name' => esc_html__('Enable Form Tags', 'give'),
553
+							'desc' => esc_html__('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'),
554 554
 							'id'   => 'enable_tags',
555 555
 							'type' => 'checkbox'
556 556
 						),
@@ -563,95 +563,95 @@  discard block
 block discarded – undo
563 563
 			 */
564 564
 			'emails'      => array(
565 565
 				'id'         => 'email_settings',
566
-				'give_title' => esc_html__( 'Email Settings', 'give' ),
567
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
568
-				'fields'     => apply_filters( 'give_settings_emails', array(
566
+				'give_title' => esc_html__('Email Settings', 'give'),
567
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
568
+				'fields'     => apply_filters('give_settings_emails', array(
569 569
 						array(
570
-							'name' => esc_html__( 'Email Settings', 'give' ),
570
+							'name' => esc_html__('Email Settings', 'give'),
571 571
 							'desc' => '',
572 572
 							'id'   => 'give_title_email_settings_1',
573 573
 							'type' => 'give_title'
574 574
 						),
575 575
 						array(
576 576
 							'id'      => 'email_template',
577
-							'name'    => esc_html__( 'Email Template', 'give' ),
578
-							'desc'    => esc_html__( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ),
577
+							'name'    => esc_html__('Email Template', 'give'),
578
+							'desc'    => esc_html__('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'),
579 579
 							'type'    => 'select',
580 580
 							'options' => give_get_email_templates()
581 581
 						),
582 582
 						array(
583 583
 							'id'   => 'email_logo',
584
-							'name' => esc_html__( 'Logo', 'give' ),
585
-							'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ),
584
+							'name' => esc_html__('Logo', 'give'),
585
+							'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'),
586 586
 							'type' => 'file'
587 587
 						),
588 588
 						array(
589 589
 							'id'      => 'from_name',
590
-							'name'    => esc_html__( 'From Name', 'give' ),
591
-							'desc'    => esc_html__( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ),
592
-							'default' => get_bloginfo( 'name' ),
590
+							'name'    => esc_html__('From Name', 'give'),
591
+							'desc'    => esc_html__('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'),
592
+							'default' => get_bloginfo('name'),
593 593
 							'type'    => 'text'
594 594
 						),
595 595
 						array(
596 596
 							'id'      => 'from_email',
597
-							'name'    => esc_html__( 'From Email', 'give' ),
598
-							'desc'    => esc_html__( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ),
599
-							'default' => get_bloginfo( 'admin_email' ),
597
+							'name'    => esc_html__('From Email', 'give'),
598
+							'desc'    => esc_html__('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'),
599
+							'default' => get_bloginfo('admin_email'),
600 600
 							'type'    => 'text'
601 601
 						),
602 602
 						array(
603
-							'name' => esc_html__( 'Donation Receipt', 'give' ),
603
+							'name' => esc_html__('Donation Receipt', 'give'),
604 604
 							'desc' => '',
605 605
 							'id'   => 'give_title_email_settings_2',
606 606
 							'type' => 'give_title'
607 607
 						),
608 608
 						array(
609 609
 							'id'      => 'donation_subject',
610
-							'name'    => esc_html__( 'Donation Email Subject', 'give' ),
611
-							'desc'    => esc_html__( 'Enter the subject line for the donation receipt email.', 'give' ),
612
-							'default' => esc_attr__( 'Donation Receipt', 'give' ),
610
+							'name'    => esc_html__('Donation Email Subject', 'give'),
611
+							'desc'    => esc_html__('Enter the subject line for the donation receipt email.', 'give'),
612
+							'default' => esc_attr__('Donation Receipt', 'give'),
613 613
 							'type'    => 'text'
614 614
 						),
615 615
 						array(
616 616
 							'id'      => 'donation_receipt',
617
-							'name'    => esc_html__( 'Donation Receipt', 'give' ),
617
+							'name'    => esc_html__('Donation Receipt', 'give'),
618 618
 							/* translators: %s: emails tags list */
619
-							'desc'    => sprintf( __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>',
619
+							'desc'    => sprintf(__('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>',
620 620
 							'type'    => 'wysiwyg',
621 621
 							'default' => give_get_default_donation_receipt_email()
622 622
 						),
623 623
 						array(
624
-							'name' => esc_html__( 'New Donation Notification', 'give' ),
624
+							'name' => esc_html__('New Donation Notification', 'give'),
625 625
 							'desc' => '',
626 626
 							'id'   => 'give_title_email_settings_3',
627 627
 							'type' => 'give_title'
628 628
 						),
629 629
 						array(
630 630
 							'id'      => 'donation_notification_subject',
631
-							'name'    => esc_html__( 'Donation Notification Subject', 'give' ),
632
-							'desc'    => esc_html__( 'Enter the subject line for the donation notification email.', 'give' ),
631
+							'name'    => esc_html__('Donation Notification Subject', 'give'),
632
+							'desc'    => esc_html__('Enter the subject line for the donation notification email.', 'give'),
633 633
 							'type'    => 'text',
634
-							'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' )
634
+							'default' => esc_attr__('New Donation - #{payment_id}', 'give')
635 635
 						),
636 636
 						array(
637 637
 							'id'      => 'donation_notification',
638
-							'name'    => esc_html__( 'Donation Notification', 'give' ),
638
+							'name'    => esc_html__('Donation Notification', 'give'),
639 639
 							/* translators: %s: emails tags list */
640
-							'desc'    => sprintf( __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), give_get_emails_tags_list() ) . '<br/>',
640
+							'desc'    => sprintf(__('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), give_get_emails_tags_list()).'<br/>',
641 641
 							'type'    => 'wysiwyg',
642 642
 							'default' => give_get_default_donation_notification_email()
643 643
 						),
644 644
 						array(
645 645
 							'id'      => 'admin_notice_emails',
646
-							'name'    => esc_html__( 'Donation Notification Emails', 'give' ),
647
-							'desc'    => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ),
646
+							'name'    => esc_html__('Donation Notification Emails', 'give'),
647
+							'desc'    => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'),
648 648
 							'type'    => 'textarea',
649
-							'default' => get_bloginfo( 'admin_email' )
649
+							'default' => get_bloginfo('admin_email')
650 650
 						),
651 651
 						array(
652 652
 							'id'   => 'disable_admin_notices',
653
-							'name' => esc_html__( 'Disable Admin Notifications', 'give' ),
654
-							'desc' => esc_html__( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ),
653
+							'name' => esc_html__('Disable Admin Notifications', 'give'),
654
+							'desc' => esc_html__('Check this box if you do not want to receive emails when new donations are made.', 'give'),
655 655
 							'type' => 'checkbox'
656 656
 						)
657 657
 					)
@@ -660,99 +660,99 @@  discard block
 block discarded – undo
660 660
 			/** Extension Settings */
661 661
 			'addons'      => array(
662 662
 				'id'         => 'addons',
663
-				'give_title' => esc_html__( 'Give Add-ons Settings', 'give' ),
664
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
665
-				'fields'     => apply_filters( 'give_settings_addons', array()
663
+				'give_title' => esc_html__('Give Add-ons Settings', 'give'),
664
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
665
+				'fields'     => apply_filters('give_settings_addons', array()
666 666
 				)
667 667
 			),
668 668
 			/** Licenses Settings */
669 669
 			'licenses'    => array(
670 670
 				'id'         => 'licenses',
671
-				'give_title' => esc_html__( 'Give Licenses', 'give' ),
672
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
673
-				'fields'     => apply_filters( 'give_settings_licenses', array()
671
+				'give_title' => esc_html__('Give Licenses', 'give'),
672
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
673
+				'fields'     => apply_filters('give_settings_licenses', array()
674 674
 				)
675 675
 			),
676 676
 			/** Advanced Options */
677 677
 			'advanced'    => array(
678 678
 				'id'         => 'advanced_options',
679
-				'give_title' => esc_html__( 'Advanced Options', 'give' ),
680
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
681
-				'fields'     => apply_filters( 'give_settings_advanced', array(
679
+				'give_title' => esc_html__('Advanced Options', 'give'),
680
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
681
+				'fields'     => apply_filters('give_settings_advanced', array(
682 682
 						array(
683
-							'name' => esc_html__( 'Access Control', 'give' ),
683
+							'name' => esc_html__('Access Control', 'give'),
684 684
 							'desc' => '',
685 685
 							'id'   => 'give_title_session_control_1',
686 686
 							'type' => 'give_title'
687 687
 						),
688 688
 						array(
689 689
 							'id'      => 'session_lifetime',
690
-							'name'    => esc_html__( 'Session Lifetime', 'give' ),
691
-							'desc'    => esc_html__( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give' ),
690
+							'name'    => esc_html__('Session Lifetime', 'give'),
691
+							'desc'    => esc_html__('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in as long as they are using the same browser they used when donating.', 'give'),
692 692
 							'type'    => 'select',
693 693
 							'options' => array(
694
-								'86400'  => esc_html__( '24 Hours', 'give' ),
695
-								'172800' => esc_html__( '48 Hours', 'give' ),
696
-								'259200' => esc_html__( '72 Hours', 'give' ),
697
-								'604800' => esc_html__( '1 Week', 'give' ),
694
+								'86400'  => esc_html__('24 Hours', 'give'),
695
+								'172800' => esc_html__('48 Hours', 'give'),
696
+								'259200' => esc_html__('72 Hours', 'give'),
697
+								'604800' => esc_html__('1 Week', 'give'),
698 698
 							)
699 699
 						),
700 700
 						array(
701
-							'name' => esc_html__( 'Email Access', 'give' ),
702
-							'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ),
701
+							'name' => esc_html__('Email Access', 'give'),
702
+							'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'),
703 703
 							'id'   => 'email_access',
704 704
 							'type' => 'checkbox',
705 705
 						),
706 706
 						array(
707 707
 							'id'      => 'recaptcha_key',
708
-							'name'    => esc_html__( 'reCAPTCHA Site Key', 'give' ),
708
+							'name'    => esc_html__('reCAPTCHA Site Key', 'give'),
709 709
 							/* translators: %s: https://www.google.com/recaptcha/ */
710
-							'desc'    => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ),
710
+							'desc'    => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')),
711 711
 							'default' => '',
712 712
 							'type'    => 'text'
713 713
 						),
714 714
 						array(
715 715
 							'id'      => 'recaptcha_secret',
716
-							'name'    => esc_html__( 'reCAPTCHA Secret Key', 'give' ),
717
-							'desc'    => esc_html__( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ),
716
+							'name'    => esc_html__('reCAPTCHA Secret Key', 'give'),
717
+							'desc'    => esc_html__('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'),
718 718
 							'default' => '',
719 719
 							'type'    => 'text'
720 720
 						),
721 721
 						array(
722
-							'name' => esc_html__( 'Data Control', 'give' ),
722
+							'name' => esc_html__('Data Control', 'give'),
723 723
 							'desc' => '',
724 724
 							'id'   => 'give_title_data_control_2',
725 725
 							'type' => 'give_title'
726 726
 						),
727 727
 						array(
728
-							'name' => esc_html__( 'Remove All Data on Uninstall?', 'give' ),
729
-							'desc' => esc_html__( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ),
728
+							'name' => esc_html__('Remove All Data on Uninstall?', 'give'),
729
+							'desc' => esc_html__('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'),
730 730
 							'id'   => 'uninstall_on_delete',
731 731
 							'type' => 'checkbox'
732 732
 						),
733 733
 						array(
734
-							'name' => esc_html__( 'Filter Control', 'give' ),
734
+							'name' => esc_html__('Filter Control', 'give'),
735 735
 							'desc' => '',
736 736
 							'id'   => 'give_title_filter_control',
737 737
 							'type' => 'give_title'
738 738
 						),
739 739
 						array(
740 740
 							/* translators: %s: the_content */
741
-							'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ),
741
+							'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'),
742 742
 							/* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */
743
-							'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ),
743
+							'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'),
744 744
 							'id'   => 'disable_the_content_filter',
745 745
 							'type' => 'checkbox'
746 746
 						),
747 747
 						array(
748
-							'name' => esc_html__( 'Script Loading', 'give' ),
748
+							'name' => esc_html__('Script Loading', 'give'),
749 749
 							'desc' => '',
750 750
 							'id'   => 'give_title_script_control',
751 751
 							'type' => 'give_title'
752 752
 						),
753 753
 						array(
754
-							'name' => esc_html__( 'Load Scripts in Footer?', 'give' ),
755
-							'desc' => esc_html__( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ),
754
+							'name' => esc_html__('Load Scripts in Footer?', 'give'),
755
+							'desc' => esc_html__('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'),
756 756
 							'id'   => 'scripts_footer',
757 757
 							'type' => 'checkbox'
758 758
 						)
@@ -762,13 +762,13 @@  discard block
 block discarded – undo
762 762
 			/** API Settings */
763 763
 			'api'         => array(
764 764
 				'id'         => 'api',
765
-				'give_title' => esc_html__( 'API', 'give' ),
766
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
765
+				'give_title' => esc_html__('API', 'give'),
766
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
767 767
 				'show_names' => false, // Hide field names on the left
768
-				'fields'     => apply_filters( 'give_settings_system', array(
768
+				'fields'     => apply_filters('give_settings_system', array(
769 769
 						array(
770 770
 							'id'   => 'api',
771
-							'name' => esc_html__( 'API', 'give' ),
771
+							'name' => esc_html__('API', 'give'),
772 772
 							'type' => 'api'
773 773
 						)
774 774
 					)
@@ -777,13 +777,13 @@  discard block
 block discarded – undo
777 777
 			/** Licenses Settings */
778 778
 			'system_info' => array(
779 779
 				'id'         => 'system_info',
780
-				'give_title' => esc_html__( 'System Info', 'give' ),
781
-				'show_on'    => array( 'key' => 'options-page', 'value' => array( $this->key, ), ),
782
-				'fields'     => apply_filters( 'give_settings_system', array(
780
+				'give_title' => esc_html__('System Info', 'give'),
781
+				'show_on'    => array('key' => 'options-page', 'value' => array($this->key,),),
782
+				'fields'     => apply_filters('give_settings_system', array(
783 783
 						array(
784 784
 							'id'   => 'system_info',
785
-							'name' => esc_html__( 'System Info', 'give' ),
786
-							'desc' => esc_html__( 'Please copy and paste this information in your ticket when contacting support.', 'give' ),
785
+							'name' => esc_html__('System Info', 'give'),
786
+							'desc' => esc_html__('Please copy and paste this information in your ticket when contacting support.', 'give'),
787 787
 							'type' => 'system_info'
788 788
 						)
789 789
 					)
@@ -792,15 +792,15 @@  discard block
 block discarded – undo
792 792
 		);
793 793
 
794 794
 		//Return all settings array if no active tab
795
-		if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) {
795
+		if ($active_tab === null || ! isset($give_settings[$active_tab])) {
796 796
 
797
-			return apply_filters( 'give_registered_settings', $give_settings );
797
+			return apply_filters('give_registered_settings', $give_settings);
798 798
 
799 799
 		}
800 800
 
801 801
 
802 802
 		// Add other tabs and settings fields as needed
803
-		return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] );
803
+		return apply_filters('give_registered_settings', $give_settings[$active_tab]);
804 804
 
805 805
 	}
806 806
 
@@ -809,11 +809,11 @@  discard block
 block discarded – undo
809 809
 	 */
810 810
 	public function settings_notices() {
811 811
 
812
-		if ( ! isset( $_POST['give_settings_saved'] ) ) {
812
+		if ( ! isset($_POST['give_settings_saved'])) {
813 813
 			return;
814 814
 		}
815 815
 
816
-		add_settings_error( 'give-notices', 'global-settings-updated', esc_html__( 'Settings updated.', 'give' ), 'updated' );
816
+		add_settings_error('give-notices', 'global-settings-updated', esc_html__('Settings updated.', 'give'), 'updated');
817 817
 
818 818
 	}
819 819
 
@@ -827,17 +827,17 @@  discard block
 block discarded – undo
827 827
 	 *
828 828
 	 * @return mixed          Field value or exception is thrown
829 829
 	 */
830
-	public function __get( $field ) {
830
+	public function __get($field) {
831 831
 
832 832
 		// Allowed fields to retrieve
833
-		if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) {
833
+		if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) {
834 834
 			return $this->{$field};
835 835
 		}
836
-		if ( 'option_metabox' === $field ) {
836
+		if ('option_metabox' === $field) {
837 837
 			return $this->option_metabox();
838 838
 		}
839 839
 
840
-		throw new Exception( 'Invalid property: ' . $field );
840
+		throw new Exception('Invalid property: '.$field);
841 841
 	}
842 842
 
843 843
 
@@ -855,12 +855,12 @@  discard block
 block discarded – undo
855 855
  *
856 856
  * @return mixed        Option value
857 857
  */
858
-function give_get_option( $key = '', $default = false ) {
858
+function give_get_option($key = '', $default = false) {
859 859
 	global $give_options;
860
-	$value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default;
861
-	$value = apply_filters( 'give_get_option', $value, $key, $default );
860
+	$value = ! empty($give_options[$key]) ? $give_options[$key] : $default;
861
+	$value = apply_filters('give_get_option', $value, $key, $default);
862 862
 
863
-	return apply_filters( 'give_get_option_' . $key, $value, $key, $default );
863
+	return apply_filters('give_get_option_'.$key, $value, $key, $default);
864 864
 }
865 865
 
866 866
 
@@ -878,33 +878,33 @@  discard block
 block discarded – undo
878 878
  *
879 879
  * @return boolean True if updated, false if not.
880 880
  */
881
-function give_update_option( $key = '', $value = false ) {
881
+function give_update_option($key = '', $value = false) {
882 882
 
883 883
 	// If no key, exit
884
-	if ( empty( $key ) ) {
884
+	if (empty($key)) {
885 885
 		return false;
886 886
 	}
887 887
 
888
-	if ( empty( $value ) ) {
889
-		$remove_option = give_delete_option( $key );
888
+	if (empty($value)) {
889
+		$remove_option = give_delete_option($key);
890 890
 
891 891
 		return $remove_option;
892 892
 	}
893 893
 
894 894
 	// First let's grab the current settings
895
-	$options = get_option( 'give_settings' );
895
+	$options = get_option('give_settings');
896 896
 
897 897
 	// Let's let devs alter that value coming in
898
-	$value = apply_filters( 'give_update_option', $value, $key );
898
+	$value = apply_filters('give_update_option', $value, $key);
899 899
 
900 900
 	// Next let's try to update the value
901
-	$options[ $key ] = $value;
902
-	$did_update      = update_option( 'give_settings', $options );
901
+	$options[$key] = $value;
902
+	$did_update      = update_option('give_settings', $options);
903 903
 
904 904
 	// If it updated, let's update the global variable
905
-	if ( $did_update ) {
905
+	if ($did_update) {
906 906
 		global $give_options;
907
-		$give_options[ $key ] = $value;
907
+		$give_options[$key] = $value;
908 908
 	}
909 909
 
910 910
 	return $did_update;
@@ -921,27 +921,27 @@  discard block
 block discarded – undo
921 921
  *
922 922
  * @return boolean True if updated, false if not.
923 923
  */
924
-function give_delete_option( $key = '' ) {
924
+function give_delete_option($key = '') {
925 925
 
926 926
 	// If no key, exit
927
-	if ( empty( $key ) ) {
927
+	if (empty($key)) {
928 928
 		return false;
929 929
 	}
930 930
 
931 931
 	// First let's grab the current settings
932
-	$options = get_option( 'give_settings' );
932
+	$options = get_option('give_settings');
933 933
 
934 934
 	// Next let's try to update the value
935
-	if ( isset( $options[ $key ] ) ) {
935
+	if (isset($options[$key])) {
936 936
 
937
-		unset( $options[ $key ] );
937
+		unset($options[$key]);
938 938
 
939 939
 	}
940 940
 
941
-	$did_update = update_option( 'give_settings', $options );
941
+	$did_update = update_option('give_settings', $options);
942 942
 
943 943
 	// If it updated, let's update the global variable
944
-	if ( $did_update ) {
944
+	if ($did_update) {
945 945
 		global $give_options;
946 946
 		$give_options = $options;
947 947
 	}
@@ -960,9 +960,9 @@  discard block
 block discarded – undo
960 960
  */
961 961
 function give_get_settings() {
962 962
 
963
-	$settings = get_option( 'give_settings' );
963
+	$settings = get_option('give_settings');
964 964
 
965
-	return (array) apply_filters( 'give_get_settings', $settings );
965
+	return (array) apply_filters('give_get_settings', $settings);
966 966
 
967 967
 }
968 968
 
@@ -980,25 +980,25 @@  discard block
 block discarded – undo
980 980
  *
981 981
  * @return array
982 982
  */
983
-function give_settings_array_insert( $array, $position, $insert ) {
984
-	if ( is_int( $position ) ) {
985
-		array_splice( $array, $position, 0, $insert );
983
+function give_settings_array_insert($array, $position, $insert) {
984
+	if (is_int($position)) {
985
+		array_splice($array, $position, 0, $insert);
986 986
 	} else {
987 987
 
988
-		foreach ( $array as $index => $subarray ) {
989
-			if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) {
988
+		foreach ($array as $index => $subarray) {
989
+			if (isset($subarray['id']) && $subarray['id'] == $position) {
990 990
 				$pos = $index;
991 991
 			}
992 992
 		}
993 993
 
994
-		if ( ! isset( $pos ) ) {
994
+		if ( ! isset($pos)) {
995 995
 			return $array;
996 996
 		}
997 997
 
998 998
 		$array = array_merge(
999
-			array_slice( $array, 0, $pos ),
999
+			array_slice($array, 0, $pos),
1000 1000
 			$insert,
1001
-			array_slice( $array, $pos )
1001
+			array_slice($array, $pos)
1002 1002
 		);
1003 1003
 	}
1004 1004
 
@@ -1021,31 +1021,31 @@  discard block
 block discarded – undo
1021 1021
  *
1022 1022
  * @return void
1023 1023
  */
1024
-function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1024
+function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1025 1025
 
1026 1026
 	$id                = $field_type_object->field->args['id'];
1027 1027
 	$field_description = $field_type_object->field->args['desc'];
1028
-	$gateways          = give_get_ordered_payment_gateways( give_get_payment_gateways() );
1028
+	$gateways          = give_get_ordered_payment_gateways(give_get_payment_gateways());
1029 1029
 
1030 1030
 	echo '<ul class="cmb2-checkbox-list cmb2-list">';
1031 1031
 
1032
-	foreach ( $gateways as $key => $option ) :
1032
+	foreach ($gateways as $key => $option) :
1033 1033
 
1034
-		if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) {
1034
+		if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) {
1035 1035
 			$enabled = '1';
1036 1036
 		} else {
1037 1037
 			$enabled = null;
1038 1038
 		}
1039 1039
 
1040
-		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/>&nbsp;';
1041
-		echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>';
1040
+		echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/>&nbsp;';
1041
+		echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>';
1042 1042
 
1043 1043
 	endforeach;
1044 1044
 
1045 1045
 	echo '</ul>';
1046 1046
 
1047
-	if ( $field_description ) {
1048
-		echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1047
+	if ($field_description) {
1048
+		echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1049 1049
 	}
1050 1050
 
1051 1051
 }
@@ -1061,31 +1061,31 @@  discard block
 block discarded – undo
1061 1061
  *
1062 1062
  * @return void
1063 1063
  */
1064
-function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1064
+function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1065 1065
 
1066 1066
 	$id                = $field_type_object->field->args['id'];
1067 1067
 	$field_description = $field_type_object->field->args['desc'];
1068 1068
 	$gateways          = give_get_enabled_payment_gateways();
1069 1069
 
1070
-	echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">';
1070
+	echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">';
1071 1071
 
1072 1072
 	//Add a field to the Give Form admin single post view of this field
1073
-	if ( $field_type_object->field->object_type === 'post' ) {
1074
-		echo '<option value="global">' . esc_html__( 'Global Default', 'give' ) . '</option>';
1073
+	if ($field_type_object->field->object_type === 'post') {
1074
+		echo '<option value="global">'.esc_html__('Global Default', 'give').'</option>';
1075 1075
 	}
1076 1076
 
1077
-	foreach ( $gateways as $key => $option ) :
1077
+	foreach ($gateways as $key => $option) :
1078 1078
 
1079
-		$selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : '';
1079
+		$selected = isset($escaped_value) ? selected($key, $escaped_value, false) : '';
1080 1080
 
1081 1081
 
1082
-		echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>';
1082
+		echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>';
1083 1083
 
1084 1084
 	endforeach;
1085 1085
 
1086 1086
 	echo '</select>';
1087 1087
 
1088
-	echo '<p class="cmb2-metabox-description">' . $field_description . '</p>';
1088
+	echo '<p class="cmb2-metabox-description">'.$field_description.'</p>';
1089 1089
 
1090 1090
 }
1091 1091
 
@@ -1100,13 +1100,13 @@  discard block
 block discarded – undo
1100 1100
  *
1101 1101
  * @return void
1102 1102
  */
1103
-function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1103
+function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1104 1104
 
1105 1105
 	$id                = $field_type_object->field->args['id'];
1106 1106
 	$title             = $field_type_object->field->args['name'];
1107 1107
 	$field_description = $field_type_object->field->args['desc'];
1108 1108
 
1109
-	echo '<hr>' . $field_description;
1109
+	echo '<hr>'.$field_description;
1110 1110
 
1111 1111
 }
1112 1112
 
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
  *
1122 1122
  * @return void
1123 1123
  */
1124
-function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1124
+function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1125 1125
 
1126 1126
 	$id                = $field_type_object->field->args['id'];
1127 1127
 	$title             = $field_type_object->field->args['name'];
@@ -1141,25 +1141,25 @@  discard block
 block discarded – undo
1141 1141
  * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types
1142 1142
  * @return array An array of options that matches the CMB2 options array
1143 1143
  */
1144
-function give_cmb2_get_post_options( $query_args, $force = false ) {
1144
+function give_cmb2_get_post_options($query_args, $force = false) {
1145 1145
 
1146
-	$post_options = array( '' => '' ); // Blank option
1146
+	$post_options = array('' => ''); // Blank option
1147 1147
 
1148
-	if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) {
1148
+	if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) {
1149 1149
 		return $post_options;
1150 1150
 	}
1151 1151
 
1152
-	$args = wp_parse_args( $query_args, array(
1152
+	$args = wp_parse_args($query_args, array(
1153 1153
 		'post_type'   => 'page',
1154 1154
 		'numberposts' => 10,
1155
-	) );
1155
+	));
1156 1156
 
1157
-	$posts = get_posts( $args );
1157
+	$posts = get_posts($args);
1158 1158
 
1159
-	if ( $posts ) {
1160
-		foreach ( $posts as $post ) {
1159
+	if ($posts) {
1160
+		foreach ($posts as $post) {
1161 1161
 
1162
-			$post_options[ $post->ID ] = $post->post_title;
1162
+			$post_options[$post->ID] = $post->post_title;
1163 1163
 
1164 1164
 		}
1165 1165
 	}
@@ -1179,17 +1179,17 @@  discard block
 block discarded – undo
1179 1179
 	global $_wp_additional_image_sizes;
1180 1180
 	$sizes = array();
1181 1181
 
1182
-	foreach ( get_intermediate_image_sizes() as $_size ) {
1182
+	foreach (get_intermediate_image_sizes() as $_size) {
1183 1183
 
1184
-		if ( in_array( $_size, array( 'thumbnail', 'medium', 'medium_large', 'large' ) ) ) {
1185
-			$sizes[ $_size ] = $_size . ' - ' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" );
1186
-		} elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) {
1187
-			$sizes[ $_size ] = $_size . ' - ' . $_wp_additional_image_sizes[ $_size ]['width'] . 'x' . $_wp_additional_image_sizes[ $_size ]['height'];
1184
+		if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
1185
+			$sizes[$_size] = $_size.' - '.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h");
1186
+		} elseif (isset($_wp_additional_image_sizes[$_size])) {
1187
+			$sizes[$_size] = $_size.' - '.$_wp_additional_image_sizes[$_size]['width'].'x'.$_wp_additional_image_sizes[$_size]['height'];
1188 1188
 		}
1189 1189
 
1190 1190
 	}
1191 1191
 
1192
-	return apply_filters( 'give_get_featured_image_sizes', $sizes );
1192
+	return apply_filters('give_get_featured_image_sizes', $sizes);
1193 1193
 }
1194 1194
 
1195 1195
 
@@ -1204,34 +1204,34 @@  discard block
 block discarded – undo
1204 1204
  *
1205 1205
  * @return void
1206 1206
  */
1207
-function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
1207
+function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
1208 1208
 
1209 1209
 	$id                = $field_type_object->field->args['id'];
1210 1210
 	$field_description = $field_type_object->field->args['desc'];
1211
-	$license_status    = get_option( $field_type_object->field->args['options']['is_valid_license_option'] );
1211
+	$license_status    = get_option($field_type_object->field->args['options']['is_valid_license_option']);
1212 1212
 	$field_classes     = 'regular-text give-license-field';
1213
-	$type              = empty( $escaped_value ) ? 'text' : 'password';
1213
+	$type              = empty($escaped_value) ? 'text' : 'password';
1214 1214
 
1215
-	if ( $license_status === 'valid' ) {
1215
+	if ($license_status === 'valid') {
1216 1216
 		$field_classes .= ' give-license-active';
1217 1217
 	}
1218 1218
 
1219
-	$html = $field_type_object->input( array(
1219
+	$html = $field_type_object->input(array(
1220 1220
 		'class' => $field_classes,
1221 1221
 		'type'  => $type
1222
-	) );
1222
+	));
1223 1223
 
1224 1224
 	//License is active so show deactivate button
1225
-	if ( $license_status === 'valid' ) {
1226
-		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>';
1225
+	if ($license_status === 'valid') {
1226
+		$html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>';
1227 1227
 	} else {
1228 1228
 		//This license is not valid so delete it
1229
-		give_delete_option( $id );
1229
+		give_delete_option($id);
1230 1230
 	}
1231 1231
 
1232
-	$html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>';
1232
+	$html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>';
1233 1233
 
1234
-	wp_nonce_field( $id . '-nonce', $id . '-nonce' );
1234
+	wp_nonce_field($id.'-nonce', $id.'-nonce');
1235 1235
 
1236 1236
 	echo $html;
1237 1237
 }
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
  */
1246 1246
 function give_api_callback() {
1247 1247
 
1248
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
1248
+	if ( ! current_user_can('manage_give_settings')) {
1249 1249
 		return;
1250 1250
 	}
1251 1251
 
@@ -1254,9 +1254,9 @@  discard block
 block discarded – undo
1254 1254
 	 *
1255 1255
 	 * @since 1.0
1256 1256
 	 */
1257
-	do_action( 'give_tools_api_keys_before' );
1257
+	do_action('give_tools_api_keys_before');
1258 1258
 
1259
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
1259
+	require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
1260 1260
 
1261 1261
 	$api_keys_table = new Give_API_Keys_Table();
1262 1262
 	$api_keys_table->prepare_items();
@@ -1265,9 +1265,9 @@  discard block
 block discarded – undo
1265 1265
 	<span class="cmb2-metabox-description api-description">
1266 1266
 		<?php echo sprintf(
1267 1267
 		/* translators: 1: https://givewp.com/documentation/give-api-reference/ 2: https://givewp.com/addons/zapier/ */
1268
-			__( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ),
1269
-			esc_url( 'https://givewp.com/documentation/give-api-reference/' ),
1270
-			esc_url( 'https://givewp.com/addons/zapier/' )
1268
+			__('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'),
1269
+			esc_url('https://givewp.com/documentation/give-api-reference/'),
1270
+			esc_url('https://givewp.com/addons/zapier/')
1271 1271
 		); ?>
1272 1272
 	</span>
1273 1273
 	<?php
@@ -1277,10 +1277,10 @@  discard block
 block discarded – undo
1277 1277
 	 *
1278 1278
 	 * @since 1.0
1279 1279
 	 */
1280
-	do_action( 'give_tools_api_keys_after' );
1280
+	do_action('give_tools_api_keys_after');
1281 1281
 }
1282 1282
 
1283
-add_action( 'give_settings_tab_api_keys', 'give_api_callback' );
1283
+add_action('give_settings_tab_api_keys', 'give_api_callback');
1284 1284
 
1285 1285
 /**
1286 1286
  * Hook Callback
@@ -1293,8 +1293,8 @@  discard block
 block discarded – undo
1293 1293
  *
1294 1294
  * @return void
1295 1295
  */
1296
-function give_hook_callback( $args ) {
1297
-	do_action( 'give_' . $args['id'] );
1296
+function give_hook_callback($args) {
1297
+	do_action('give_'.$args['id']);
1298 1298
 }
1299 1299
 
1300 1300
 /**
@@ -1305,10 +1305,10 @@  discard block
 block discarded – undo
1305 1305
  * This prevents fatal error conflicts with other themes and users of the CMB2 WP.org plugin.
1306 1306
  */
1307 1307
 
1308
-if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1309
-	require_once WP_PLUGIN_DIR . '/cmb2/init.php';
1310
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1311
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php';
1312
-} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) {
1313
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php';
1308
+if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1309
+	require_once WP_PLUGIN_DIR.'/cmb2/init.php';
1310
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) {
1311
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php';
1312
+} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) {
1313
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php';
1314 1314
 }
1315 1315
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', esc_html__( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', esc_html__('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats; ?>
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 				/* translators: %s: day of the week */
54
-					esc_html__( 'Happy %s!', 'give' ),
55
-					date( 'l', current_time( 'timestamp' ) )
54
+					esc_html__('Happy %s!', 'give'),
55
+					date('l', current_time('timestamp'))
56 56
 				);
57 57
 				?></p>
58 58
 
59
-			<?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?>
59
+			<?php $earnings_today = $stats->get_earnings(0, 'today', false); ?>
60 60
 
61
-			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p>
61
+			<p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p>
62 62
 
63 63
 			<p class="give-orders-today">
64
-				<?php $donations_today = $stats->get_sales( 0, 'today', false ); ?>
65
-				<?php echo give_format_amount( $donations_today, false ); ?>
66
-				<span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span>
64
+				<?php $donations_today = $stats->get_sales(0, 'today', false); ?>
65
+				<?php echo give_format_amount($donations_today, false); ?>
66
+				<span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span>
67 67
 			</p>
68 68
 
69 69
 
@@ -73,34 +73,34 @@  discard block
 block discarded – undo
73 73
 		<table class="give-table-stats">
74 74
 			<thead style="display: none;">
75 75
 			<tr>
76
-				<th><?php esc_html_e( 'This Week', 'give' ); ?></th>
77
-				<th><?php esc_html_e( 'This Month', 'give' ); ?></th>
78
-				<th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th>
76
+				<th><?php esc_html_e('This Week', 'give'); ?></th>
77
+				<th><?php esc_html_e('This Month', 'give'); ?></th>
78
+				<th><?php esc_html_e('Past 30 Days', 'give'); ?></th>
79 79
 			</tr>
80 80
 			</thead>
81 81
 			<tbody>
82 82
 			<tr id="give-table-stats-tr-1">
83 83
 				<td>
84
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p>
84
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p>
85 85
 
86
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Week', 'give' ); ?></p>
86
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Week', 'give'); ?></p>
87 87
 				</td>
88 88
 				<td>
89
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p>
89
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p>
90 90
 
91
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Month', 'give' ); ?></p>
91
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Month', 'give'); ?></p>
92 92
 				</td>
93 93
 			</tr>
94 94
 			<tr id="give-table-stats-tr-2">
95 95
 				<td>
96
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p>
96
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p>
97 97
 
98
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'Last Month', 'give' ); ?></p>
98
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('Last Month', 'give'); ?></p>
99 99
 				</td>
100 100
 				<td>
101
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p>
101
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p>
102 102
 
103
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Year', 'give' ); ?></p>
103
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Year', 'give'); ?></p>
104 104
 				</td>
105 105
 			</tr>
106 106
 			</tbody>
@@ -120,25 +120,25 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return array
122 122
  */
123
-function give_dashboard_at_a_glance_widget( $items ) {
124
-	$num_posts = wp_count_posts( 'give_forms' );
123
+function give_dashboard_at_a_glance_widget($items) {
124
+	$num_posts = wp_count_posts('give_forms');
125 125
 
126
-	if ( $num_posts && $num_posts->publish ) {
126
+	if ($num_posts && $num_posts->publish) {
127 127
 
128 128
 		$text = sprintf(
129 129
 		/* translators: 1: number of posts published 2: forms singular label 3: forms plural label */
130
-			_n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ),
130
+			_n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'),
131 131
 			$num_posts->publish,
132 132
 			give_get_forms_label_singular(),
133 133
 			give_get_forms_label_plural()
134 134
 		);
135 135
 
136
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
136
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
137 137
 
138
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
139
-			$text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text );
138
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
139
+			$text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text);
140 140
 		} else {
141
-			$text = sprintf( '<span class="give-forms-count">%1$s</span>', $text );
141
+			$text = sprintf('<span class="give-forms-count">%1$s</span>', $text);
142 142
 		}
143 143
 
144 144
 		$items[] = $text;
@@ -147,4 +147,4 @@  discard block
 block discarded – undo
147 147
 	return $items;
148 148
 }
149 149
 
150
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 );
150
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' );
17
+add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
18 18
 
19 19
 /**
20 20
  * Define the metabox and field configurations.
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array
25 25
  */
26
-function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
26
+function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
27 27
 
28 28
 	$post_id               = give_get_admin_post_id();
29
-	$price                 = give_get_form_price( $post_id );
30
-	$custom_amount_minimum = give_get_form_minimum_price( $post_id );
31
-	$goal                  = give_get_form_goal( $post_id );
32
-	$variable_pricing      = give_has_variable_prices( $post_id );
33
-	$prices                = give_get_variable_prices( $post_id );
29
+	$price                 = give_get_form_price($post_id);
30
+	$custom_amount_minimum = give_get_form_minimum_price($post_id);
31
+	$goal                  = give_get_form_goal($post_id);
32
+	$variable_pricing      = give_has_variable_prices($post_id);
33
+	$prices                = give_get_variable_prices($post_id);
34 34
 
35 35
 	//No empty prices - min. 1.00 for new forms
36
-	if ( empty( $price ) && is_null( $post_id ) ) {
37
-		$price = esc_attr( give_format_amount( '1.00' ) );
36
+	if (empty($price) && is_null($post_id)) {
37
+		$price = esc_attr(give_format_amount('1.00'));
38 38
 	}
39 39
 
40 40
 	//Min. $1.00 for new forms
41
-	if ( empty( $custom_amount_minimum ) ) {
42
-		$custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) );
41
+	if (empty($custom_amount_minimum)) {
42
+		$custom_amount_minimum = esc_attr(give_format_amount('1.00'));
43 43
 	}
44 44
 
45 45
 	// Start with an underscore to hide fields from custom fields list
@@ -48,330 +48,330 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Repeatable Field Groups
50 50
 	 */
51
-	$meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array(
51
+	$meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
52 52
 		'id'           => 'form_field_options',
53
-		'title'        => esc_html__( 'Donation Options', 'give' ),
54
-		'object_types' => array( 'give_forms' ),
53
+		'title'        => esc_html__('Donation Options', 'give'),
54
+		'object_types' => array('give_forms'),
55 55
 		'context'      => 'normal',
56 56
 		'priority'     => 'high', //Show above Content WYSIWYG
57
-		'fields'       => apply_filters( 'give_forms_donation_form_metabox_fields', array(
57
+		'fields'       => apply_filters('give_forms_donation_form_metabox_fields', array(
58 58
 				//Donation Option
59 59
 				array(
60
-					'name'        => esc_html__( 'Donation Option', 'give' ),
61
-					'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
62
-					'id'          => $prefix . 'price_option',
60
+					'name'        => esc_html__('Donation Option', 'give'),
61
+					'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
62
+					'id'          => $prefix.'price_option',
63 63
 					'type'        => 'radio_inline',
64 64
 					'default'     => 'set',
65
-					'options'     => apply_filters( 'give_forms_price_options', array(
66
-						'set'   => esc_html__( 'Set Donation', 'give' ),
67
-						'multi' => esc_html__( 'Multi-level Donation', 'give' ),
68
-					) ),
65
+					'options'     => apply_filters('give_forms_price_options', array(
66
+						'set'   => esc_html__('Set Donation', 'give'),
67
+						'multi' => esc_html__('Multi-level Donation', 'give'),
68
+					)),
69 69
 				),
70 70
 				array(
71
-					'name'         => esc_html__( 'Set Donation', 'give' ),
72
-					'description'  => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
73
-					'id'           => $prefix . 'set_price',
71
+					'name'         => esc_html__('Set Donation', 'give'),
72
+					'description'  => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
73
+					'id'           => $prefix.'set_price',
74 74
 					'type'         => 'text_small',
75 75
 					'row_classes'  => 'give-subfield',
76
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
77
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
76
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
77
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
78 78
                     'sanitization_cb'   => 'give_sanitize_price_field_value',
79 79
                     'attributes'   => array(
80
-						'placeholder' => give_format_decimal( '1.00' ),
81
-						'value'       => give_format_decimal( $price ),
80
+						'placeholder' => give_format_decimal('1.00'),
81
+						'value'       => give_format_decimal($price),
82 82
 						'class'       => 'cmb-type-text-small give-money-field',
83 83
 					),
84 84
 				),
85 85
 				//Donation levels: Header
86 86
 				array(
87
-					'id'   => $prefix . 'levels_header',
87
+					'id'   => $prefix.'levels_header',
88 88
 					'type' => 'levels_repeater_header',
89 89
 				),
90 90
 				//Donation Levels: Repeatable CMB2 Group
91 91
 				array(
92
-					'id'          => $prefix . 'donation_levels',
92
+					'id'          => $prefix.'donation_levels',
93 93
 					'type'        => 'group',
94 94
 					'row_classes' => 'give-subfield',
95 95
 					'options'     => array(
96
-						'add_button'    => esc_html__( 'Add Level', 'give' ),
96
+						'add_button'    => esc_html__('Add Level', 'give'),
97 97
 						'remove_button' => '<span class="dashicons dashicons-no"></span>',
98 98
 						'sortable'      => true, // beta
99 99
 					),
100 100
 					// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
101
-					'fields'      => apply_filters( 'give_donation_levels_table_row', array(
101
+					'fields'      => apply_filters('give_donation_levels_table_row', array(
102 102
 						array(
103
-							'name' => esc_html__( 'ID', 'give' ),
104
-							'id'   => $prefix . 'id',
103
+							'name' => esc_html__('ID', 'give'),
104
+							'id'   => $prefix.'id',
105 105
 							'type' => 'levels_id',
106 106
 						),
107 107
 						array(
108
-							'name'              => esc_html__( 'Amount', 'give' ),
109
-							'id'                => $prefix . 'amount',
108
+							'name'              => esc_html__('Amount', 'give'),
109
+							'id'                => $prefix.'amount',
110 110
 							'type'              => 'text_small',
111
-							'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
112
-							'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
111
+							'before_field'      => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
112
+							'after_field'       => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
113 113
 							'sanitization_cb'   => 'give_sanitize_price_field_value',
114 114
                             'attributes'        => array(
115
-								'placeholder' => give_format_decimal( '1.00' ),
115
+								'placeholder' => give_format_decimal('1.00'),
116 116
 								'class'       => 'cmb-type-text-small give-money-field',
117 117
 							),
118 118
 							'before'       => 'give_format_admin_multilevel_amount',
119 119
 						),
120 120
 						array(
121
-							'name'       => esc_html__( 'Text', 'give' ),
122
-							'id'         => $prefix . 'text',
121
+							'name'       => esc_html__('Text', 'give'),
122
+							'id'         => $prefix.'text',
123 123
 							'type'       => 'text',
124 124
 							'attributes' => array(
125
-								'placeholder' => esc_html__( 'Donation Level', 'give' ),
125
+								'placeholder' => esc_html__('Donation Level', 'give'),
126 126
 								'class'       => 'give-multilevel-text-field',
127 127
 							),
128 128
 						),
129 129
 						array(
130
-							'name' => esc_html__( 'Default', 'give' ),
131
-							'id'   => $prefix . 'default',
130
+							'name' => esc_html__('Default', 'give'),
131
+							'id'   => $prefix.'default',
132 132
 							'type' => 'give_default_radio_inline'
133 133
 						),
134
-					) ),
134
+					)),
135 135
 				),
136 136
 				//Display Style
137 137
 				array(
138
-					'name'        => esc_html__( 'Display Style', 'give' ),
139
-					'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
140
-					'id'          => $prefix . 'display_style',
138
+					'name'        => esc_html__('Display Style', 'give'),
139
+					'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
140
+					'id'          => $prefix.'display_style',
141 141
 					'type'        => 'radio_inline',
142 142
 					'default'     => 'buttons',
143 143
 					'options'     => array(
144
-						'buttons'  => esc_html__( 'Buttons', 'give' ),
145
-						'radios'   => esc_html__( 'Radios', 'give' ),
146
-						'dropdown' => esc_html__( 'Dropdown', 'give' ),
144
+						'buttons'  => esc_html__('Buttons', 'give'),
145
+						'radios'   => esc_html__('Radios', 'give'),
146
+						'dropdown' => esc_html__('Dropdown', 'give'),
147 147
 					),
148 148
 				),
149 149
 				//Custom Amount
150 150
 				array(
151
-					'name'        => esc_html__( 'Custom Amount', 'give' ),
152
-					'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
153
-					'id'          => $prefix . 'custom_amount',
151
+					'name'        => esc_html__('Custom Amount', 'give'),
152
+					'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
153
+					'id'          => $prefix.'custom_amount',
154 154
 					'type'        => 'radio_inline',
155 155
 					'default'     => 'no',
156 156
 					'options'     => array(
157
-						'yes' => esc_html__( 'Yes', 'give' ),
158
-						'no'  => esc_html__( 'No', 'give' ),
157
+						'yes' => esc_html__('Yes', 'give'),
158
+						'no'  => esc_html__('No', 'give'),
159 159
 					),
160 160
 				),
161 161
 				array(
162
-					'name'         => esc_html__( 'Custom Amount Minimum', 'give' ),
163
-					'description'  => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ),
164
-					'id'           => $prefix . 'custom_amount_minimum',
162
+					'name'         => esc_html__('Custom Amount Minimum', 'give'),
163
+					'description'  => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
164
+					'id'           => $prefix.'custom_amount_minimum',
165 165
 					'type'         => 'text_small',
166 166
 					'row_classes'  => 'give-subfield',
167
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
168
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
167
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
168
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
169 169
                     'sanitization_cb'   => 'give_sanitize_price_field_value',
170 170
                     'attributes'   => array(
171 171
 						'placeholder' => give_format_decimal('1.00'),
172
-						'value'       => give_format_decimal( $custom_amount_minimum ),
172
+						'value'       => give_format_decimal($custom_amount_minimum),
173 173
 						'class'       => 'cmb-type-text-small give-money-field',
174 174
 					)
175 175
 				),
176 176
 				array(
177
-					'name'        => esc_html__( 'Custom Amount Text', 'give' ),
178
-					'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
179
-					'id'          => $prefix . 'custom_amount_text',
177
+					'name'        => esc_html__('Custom Amount Text', 'give'),
178
+					'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
179
+					'id'          => $prefix.'custom_amount_text',
180 180
 					'type'        => 'text',
181 181
 					'row_classes' => 'give-subfield',
182 182
 					'attributes'  => array(
183 183
 						'rows'        => 3,
184
-						'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
184
+						'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
185 185
 					),
186 186
 				),
187 187
 				//Goals
188 188
 				array(
189
-					'name'        => esc_html__( 'Goal', 'give' ),
190
-					'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
191
-					'id'          => $prefix . 'goal_option',
189
+					'name'        => esc_html__('Goal', 'give'),
190
+					'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
191
+					'id'          => $prefix.'goal_option',
192 192
 					'type'        => 'radio_inline',
193 193
 					'default'     => 'no',
194 194
 					'options'     => array(
195
-						'yes' => esc_html__( 'Yes', 'give' ),
196
-						'no'  => esc_html__( 'No', 'give' ),
195
+						'yes' => esc_html__('Yes', 'give'),
196
+						'no'  => esc_html__('No', 'give'),
197 197
 					),
198 198
 				),
199 199
 				array(
200
-					'name'              => esc_html__( 'Goal Amount', 'give' ),
201
-					'description'       => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ),
202
-					'id'                => $prefix . 'set_goal',
200
+					'name'              => esc_html__('Goal Amount', 'give'),
201
+					'description'       => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'),
202
+					'id'                => $prefix.'set_goal',
203 203
 					'type'              => 'text_small',
204 204
 					'row_classes'       => 'give-subfield',
205
-					'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
206
-					'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
205
+					'before_field'      => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
206
+					'after_field'       => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
207 207
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
208 208
 					'attributes'        => array(
209
-						'placeholder' => give_format_decimal( '0.00' ),
210
-						'value'       => give_format_decimal( $goal ),
209
+						'placeholder' => give_format_decimal('0.00'),
210
+						'value'       => give_format_decimal($goal),
211 211
 						'class'       => 'cmb-type-text-small give-money-field',
212 212
 					),
213 213
 				),
214 214
 
215 215
 				array(
216
-					'name'        => esc_html__( 'Goal Format', 'give' ),
217
-					'description' => esc_html__( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
218
-					'id'          => $prefix . 'goal_format',
216
+					'name'        => esc_html__('Goal Format', 'give'),
217
+					'description' => esc_html__('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
218
+					'id'          => $prefix.'goal_format',
219 219
 					'type'        => 'radio_inline',
220 220
 					'default'     => 'amount',
221 221
 					'row_classes' => 'give-subfield',
222 222
 					'options'     => array(
223
-						'amount'     => esc_html__( 'Amount', 'give' ),
224
-						'percentage' => esc_html__( 'Percentage', 'give' ),
223
+						'amount'     => esc_html__('Amount', 'give'),
224
+						'percentage' => esc_html__('Percentage', 'give'),
225 225
 					),
226 226
 				),
227 227
 				array(
228
-					'name'        => esc_html__( 'Goal Progress Bar Color', 'give' ),
229
-					'id'          => $prefix . 'goal_color',
228
+					'name'        => esc_html__('Goal Progress Bar Color', 'give'),
229
+					'id'          => $prefix.'goal_color',
230 230
 					'type'        => 'colorpicker',
231 231
 					'row_classes' => 'give-subfield',
232 232
 					'default'     => '#2bc253',
233 233
 				),
234 234
 
235 235
 				array(
236
-					'name'        => esc_html__( 'Close Form when Goal Achieved', 'give' ),
237
-					'desc'        => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
238
-					'id'          => $prefix . 'close_form_when_goal_achieved',
236
+					'name'        => esc_html__('Close Form when Goal Achieved', 'give'),
237
+					'desc'        => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
238
+					'id'          => $prefix.'close_form_when_goal_achieved',
239 239
 					'type'        => 'radio_inline',
240 240
 					'row_classes' => 'give-subfield',
241 241
 					'options'     => array(
242
-						'yes' => esc_html__( 'Yes', 'give' ),
243
-						'no'  => esc_html__( 'No', 'give' ),
242
+						'yes' => esc_html__('Yes', 'give'),
243
+						'no'  => esc_html__('No', 'give'),
244 244
 					),
245 245
 					'default'     => 'no',
246 246
 				),
247 247
 				array(
248
-					'name'        => esc_html__( 'Goal Achieved Message', 'give' ),
249
-					'desc'        => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
250
-					'id'          => $prefix . 'form_goal_achieved_message',
248
+					'name'        => esc_html__('Goal Achieved Message', 'give'),
249
+					'desc'        => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
250
+					'id'          => $prefix.'form_goal_achieved_message',
251 251
 					'type'        => 'textarea',
252 252
 					'row_classes' => 'give-subfield',
253 253
 					'attributes'  => array(
254
-						'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
254
+						'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'),
255 255
 					),
256 256
 				)
257 257
 			)
258 258
 		)
259
-	) );
259
+	));
260 260
 
261 261
 
262 262
 	/**
263 263
 	 * Content Field
264 264
 	 */
265
-	$meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array(
265
+	$meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
266 266
 		'id'           => 'form_content_options',
267
-		'title'        => esc_html__( 'Form Content', 'give' ),
268
-		'object_types' => array( 'give_forms' ),
267
+		'title'        => esc_html__('Form Content', 'give'),
268
+		'object_types' => array('give_forms'),
269 269
 		'context'      => 'normal',
270 270
 		'priority'     => 'high', //Show above Content WYSIWYG
271
-		'fields'       => apply_filters( 'give_forms_content_options_metabox_fields', array(
271
+		'fields'       => apply_filters('give_forms_content_options_metabox_fields', array(
272 272
 				//Donation Option
273 273
 				array(
274
-					'name'        => esc_html__( 'Display Content', 'give' ),
275
-					'description' => esc_html__( 'Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give' ),
276
-					'id'          => $prefix . 'content_option',
274
+					'name'        => esc_html__('Display Content', 'give'),
275
+					'description' => esc_html__('Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give'),
276
+					'id'          => $prefix.'content_option',
277 277
 					'type'        => 'select',
278
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
279
-							'none'           => esc_html__( 'No Content', 'give' ),
280
-							'give_pre_form'  => esc_html__( 'Display content ABOVE the fields', 'give' ),
281
-							'give_post_form' => esc_html__( 'Display content BELOW the fields', 'give' ),
278
+					'options'     => apply_filters('give_forms_content_options_select', array(
279
+							'none'           => esc_html__('No Content', 'give'),
280
+							'give_pre_form'  => esc_html__('Display content ABOVE the fields', 'give'),
281
+							'give_post_form' => esc_html__('Display content BELOW the fields', 'give'),
282 282
 						)
283 283
 					),
284 284
 					'default'     => 'none',
285 285
 				),
286 286
 				array(
287
-					'name'        => esc_html__( 'Content', 'give' ),
288
-					'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
289
-					'id'          => $prefix . 'form_content',
287
+					'name'        => esc_html__('Content', 'give'),
288
+					'description' => esc_html__('This content will display on the single give form page.', 'give'),
289
+					'id'          => $prefix.'form_content',
290 290
 					'row_classes' => 'give-subfield',
291 291
 					'type'        => 'wysiwyg'
292 292
 				),
293 293
 			)
294 294
 		)
295
-	) );
295
+	));
296 296
 
297 297
 
298 298
 	/**
299 299
 	 * Display Options
300 300
 	 */
301
-	$meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array(
301
+	$meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
302 302
 			'id'           => 'form_display_options',
303
-			'title'        => esc_html__( 'Form Display Options', 'give' ),
304
-			'object_types' => array( 'give_forms' ),
303
+			'title'        => esc_html__('Form Display Options', 'give'),
304
+			'object_types' => array('give_forms'),
305 305
 			'context'      => 'normal', //  'normal', 'advanced', or 'side'
306 306
 			'priority'     => 'high', //Show above Content WYSIWYG
307 307
 			'show_names'   => true, // Show field names on the left
308
-			'fields'       => apply_filters( 'give_forms_display_options_metabox_fields', array(
308
+			'fields'       => apply_filters('give_forms_display_options_metabox_fields', array(
309 309
 					array(
310
-						'name'    => esc_html__( 'Payment Fields', 'give' ),
311
-						'desc'    => esc_html__( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ),
312
-						'id'      => $prefix . 'payment_display',
310
+						'name'    => esc_html__('Payment Fields', 'give'),
311
+						'desc'    => esc_html__('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
312
+						'id'      => $prefix.'payment_display',
313 313
 						'type'    => 'select',
314 314
 						'options' => array(
315
-							'onpage' => esc_html__( 'Show on Page', 'give' ),
316
-							'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
317
-							'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
315
+							'onpage' => esc_html__('Show on Page', 'give'),
316
+							'reveal' => esc_html__('Reveal Upon Click', 'give'),
317
+							'modal'  => esc_html__('Modal Window Upon Click', 'give'),
318 318
 						),
319 319
 						'default' => 'onpage',
320 320
 					),
321 321
 					array(
322
-						'id'          => $prefix . 'reveal_label',
323
-						'name'        => esc_html__( 'Reveal / Modal Open Text', 'give' ),
324
-						'desc'        => esc_html__( 'The button label for completing the donation.', 'give' ),
322
+						'id'          => $prefix.'reveal_label',
323
+						'name'        => esc_html__('Reveal / Modal Open Text', 'give'),
324
+						'desc'        => esc_html__('The button label for completing the donation.', 'give'),
325 325
 						'type'        => 'text_small',
326 326
 						'row_classes' => 'give-subfield',
327 327
 						'attributes'  => array(
328
-							'placeholder' => esc_attr__( 'Donate Now', 'give' ),
328
+							'placeholder' => esc_attr__('Donate Now', 'give'),
329 329
 						),
330 330
 					),
331 331
 					array(
332
-						'id'         => $prefix . 'checkout_label',
333
-						'name'       => esc_html__( 'Complete Donation Text', 'give' ),
334
-						'desc'       => esc_html__( 'The button label for completing a donation.', 'give' ),
332
+						'id'         => $prefix.'checkout_label',
333
+						'name'       => esc_html__('Complete Donation Text', 'give'),
334
+						'desc'       => esc_html__('The button label for completing a donation.', 'give'),
335 335
 						'type'       => 'text_small',
336 336
 						'attributes' => array(
337
-							'placeholder' => esc_html__( 'Donate Now', 'give' ),
337
+							'placeholder' => esc_html__('Donate Now', 'give'),
338 338
 						),
339 339
 					),
340 340
 					array(
341
-						'name' => esc_html__( 'Default Gateway', 'give' ),
342
-						'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
343
-						'id'   => $prefix . 'default_gateway',
341
+						'name' => esc_html__('Default Gateway', 'give'),
342
+						'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
343
+						'id'   => $prefix.'default_gateway',
344 344
 						'type' => 'default_gateway'
345 345
 					),
346 346
 					array(
347
-						'name' => esc_html__( 'Disable Guest Donations', 'give' ),
348
-						'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ),
349
-						'id'   => $prefix . 'logged_in_only',
347
+						'name' => esc_html__('Disable Guest Donations', 'give'),
348
+						'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'),
349
+						'id'   => $prefix.'logged_in_only',
350 350
 						'type' => 'checkbox'
351 351
 					),
352 352
 					array(
353
-						'name'    => esc_html__( 'Register / Login Form', 'give' ),
354
-						'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
355
-						'id'      => $prefix . 'show_register_form',
353
+						'name'    => esc_html__('Register / Login Form', 'give'),
354
+						'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
355
+						'id'      => $prefix.'show_register_form',
356 356
 						'type'    => 'select',
357 357
 						'options' => array(
358
-							'both'         => esc_html__( 'Registration and Login Forms', 'give' ),
359
-							'registration' => esc_html__( 'Registration Form Only', 'give' ),
360
-							'login'        => esc_html__( 'Login Form Only', 'give' ),
361
-							'none'         => esc_html__( 'None', 'give' ),
358
+							'both'         => esc_html__('Registration and Login Forms', 'give'),
359
+							'registration' => esc_html__('Registration Form Only', 'give'),
360
+							'login'        => esc_html__('Login Form Only', 'give'),
361
+							'none'         => esc_html__('None', 'give'),
362 362
 						),
363 363
 						'default' => 'none',
364 364
 					),
365 365
 					array(
366
-						'name'    => esc_html__( 'Floating Labels', 'give' ),
366
+						'name'    => esc_html__('Floating Labels', 'give'),
367 367
 						/* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
368
-						'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
369
-						'id'      => $prefix . 'form_floating_labels',
368
+						'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
369
+						'id'      => $prefix.'form_floating_labels',
370 370
 						'type'    => 'select',
371 371
 						'options' => array(
372
-							''         => esc_html__( 'Use the global setting', 'give' ),
373
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
374
-							'disabled' => esc_html__( 'Disabled', 'give' ),
372
+							''         => esc_html__('Use the global setting', 'give'),
373
+							'enabled'  => esc_html__('Enabled', 'give'),
374
+							'disabled' => esc_html__('Disabled', 'give'),
375 375
 						),
376 376
 						'default' => 'none',
377 377
 					)
@@ -383,47 +383,47 @@  discard block
 block discarded – undo
383 383
 	/**
384 384
 	 * Terms & Conditions
385 385
 	 */
386
-	$meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array(
386
+	$meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
387 387
 		'id'           => 'form_terms_options',
388
-		'title'        => esc_html__( 'Terms and Conditions', 'give' ),
389
-		'object_types' => array( 'give_forms' ),
388
+		'title'        => esc_html__('Terms and Conditions', 'give'),
389
+		'object_types' => array('give_forms'),
390 390
 		'context'      => 'normal',
391 391
 		'priority'     => 'high', //Show above Content WYSIWYG
392
-		'fields'       => apply_filters( 'give_forms_terms_options_metabox_fields', array(
392
+		'fields'       => apply_filters('give_forms_terms_options_metabox_fields', array(
393 393
 				//Donation Option
394 394
 				array(
395
-					'name'        => esc_html__( 'Terms and Conditions', 'give' ),
396
-					'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ),
397
-					'id'          => $prefix . 'terms_option',
395
+					'name'        => esc_html__('Terms and Conditions', 'give'),
396
+					'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
397
+					'id'          => $prefix.'terms_option',
398 398
 					'type'        => 'select',
399
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
400
-							'none' => esc_html__( 'No', 'give' ),
401
-							'yes'  => esc_html__( 'Yes', 'give' ),
399
+					'options'     => apply_filters('give_forms_content_options_select', array(
400
+							'none' => esc_html__('No', 'give'),
401
+							'yes'  => esc_html__('Yes', 'give'),
402 402
 						)
403 403
 					),
404 404
 					'default'     => 'none',
405 405
 				),
406 406
 				array(
407
-					'id'          => $prefix . 'agree_label',
408
-					'name'        => esc_html__( 'Agree to Terms Label', 'give' ),
409
-					'desc'        => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
407
+					'id'          => $prefix.'agree_label',
408
+					'name'        => esc_html__('Agree to Terms Label', 'give'),
409
+					'desc'        => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
410 410
 					'type'        => 'text',
411 411
 					'row_classes' => 'give-subfield',
412 412
 					'size'        => 'regular',
413 413
 					'attributes'  => array(
414
-						'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
414
+						'placeholder' => esc_attr__('Agree to Terms?', 'give'),
415 415
 					),
416 416
 				),
417 417
 				array(
418
-					'id'          => $prefix . 'agree_text',
418
+					'id'          => $prefix.'agree_text',
419 419
 					'row_classes' => 'give-subfield',
420
-					'name'        => esc_html__( 'Agreement Text', 'give' ),
421
-					'desc'        => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
420
+					'name'        => esc_html__('Agreement Text', 'give'),
421
+					'desc'        => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
422 422
 					'type'        => 'wysiwyg'
423 423
 				),
424 424
 			)
425 425
 		)
426
-	) );
426
+	));
427 427
 
428 428
 	return $meta_boxes;
429 429
 
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
 
438 438
 	<div class="table-container">
439 439
 		<div class="table-row">
440
-			<div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div>
441
-			<div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div>
442
-			<div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div>
440
+			<div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div>
441
+			<div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div>
442
+			<div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div>
443 443
 			<?php
444 444
 			/**
445 445
 			 * Fires in repeatable donation levels table head.
@@ -451,9 +451,9 @@  discard block
 block discarded – undo
451 451
 			 *
452 452
 			 * @since 1.0
453 453
 			 */
454
-			do_action( 'give_donation_levels_table_head' );
454
+			do_action('give_donation_levels_table_head');
455 455
 			?>
456
-			<div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div>
456
+			<div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div>
457 457
 
458 458
 		</div>
459 459
 	</div>
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	<?php
462 462
 }
463 463
 
464
-add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 );
464
+add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
465 465
 
466 466
 
467 467
 /**
@@ -478,25 +478,25 @@  discard block
 block discarded – undo
478 478
  * @param $object_type
479 479
  * @param $field_type_object
480 480
  */
481
-function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
481
+function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
482 482
 
483
-	$escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' );
483
+	$escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : '');
484 484
 
485 485
 	$field_options_array = array(
486 486
 		'class' => 'give-hidden give-level-id-input',
487
-		'name'  => $field_type_object->_name( '[level_id]' ),
488
-		'id'    => $field_type_object->_id( '_level_id' ),
487
+		'name'  => $field_type_object->_name('[level_id]'),
488
+		'id'    => $field_type_object->_id('_level_id'),
489 489
 		'value' => $escaped_value,
490 490
 		'type'  => 'number',
491 491
 		'desc'  => '',
492 492
 	);
493 493
 
494
-	echo '<p class="give-level-id">' . $escaped_value . '</p>';
495
-	echo $field_type_object->input( $field_options_array );
494
+	echo '<p class="give-level-id">'.$escaped_value.'</p>';
495
+	echo $field_type_object->input($field_options_array);
496 496
 
497 497
 }
498 498
 
499
-add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 );
499
+add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
500 500
 
501 501
 
502 502
 /**
@@ -508,13 +508,13 @@  discard block
 block discarded – undo
508 508
  * @param $object_type
509 509
  * @param $field_type_object
510 510
  */
511
-function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
512
-	echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>';
513
-	echo '<label for="' . $field_object->args['id'] . '">' . esc_html__( 'Default', 'give' ) . '</label>';
511
+function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
512
+	echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
513
+	echo '<label for="'.$field_object->args['id'].'">'.esc_html__('Default', 'give').'</label>';
514 514
 
515 515
 }
516 516
 
517
-add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 );
517
+add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
518 518
 
519 519
 
520 520
 /**
@@ -524,20 +524,20 @@  discard block
 block discarded – undo
524 524
  */
525 525
 function give_add_shortcode_to_publish_metabox() {
526 526
 
527
-	if ( 'give_forms' !== get_post_type() ) {
527
+	if ('give_forms' !== get_post_type()) {
528 528
 		return false;
529 529
 	}
530 530
 
531 531
 	global $post;
532 532
 
533 533
 	//Only enqueue scripts for CPT on post type screen
534
-	if ( 'give_forms' === $post->post_type ) {
534
+	if ('give_forms' === $post->post_type) {
535 535
 		//Shortcode column with select all input
536
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
537
-		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
536
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
537
+		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
538 538
 
539 539
 	}
540 540
 
541 541
 }
542 542
 
543
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
543
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 
31
-	$payment_data = give_get_payment_meta( $payment_id );
31
+	$payment_data = give_get_payment_meta($payment_id);
32 32
 
33
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
34
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
33
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
34
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
35 35
 
36
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
37
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
36
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
37
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
38 38
 
39
-	$to_email = give_get_payment_user_email( $payment_id );
39
+	$to_email = give_get_payment_user_email($payment_id);
40 40
 
41
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
42
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
43
-	$subject = give_do_email_tags( $subject, $payment_id );
41
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
42
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
43
+	$subject = give_do_email_tags($subject, $payment_id);
44 44
 
45
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
46
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
45
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
46
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
47 47
 
48 48
 	$emails = Give()->emails;
49 49
 
50
-	$emails->__set( 'from_name', $from_name );
51
-	$emails->__set( 'from_email', $from_email );
52
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
50
+	$emails->__set('from_name', $from_name);
51
+	$emails->__set('from_email', $from_email);
52
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
53 53
 
54 54
 
55
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
56
-	$emails->__set( 'headers', $headers );
55
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
56
+	$emails->__set('headers', $headers);
57 57
 
58
-	$emails->send( $to_email, $subject, $message, $attachments );
58
+	$emails->send($to_email, $subject, $message, $attachments);
59 59
 
60
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
61
-		do_action( 'give_admin_sale_notice', $payment_id, $payment_data );
60
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
61
+		do_action('give_admin_sale_notice', $payment_id, $payment_data);
62 62
 	}
63 63
 }
64 64
 
@@ -71,29 +71,29 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function give_email_test_donation_receipt() {
73 73
 
74
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
75
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() );
74
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
75
+	$from_name = apply_filters('give_purchase_from_name', $from_name, 0, array());
76 76
 
77
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
78
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() );
77
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
78
+	$from_email = apply_filters('give_purchase_from_address', $from_email, 0, array());
79 79
 
80
-	$subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) );
81
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
82
-	$subject = give_do_email_tags( $subject, 0 );
80
+	$subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give'));
81
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
82
+	$subject = give_do_email_tags($subject, 0);
83 83
 
84
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
84
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
85 85
 
86
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
86
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()));
87 87
 
88 88
 	$emails = Give()->emails;
89
-	$emails->__set( 'from_name', $from_name );
90
-	$emails->__set( 'from_email', $from_email );
91
-	$emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) );
89
+	$emails->__set('from_name', $from_name);
90
+	$emails->__set('from_email', $from_email);
91
+	$emails->__set('heading', esc_html__('Donation Receipt', 'give'));
92 92
 
93
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
94
-	$emails->__set( 'headers', $headers );
93
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
94
+	$emails->__set('headers', $headers);
95 95
 
96
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
96
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
97 97
 
98 98
 }
99 99
 
@@ -107,50 +107,50 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return void
109 109
  */
110
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
110
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
111 111
 
112
-	$payment_id = absint( $payment_id );
112
+	$payment_id = absint($payment_id);
113 113
 
114
-	if ( empty( $payment_id ) ) {
114
+	if (empty($payment_id)) {
115 115
 		return;
116 116
 	}
117 117
 
118
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
118
+	if ( ! give_get_payment_by('id', $payment_id)) {
119 119
 		return;
120 120
 	}
121 121
 
122
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
123
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
122
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
123
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
124 124
 
125
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
126
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
125
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
126
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
127 127
 
128 128
 	/* translators: %s: payment id */
129
-	$subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) );
130
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
131
-	$subject = give_do_email_tags( $subject, $payment_id );
129
+	$subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id));
130
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
131
+	$subject = give_do_email_tags($subject, $payment_id);
132 132
 
133
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
134
-	$headers .= "Reply-To: " . $from_email . "\r\n";
133
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
134
+	$headers .= "Reply-To: ".$from_email."\r\n";
135 135
 	//$headers  .= "MIME-Version: 1.0\r\n";
136 136
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
137
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
137
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
138 138
 
139
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
139
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
140 140
 
141
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
141
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
142 142
 
143 143
 	$emails = Give()->emails;
144
-	$emails->__set( 'from_name', $from_name );
145
-	$emails->__set( 'from_email', $from_email );
146
-	$emails->__set( 'headers', $headers );
147
-	$emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) );
144
+	$emails->__set('from_name', $from_name);
145
+	$emails->__set('from_email', $from_email);
146
+	$emails->__set('headers', $headers);
147
+	$emails->__set('heading', esc_html__('New Donation!', 'give'));
148 148
 
149
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
149
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
150 150
 
151 151
 }
152 152
 
153
-add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 );
153
+add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2);
154 154
 
155 155
 /**
156 156
  * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings).
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 
163 163
 	$email_option = give_get_option('admin_notice_emails');
164 164
 
165
-	$emails = !empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' );
166
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
165
+	$emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email');
166
+	$emails = array_map('trim', explode("\n", $emails));
167 167
 
168
-	return apply_filters( 'give_admin_notice_emails', $emails );
168
+	return apply_filters('give_admin_notice_emails', $emails);
169 169
 }
170 170
 
171 171
 /**
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return mixed
179 179
  */
180
-function give_admin_notices_disabled( $payment_id = 0 ) {
180
+function give_admin_notices_disabled($payment_id = 0) {
181 181
 
182
-	$retval = give_get_option( 'disable_admin_notices' );
182
+	$retval = give_get_option('disable_admin_notices');
183 183
 
184
-	return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id );
184
+	return apply_filters('give_admin_notices_disabled', $retval, $payment_id);
185 185
 }
186 186
 
187 187
 /**
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function give_get_default_donation_notification_email() {
196 196
 
197
-	$default_email_body  = esc_html__( 'Hi there,', 'give' ) . "\n\n";
198
-	$default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
199
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n";
200
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
201
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {price}' . "\n";
202
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n";
203
-	$default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n";
204
-	$default_email_body .= '{sitename}' . "\n";
197
+	$default_email_body  = esc_html__('Hi there,', 'give')."\n\n";
198
+	$default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
199
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n";
200
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
201
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {price}'."\n";
202
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n";
203
+	$default_email_body .= esc_html__('Thank you,', 'give')."\n\n";
204
+	$default_email_body .= '{sitename}'."\n";
205 205
 
206
-	$custom_message = give_get_option( 'donation_notification' );
207
-	$message        = ! empty( $custom_message ) ? $custom_message : $default_email_body;
206
+	$custom_message = give_get_option('donation_notification');
207
+	$message        = ! empty($custom_message) ? $custom_message : $default_email_body;
208 208
 
209
-	return apply_filters( 'give_default_donation_notification_email', $message );
209
+	return apply_filters('give_default_donation_notification_email', $message);
210 210
 }
211 211
 
212 212
 
@@ -220,25 +220,25 @@  discard block
 block discarded – undo
220 220
  */
221 221
 function give_get_default_donation_receipt_email() {
222 222
 
223
-	$default_email_body  = esc_html__( 'Dear', 'give' ) . " {name},\n\n";
224
-	$default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
225
-	$default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
226
-	$default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n";
227
-	$default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n";
228
-	$default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {price}' . "\n";
229
-	$default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n";
230
-	$default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n";
231
-	$default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n";
232
-	$default_email_body .= '{receipt_link}' . "\n\n";
223
+	$default_email_body  = esc_html__('Dear', 'give')." {name},\n\n";
224
+	$default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
225
+	$default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n";
226
+	$default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n";
227
+	$default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n";
228
+	$default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {price}'."\n";
229
+	$default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n";
230
+	$default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n";
231
+	$default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n";
232
+	$default_email_body .= '{receipt_link}'."\n\n";
233 233
 	$default_email_body .= "\n\n";
234
-	$default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n";
235
-	$default_email_body .= '{sitename}' . "\n";
234
+	$default_email_body .= esc_html__('Sincerely,', 'give')."\n";
235
+	$default_email_body .= '{sitename}'."\n";
236 236
 
237
-	$custom_message = give_get_option( 'donation_receipt' );
237
+	$custom_message = give_get_option('donation_receipt');
238 238
 
239
-	$message = ! empty( $custom_message ) ? $custom_message : $default_email_body;
239
+	$message = ! empty($custom_message) ? $custom_message : $default_email_body;
240 240
 
241
-	return apply_filters( 'give_default_donation_receipt_email', $message );
241
+	return apply_filters('give_default_donation_receipt_email', $message);
242 242
 }
243 243
 
244 244
 /**
@@ -250,19 +250,19 @@  discard block
 block discarded – undo
250 250
  *
251 251
  * @return array $email_names
252 252
  */
253
-function give_get_email_names( $user_info ) {
253
+function give_get_email_names($user_info) {
254 254
 	$email_names = array();
255
-	$user_info   = maybe_unserialize( $user_info );
255
+	$user_info   = maybe_unserialize($user_info);
256 256
 
257 257
 	$email_names['fullname'] = '';
258
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
259
-		$user_data               = get_userdata( $user_info['id'] );
258
+	if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
259
+		$user_data               = get_userdata($user_info['id']);
260 260
 		$email_names['name']     = $user_info['first_name'];
261
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
261
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
262 262
 		$email_names['username'] = $user_data->user_login;
263
-	} elseif ( isset( $user_info['first_name'] ) ) {
263
+	} elseif (isset($user_info['first_name'])) {
264 264
 		$email_names['name']     = $user_info['first_name'];
265
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
265
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
266 266
 		$email_names['username'] = $user_info['first_name'];
267 267
 	} else {
268 268
 		$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -56,38 +56,38 @@  discard block
 block discarded – undo
56 56
  *
57 57
  * @return string $message Fully formatted message
58 58
  */
59
-function give_email_preview_template_tags( $message ) {
59
+function give_email_preview_template_tags($message) {
60 60
 
61
-	$price = give_currency_filter( give_format_amount( 10.50 ) );
61
+	$price = give_currency_filter(give_format_amount(10.50));
62 62
 
63 63
 	$gateway = 'PayPal';
64 64
 
65
-	$receipt_id = strtolower( md5( uniqid() ) );
65
+	$receipt_id = strtolower(md5(uniqid()));
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69 69
 	$receipt_link = sprintf(
70 70
 		'<a href="%1$s">%2$s</a>',
71
-		esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ),
72
-		esc_html__( 'View the receipt in your browser &raquo;', 'give' )
71
+		esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())),
72
+		esc_html__('View the receipt in your browser &raquo;', 'give')
73 73
 	);
74 74
 
75 75
 	$user = wp_get_current_user();
76 76
 
77
-	$message = str_replace( '{name}', $user->display_name, $message );
78
-	$message = str_replace( '{fullname}', $user->display_name, $message );
79
-	$message = str_replace( '{username}', $user->user_login, $message );
80
-	$message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message );
81
-	$message = str_replace( '{price}', $price, $message );
82
-	$message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message );
83
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
84
-	$message = str_replace( '{payment_method}', $gateway, $message );
85
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
86
-	$message = str_replace( '{payment_id}', $payment_id, $message );
87
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
88
-	$message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message );
89
-
90
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
77
+	$message = str_replace('{name}', $user->display_name, $message);
78
+	$message = str_replace('{fullname}', $user->display_name, $message);
79
+	$message = str_replace('{username}', $user->user_login, $message);
80
+	$message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message);
81
+	$message = str_replace('{price}', $price, $message);
82
+	$message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message);
83
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
84
+	$message = str_replace('{payment_method}', $gateway, $message);
85
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
86
+	$message = str_replace('{payment_id}', $payment_id, $message);
87
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
88
+	$message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message);
89
+
90
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
91 91
 }
92 92
 
93 93
 /**
@@ -99,23 +99,23 @@  discard block
 block discarded – undo
99 99
  * @since  1.0
100 100
  * @return array|bool
101 101
  */
102
-function give_email_template_preview( $array ) {
102
+function give_email_template_preview($array) {
103 103
 
104
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
104
+	if ( ! current_user_can('manage_give_settings')) {
105 105
 		return false;
106 106
 	}
107 107
 	$custom_field = array(
108
-		'name' => esc_html__( 'Preview Email', 'give' ),
109
-		'desc' => esc_html__( 'Click the buttons to preview emails.', 'give' ),
108
+		'name' => esc_html__('Preview Email', 'give'),
109
+		'desc' => esc_html__('Click the buttons to preview emails.', 'give'),
110 110
 		'id'   => 'give_email_preview_buttons',
111 111
 		'type' => 'email_preview_buttons'
112 112
 	);
113 113
 
114
-	return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) );
114
+	return give_settings_array_insert($array, 'donation_subject', array($custom_field));
115 115
 
116 116
 }
117 117
 
118
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
118
+add_filter('give_settings_emails', 'give_email_template_preview');
119 119
 
120 120
 /**
121 121
  * Output Email Template Preview Buttons.
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 function give_email_preview_buttons_callback() {
128 128
 	ob_start();
129 129
 	?>
130
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a>
131
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
130
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a>
131
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
132 132
 		'give_action'  => 'send_test_email',
133 133
 		'give-message' => 'sent-test-email',
134 134
 		'tag'          => 'emails'
135
-	) ), 'give-test-email' ); ?>" title="<?php esc_attr_e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a>
135
+	)), 'give-test-email'); ?>" title="<?php esc_attr_e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a>
136 136
 	<?php
137 137
 	echo ob_get_clean();
138 138
 }
@@ -145,46 +145,46 @@  discard block
 block discarded – undo
145 145
  */
146 146
 function give_display_email_template_preview() {
147 147
 
148
-	if ( empty( $_GET['give_action'] ) ) {
148
+	if (empty($_GET['give_action'])) {
149 149
 		return;
150 150
 	}
151 151
 
152
-	if ( 'preview_email' !== $_GET['give_action'] ) {
152
+	if ('preview_email' !== $_GET['give_action']) {
153 153
 		return;
154 154
 	}
155 155
 
156
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
156
+	if ( ! current_user_can('manage_give_settings')) {
157 157
 		return;
158 158
 	}
159 159
 
160 160
 
161
-	Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' );
161
+	Give()->emails->heading = esc_html__('Donation Receipt', 'give');
162 162
 
163
-	$payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
163
+	$payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
164 164
 
165 165
 	echo give_get_preview_email_header();
166 166
 
167 167
 	//Are we previewing an actual payment?
168
-	if ( ! empty( $payment_id ) ) {
168
+	if ( ! empty($payment_id)) {
169 169
 
170
-		$content = give_get_email_body_content( $payment_id );
170
+		$content = give_get_email_body_content($payment_id);
171 171
 
172
-		$preview_content = give_do_email_tags( $content, $payment_id );
172
+		$preview_content = give_do_email_tags($content, $payment_id);
173 173
 
174 174
 	} else {
175 175
 
176 176
 		//No payment ID, use sample preview content
177
-		$preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
177
+		$preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array()));
178 178
 	}
179 179
 
180 180
 
181
-	echo Give()->emails->build_email( $preview_content );
181
+	echo Give()->emails->build_email($preview_content);
182 182
 
183 183
 	exit;
184 184
 
185 185
 }
186 186
 
187
-add_action( 'init', 'give_display_email_template_preview' );
187
+add_action('init', 'give_display_email_template_preview');
188 188
 
189 189
 /**
190 190
  * Email Template Body.
@@ -196,18 +196,18 @@  discard block
 block discarded – undo
196 196
  *
197 197
  * @return string $email_body Body of the email
198 198
  */
199
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
199
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
200 200
 
201 201
 	$default_email_body = give_get_default_donation_receipt_email();
202 202
 
203
-	$email_content = give_get_option( 'donation_receipt' );
204
-	$email_content = isset( $email_content ) ? stripslashes( $email_content ) : $default_email_body;
203
+	$email_content = give_get_option('donation_receipt');
204
+	$email_content = isset($email_content) ? stripslashes($email_content) : $default_email_body;
205 205
 
206
-	$email_body = wpautop( $email_content );
206
+	$email_body = wpautop($email_content);
207 207
 
208
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
208
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
209 209
 
210
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
210
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
211 211
 }
212 212
 
213 213
 /**
@@ -220,37 +220,37 @@  discard block
 block discarded – undo
220 220
  *
221 221
  * @return string $email_body Body of the email
222 222
  */
223
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
223
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
224 224
 
225
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
226
-	$email     = give_get_payment_user_email( $payment_id );
225
+	$user_info = maybe_unserialize($payment_data['user_info']);
226
+	$email     = give_get_payment_user_email($payment_id);
227 227
 
228
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
229
-		$user_data = get_userdata( $user_info['id'] );
228
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
229
+		$user_data = get_userdata($user_info['id']);
230 230
 		$name      = $user_data->display_name;
231
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
232
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
231
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
232
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
233 233
 	} else {
234 234
 		$name = $email;
235 235
 	}
236 236
 
237
-	$gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) );
237
+	$gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
238 238
 
239
-	$default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n";
240
-	$default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n";
239
+	$default_email_body = esc_html__('Hello', 'give')."\n\n";
240
+	$default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n";
241 241
 	/* translators: %s: form plural label */
242
-	$default_email_body .= sprintf( esc_html__( '%s sold:', 'give' ), give_get_forms_label_plural() ) . "\n\n";
243
-	$default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
244
-	$default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
245
-	$default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n";
246
-	$default_email_body .= esc_html__( 'Thank you', 'give' );
242
+	$default_email_body .= sprintf(esc_html__('%s sold:', 'give'), give_get_forms_label_plural())."\n\n";
243
+	$default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
244
+	$default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n";
245
+	$default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n";
246
+	$default_email_body .= esc_html__('Thank you', 'give');
247 247
 
248
-	$email = give_get_option( 'donation_notification' );
249
-	$email = isset( $email ) ? stripslashes( $email ) : $default_email_body;
248
+	$email = give_get_option('donation_notification');
249
+	$email = isset($email) ? stripslashes($email) : $default_email_body;
250 250
 
251
-	$email_body = give_do_email_tags( $email, $payment_id );
251
+	$email_body = give_do_email_tags($email, $payment_id);
252 252
 
253
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
253
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
254 254
 }
255 255
 
256 256
 /**
@@ -263,34 +263,34 @@  discard block
 block discarded – undo
263 263
  * @since  1.0
264 264
  */
265 265
 function give_render_receipt_in_browser() {
266
-	if ( ! isset( $_GET['payment_key'] ) ) {
267
-		wp_die( esc_html__( 'Missing donation payment key.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
266
+	if ( ! isset($_GET['payment_key'])) {
267
+		wp_die(esc_html__('Missing donation payment key.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
268 268
 	}
269 269
 
270
-	$key = urlencode( $_GET['payment_key'] );
270
+	$key = urlencode($_GET['payment_key']);
271 271
 
272 272
 	ob_start();
273 273
 	//Disallows caching of the page
274
-	header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
275
-	header( "Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1
276
-	header( "Cache-Control: post-check=0, pre-check=0", false );
277
-	header( "Pragma: no-cache" ); // HTTP/1.0
278
-	header( "Expires: Sat, 23 Oct 1977 05:00:00 PST" ); // Date in the past
274
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
275
+	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
276
+	header("Cache-Control: post-check=0, pre-check=0", false);
277
+	header("Pragma: no-cache"); // HTTP/1.0
278
+	header("Expires: Sat, 23 Oct 1977 05:00:00 PST"); // Date in the past
279 279
 	?>
280 280
 	<!DOCTYPE html>
281 281
 	<html lang="en">
282 282
 	<head>
283
-		<?php do_action( 'give_receipt_head' ); ?>
283
+		<?php do_action('give_receipt_head'); ?>
284 284
 	</head>
285
-	<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
285
+	<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
286 286
 
287 287
 	<div id="give_receipt_wrapper">
288
-		<?php do_action( 'give_render_receipt_in_browser_before' ); ?>
289
-		<?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?>
290
-		<?php do_action( 'give_render_receipt_in_browser_after' ); ?>
288
+		<?php do_action('give_render_receipt_in_browser_before'); ?>
289
+		<?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?>
290
+		<?php do_action('give_render_receipt_in_browser_after'); ?>
291 291
 	</div>
292 292
 
293
-	<?php do_action( 'give_receipt_footer' ); ?>
293
+	<?php do_action('give_receipt_footer'); ?>
294 294
 	</body>
295 295
 	</html>
296 296
 	<?php
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	die();
299 299
 }
300 300
 
301
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
301
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
302 302
 
303 303
 
304 304
 /**
@@ -313,29 +313,29 @@  discard block
 block discarded – undo
313 313
 
314 314
 	//Payment receipt switcher
315 315
 	$payment_count = give_count_payments()->publish;
316
-	$payment_id    = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : '';
316
+	$payment_id    = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : '';
317 317
 
318
-	if ( $payment_count <= 0 ) {
318
+	if ($payment_count <= 0) {
319 319
 		return false;
320 320
 	}
321 321
 
322 322
 	//Get payments.
323
-	$payments = new Give_Payments_Query( array(
323
+	$payments = new Give_Payments_Query(array(
324 324
 		'number' => 100
325
-	) );
325
+	));
326 326
 	$payments = $payments->get_payments();
327 327
 	$options  = array();
328 328
 
329 329
 	//Provide nice human readable options.
330
-	if ( $payments ) {
331
-		$options[0] = esc_html__( '- Select a transaction -', 'give' );
332
-		foreach ( $payments as $payment ) {
330
+	if ($payments) {
331
+		$options[0] = esc_html__('- Select a transaction -', 'give');
332
+		foreach ($payments as $payment) {
333 333
 
334
-			$options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title );
334
+			$options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title);
335 335
 
336 336
 		}
337 337
 	} else {
338
-		$options[0] = esc_html__( 'No Transactions Found', 'give' );
338
+		$options[0] = esc_html__('No Transactions Found', 'give');
339 339
 	}
340 340
 
341 341
 	//Start constructing HTML output.
@@ -348,16 +348,16 @@  discard block
 block discarded – undo
348 348
 			        var selected_trans = transactions.options[transactions.selectedIndex];
349 349
 				        console.log(selected_trans);
350 350
 				        if (selected_trans){
351
-				            var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value;
351
+				            var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value;
352 352
 				                window.location = url_string;
353 353
 				        }
354 354
 				    }
355 355
 			    </script>';
356 356
 
357
-	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a transaction:', 'give' ) . '</label>';
357
+	$transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a transaction:', 'give').'</label>';
358 358
 
359 359
 	//The select field with 100 latest transactions
360
-	$transaction_header .= Give()->html->select( array(
360
+	$transaction_header .= Give()->html->select(array(
361 361
 		'name'             => 'preview_email_payment_id',
362 362
 		'selected'         => $payment_id,
363 363
 		'id'               => 'give_preview_email_payment_id',
@@ -367,12 +367,12 @@  discard block
 block discarded – undo
367 367
 		'select_atts'      => 'onchange="change_preview()">',
368 368
 		'show_option_all'  => false,
369 369
 		'show_option_none' => false
370
-	) );
370
+	));
371 371
 
372 372
 	//Closing tag
373 373
 	$transaction_header .= '</div>';
374 374
 
375
-	return apply_filters( 'give_preview_email_receipt_header', $transaction_header );
375
+	return apply_filters('give_preview_email_receipt_header', $transaction_header);
376 376
 
377 377
 }
378 378
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 function give_receipt_head_content() {
387 387
 
388 388
 	//Title.
389
-	$output = '<title>' . esc_html__( 'Donation Receipt', 'give' ) . '</title>';
389
+	$output = '<title>'.esc_html__('Donation Receipt', 'give').'</title>';
390 390
 
391 391
 	//Meta.
392 392
 	$output .= '<meta charset="utf-8"/>
@@ -400,10 +400,10 @@  discard block
 block discarded – undo
400 400
 		<meta name="robots" content="noindex, nofollow"/>';
401 401
 
402 402
 	//CSS
403
-	$output .= '<link rel="stylesheet" href="' . give_get_stylesheet_uri() . '?ver=' . GIVE_VERSION . '">';
403
+	$output .= '<link rel="stylesheet" href="'.give_get_stylesheet_uri().'?ver='.GIVE_VERSION.'">';
404 404
 
405
-	echo apply_filters( 'give_receipt_head_content', $output );
405
+	echo apply_filters('give_receipt_head_content', $output);
406 406
 
407 407
 }
408 408
 
409
-add_action( 'give_receipt_head', 'give_receipt_head_content' );
410 409
\ No newline at end of file
410
+add_action('give_receipt_head', 'give_receipt_head_content');
411 411
\ No newline at end of file
Please login to merge, or discard this patch.