Completed
Pull Request — master (#3647)
by
unknown
16:02 queued 07:01
created
includes/admin/forms/metabox.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_add_shortcode_to_publish_metabox() {
24 24
 
25
-	if ( 'give_forms' !== get_post_type() ) {
25
+	if ('give_forms' !== get_post_type()) {
26 26
 		return false;
27 27
 	}
28 28
 	global $post;
29 29
 
30 30
 	//Only enqueue scripts for CPT on post type screen
31
-	if ( 'give_forms' === $post->post_type ) {
31
+	if ('give_forms' === $post->post_type) {
32 32
 		//Shortcode column with select all input
33
-		$shortcode = sprintf( '[give_form id="%s"]', absint( $post->ID ) );
33
+		$shortcode = sprintf('[give_form id="%s"]', absint($post->ID));
34 34
 		printf(
35 35
 			'<div class="misc-pub-section"><button type="button" class="button give-shortcode-tooltip give-shortcode-tooltip--top js-give-shortcode-button" aria-label="%1$s" data-give-shortcode="%2$s"><span class="dashicons dashicons-admin-page"></span>%3$s</button></div>',
36
-			esc_attr( $shortcode ),
37
-			esc_attr( $shortcode ),
38
-			esc_html__( 'Copy Shortcode', 'give' )
36
+			esc_attr($shortcode),
37
+			esc_attr($shortcode),
38
+			esc_html__('Copy Shortcode', 'give')
39 39
 		);
40 40
 	}
41 41
 
42 42
 }
43 43
 
44
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
44
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/admin/tools/export/pdf-reports.php 1 patch
Spacing   +161 added lines, -161 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,143 +25,143 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @uses   give_pdf
27 27
  */
28
-function give_generate_pdf( $data ) {
28
+function give_generate_pdf($data) {
29 29
 
30
-	if ( ! current_user_can( 'view_give_reports' ) ) {
31
-		wp_die( __( 'You do not have permission to generate PDF sales reports.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('view_give_reports')) {
31
+		wp_die(__('You do not have permission to generate PDF sales reports.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	if ( ! wp_verify_nonce( $_GET['_wpnonce'], 'give_generate_pdf' ) ) {
35
-		wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
34
+	if ( ! wp_verify_nonce($_GET['_wpnonce'], 'give_generate_pdf')) {
35
+		wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
36 36
 	}
37 37
 
38
-	if ( ! file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php' ) ) {
39
-		wp_die( __( 'Dependency missing.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
38
+	if ( ! file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php')) {
39
+		wp_die(__('Dependency missing.', 'give'), __('Error', 'give'), array('response' => 403));
40 40
 	}
41 41
 
42
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/give-pdf.php';
42
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/give-pdf.php';
43 43
 
44 44
 	$daterange = utf8_decode(
45 45
 		sprintf(
46 46
 		/* translators: 1: start date 2: end date */
47
-			__( '%1$s to %2$s', 'give' ),
48
-			date_i18n( give_date_format(), mktime( 0, 0, 0, 1, 1, date( 'Y' ) ) ),
49
-			date_i18n( give_date_format() )
47
+			__('%1$s to %2$s', 'give'),
48
+			date_i18n(give_date_format(), mktime(0, 0, 0, 1, 1, date('Y'))),
49
+			date_i18n(give_date_format())
50 50
 		)
51 51
 	);
52 52
 
53
-	$categories_enabled = give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) );
54
-	$tags_enabled       = give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) );
53
+	$categories_enabled = give_is_setting_enabled(give_get_option('categories', 'disabled'));
54
+	$tags_enabled       = give_is_setting_enabled(give_get_option('tags', 'disabled'));
55 55
 
56
-	$pdf          = new Give_PDF( 'L', 'mm', 'A', true, 'UTF-8', false );
57
-	$default_font = apply_filters( 'give_pdf_default_font', 'Helvetica' );
56
+	$pdf          = new Give_PDF('L', 'mm', 'A', true, 'UTF-8', false);
57
+	$default_font = apply_filters('give_pdf_default_font', 'Helvetica');
58 58
 	$custom_font  = 'dejavusans';
59 59
 	$font_style   = '';
60 60
 	$font_path    = '';
61 61
 
62
-	if ( file_exists( GIVE_PLUGIN_DIR . 'vendor/autoload.php' ) ) {
63
-		$font_path = GIVE_PLUGIN_DIR . '/vendor/tecnickcom/tcpdf/fonts/CODE2000.TTF';
62
+	if (file_exists(GIVE_PLUGIN_DIR.'vendor/autoload.php')) {
63
+		$font_path = GIVE_PLUGIN_DIR.'/vendor/tecnickcom/tcpdf/fonts/CODE2000.TTF';
64 64
 	} else {
65
-		$font_path = GIVE_PLUGIN_DIR . '/includes/libraries/tcpdf/fonts/CODE2000.TTF';
65
+		$font_path = GIVE_PLUGIN_DIR.'/includes/libraries/tcpdf/fonts/CODE2000.TTF';
66 66
 	}
67 67
 
68 68
 	if (
69
-		file_exists( $font_path ) &&
69
+		file_exists($font_path) &&
70 70
 
71 71
 		// RIAL exist for backward compatibility.
72
-		in_array( give_get_currency(), array( 'RIAL', 'RUB', 'IRR' ) )
72
+		in_array(give_get_currency(), array('RIAL', 'RUB', 'IRR'))
73 73
 	) {
74
-		TCPDF_FONTS::addTTFfont( $font_path, '' );
74
+		TCPDF_FONTS::addTTFfont($font_path, '');
75 75
 		$custom_font = 'CODE2000';
76 76
 		$font_style  = 'B';
77 77
 	}
78 78
 
79
-	$pdf->AddPage( 'L', 'A4' );
80
-	$pdf->setImageScale( 1.5 );
81
-	$pdf->SetTitle( utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ) );
82
-	$pdf->SetAuthor( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
83
-	$pdf->SetCreator( utf8_decode( __( 'Give - Democratizing Generosity', 'give' ) ) );
79
+	$pdf->AddPage('L', 'A4');
80
+	$pdf->setImageScale(1.5);
81
+	$pdf->SetTitle(utf8_decode(__('Donation report for the current year for all forms', 'give')));
82
+	$pdf->SetAuthor(utf8_decode(__('Give - Democratizing Generosity', 'give')));
83
+	$pdf->SetCreator(utf8_decode(__('Give - Democratizing Generosity', 'give')));
84 84
 
85 85
 	// Image URL should have absolute path. @see https://tcpdf.org/examples/example_009/.
86
-	$pdf->Image( apply_filters( 'give_pdf_export_logo', GIVE_PLUGIN_DIR . 'assets/dist/images/give-logo-small.png' ), 247, 8 );
86
+	$pdf->Image(apply_filters('give_pdf_export_logo', GIVE_PLUGIN_DIR.'assets/dist/images/give-logo-small.png'), 247, 8);
87 87
 
88
-	$pdf->SetMargins( 8, 8, 8 );
89
-	$pdf->SetX( 8 );
88
+	$pdf->SetMargins(8, 8, 8);
89
+	$pdf->SetX(8);
90 90
 
91
-	$pdf->SetFont( $default_font, '', 16 );
92
-	$pdf->SetTextColor( 50, 50, 50 );
93
-	$pdf->Cell( 0, 3, utf8_decode( __( 'Donation report for the current year for all forms', 'give' ) ), 0, 2, 'L', false );
91
+	$pdf->SetFont($default_font, '', 16);
92
+	$pdf->SetTextColor(50, 50, 50);
93
+	$pdf->Cell(0, 3, utf8_decode(__('Donation report for the current year for all forms', 'give')), 0, 2, 'L', false);
94 94
 
95
-	$pdf->SetFont( $default_font, '', 13 );
96
-	$pdf->SetTextColor( 150, 150, 150 );
97
-	$pdf->Ln( 1 );
98
-	$pdf->Cell( 0, 6, utf8_decode( __( 'Date Range: ', 'give' ) ) . $daterange, 0, 2, 'L', false );
95
+	$pdf->SetFont($default_font, '', 13);
96
+	$pdf->SetTextColor(150, 150, 150);
97
+	$pdf->Ln(1);
98
+	$pdf->Cell(0, 6, utf8_decode(__('Date Range: ', 'give')).$daterange, 0, 2, 'L', false);
99 99
 	$pdf->Ln();
100
-	$pdf->SetTextColor( 50, 50, 50 );
101
-	$pdf->SetFont( $default_font, '', 14 );
102
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Table View', 'give' ) ), 0, 2, 'L', false );
103
-	$pdf->SetFont( $default_font, '', 12 );
100
+	$pdf->SetTextColor(50, 50, 50);
101
+	$pdf->SetFont($default_font, '', 14);
102
+	$pdf->Cell(0, 10, utf8_decode(__('Table View', 'give')), 0, 2, 'L', false);
103
+	$pdf->SetFont($default_font, '', 12);
104 104
 
105
-	$pdf->SetFillColor( 238, 238, 238 );
106
-	$pdf->SetTextColor( 0, 0, 0, 100 ); // Set Black color.
107
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Form Name', 'give' ) ), 1, 0, 'L', true );
108
-	$pdf->Cell( 50, 6, utf8_decode( __( 'Price', 'give' ) ), 1, 0, 'L', true );
105
+	$pdf->SetFillColor(238, 238, 238);
106
+	$pdf->SetTextColor(0, 0, 0, 100); // Set Black color.
107
+	$pdf->Cell(50, 6, utf8_decode(__('Form Name', 'give')), 1, 0, 'L', true);
108
+	$pdf->Cell(50, 6, utf8_decode(__('Price', 'give')), 1, 0, 'L', true);
109 109
 
110 110
 	// Display Categories Heading only, if user has opted for it.
111
-	if ( $categories_enabled ) {
112
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Categories', 'give' ) ), 1, 0, 'L', true );
111
+	if ($categories_enabled) {
112
+		$pdf->Cell(45, 6, utf8_decode(__('Categories', 'give')), 1, 0, 'L', true);
113 113
 	}
114 114
 
115 115
 	// Display Tags Heading only, if user has opted for it.
116
-	if ( $tags_enabled ) {
117
-		$pdf->Cell( 45, 6, utf8_decode( __( 'Tags', 'give' ) ), 1, 0, 'L', true );
116
+	if ($tags_enabled) {
117
+		$pdf->Cell(45, 6, utf8_decode(__('Tags', 'give')), 1, 0, 'L', true);
118 118
 	}
119 119
 
120
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Number of Donations', 'give' ) ), 1, 0, 'L', true );
121
-	$pdf->Cell( 45, 6, utf8_decode( __( 'Income to Date', 'give' ) ), 1, 1, 'L', true );
120
+	$pdf->Cell(45, 6, utf8_decode(__('Number of Donations', 'give')), 1, 0, 'L', true);
121
+	$pdf->Cell(45, 6, utf8_decode(__('Income to Date', 'give')), 1, 1, 'L', true);
122 122
 
123 123
 	// Set Custom Font to support various currencies.
124
-	$pdf->SetFont( apply_filters( 'give_pdf_custom_font', $custom_font ), $font_style, 12 );
124
+	$pdf->SetFont(apply_filters('give_pdf_custom_font', $custom_font), $font_style, 12);
125 125
 
126 126
 	// Object for getting stats.
127 127
 	$donation_stats = new Give_Payment_Stats();
128 128
 
129
-	$give_forms = get_posts( array(
129
+	$give_forms = get_posts(array(
130 130
 		'post_type'        => 'give_forms',
131
-		'posts_per_page'   => - 1,
131
+		'posts_per_page'   => -1,
132 132
 		'suppress_filters' => false,
133
-	) );
133
+	));
134 134
 
135
-	if ( $give_forms ) {
136
-		$pdf->SetWidths( array( 50, 50, 45, 45, 45, 45 ) );
135
+	if ($give_forms) {
136
+		$pdf->SetWidths(array(50, 50, 45, 45, 45, 45));
137 137
 
138
-		foreach ( $give_forms as $form ):
139
-			$pdf->SetFillColor( 255, 255, 255 );
138
+		foreach ($give_forms as $form):
139
+			$pdf->SetFillColor(255, 255, 255);
140 140
 
141 141
 			$title = $form->post_title;
142 142
 
143
-			if ( give_has_variable_prices( $form->ID ) ) {
144
-				$price = html_entity_decode( give_price_range( $form->ID, false ), ENT_COMPAT, 'UTF-8' );
143
+			if (give_has_variable_prices($form->ID)) {
144
+				$price = html_entity_decode(give_price_range($form->ID, false), ENT_COMPAT, 'UTF-8');
145 145
 			} else {
146
-				$price = give_currency_filter( give_get_form_price( $form->ID ), array( 'decode_currency' => true ) );
146
+				$price = give_currency_filter(give_get_form_price($form->ID), array('decode_currency' => true));
147 147
 			}
148 148
 
149 149
 			// Display Categories Data only, if user has opted for it.
150 150
 			$categories = array();
151
-			if ( $categories_enabled ) {
152
-				$categories = get_the_term_list( $form->ID, 'give_forms_category', '', ', ', '' );
153
-				$categories = ! is_wp_error( $categories ) ? strip_tags( $categories ) : '';
151
+			if ($categories_enabled) {
152
+				$categories = get_the_term_list($form->ID, 'give_forms_category', '', ', ', '');
153
+				$categories = ! is_wp_error($categories) ? strip_tags($categories) : '';
154 154
 			}
155 155
 
156 156
 			// Display Tags Data only, if user has opted for it.
157 157
 			$tags = array();
158
-			if ( $tags_enabled ) {
159
-				$tags = get_the_term_list( $form->ID, 'give_forms_tag', '', ', ', '' );
160
-				$tags = ! is_wp_error( $tags ) ? strip_tags( $tags ) : '';
158
+			if ($tags_enabled) {
159
+				$tags = get_the_term_list($form->ID, 'give_forms_tag', '', ', ', '');
160
+				$tags = ! is_wp_error($tags) ? strip_tags($tags) : '';
161 161
 			}
162 162
 
163
-			$sales    = $donation_stats->get_sales( $form->ID, 'this_year' );
164
-			$earnings = give_currency_filter( give_format_amount( $donation_stats->get_earnings( $form->ID, 'this_year' ), array( 'sanitize' => false, ) ), array( 'decode_currency' => true ) );
163
+			$sales    = $donation_stats->get_sales($form->ID, 'this_year');
164
+			$earnings = give_currency_filter(give_format_amount($donation_stats->get_earnings($form->ID, 'this_year'), array('sanitize' => false,)), array('decode_currency' => true));
165 165
 
166 166
 			// This will help filter data before appending it to PDF Receipt.
167 167
 			$prepare_pdf_data   = array();
@@ -169,54 +169,54 @@  discard block
 block discarded – undo
169 169
 			$prepare_pdf_data[] = $price;
170 170
 
171 171
 			// Append Categories Data only, if user has opted for it.
172
-			if ( $categories_enabled ) {
172
+			if ($categories_enabled) {
173 173
 				$prepare_pdf_data[] = $categories;
174 174
 			}
175 175
 
176 176
 			// Append Tags Data only, if user has opted for it.
177
-			if ( $tags_enabled ) {
177
+			if ($tags_enabled) {
178 178
 				$prepare_pdf_data[] = $tags;
179 179
 			}
180 180
 
181 181
 			$prepare_pdf_data[] = $sales;
182 182
 			$prepare_pdf_data[] = $earnings;
183 183
 
184
-			$pdf->Row( $prepare_pdf_data );
184
+			$pdf->Row($prepare_pdf_data);
185 185
 
186 186
 		endforeach;
187 187
 	} else {
188 188
 
189 189
 		// Fix: Minor Styling Alignment Issue for PDF.
190
-		if ( $categories_enabled && $tags_enabled ) {
190
+		if ($categories_enabled && $tags_enabled) {
191 191
 			$no_found_width = 280;
192
-		} elseif ( $categories_enabled || $tags_enabled ) {
192
+		} elseif ($categories_enabled || $tags_enabled) {
193 193
 			$no_found_width = 235;
194 194
 		} else {
195 195
 			$no_found_width = 190;
196 196
 		}
197
-		$title = utf8_decode( __( 'No forms found.', 'give' ) );
198
-		$pdf->MultiCell( $no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false );
197
+		$title = utf8_decode(__('No forms found.', 'give'));
198
+		$pdf->MultiCell($no_found_width, 5, $title, 1, 'C', false, 1, '', '', true, 0, false, true, 0, 'T', false);
199 199
 	}// End if().
200 200
 	$pdf->Ln();
201
-	$pdf->SetTextColor( 50, 50, 50 );
202
-	$pdf->SetFont( $default_font, '', 14 );
201
+	$pdf->SetTextColor(50, 50, 50);
202
+	$pdf->SetFont($default_font, '', 14);
203 203
 
204 204
 	// Output Graph on a new page.
205
-	$pdf->AddPage( 'L', 'A4' );
206
-	$pdf->Cell( 0, 10, utf8_decode( __( 'Graph View', 'give' ) ), 0, 2, 'L', false );
207
-	$pdf->SetFont( $default_font, '', 12 );
205
+	$pdf->AddPage('L', 'A4');
206
+	$pdf->Cell(0, 10, utf8_decode(__('Graph View', 'give')), 0, 2, 'L', false);
207
+	$pdf->SetFont($default_font, '', 12);
208 208
 
209
-	$image = html_entity_decode( urldecode( give_draw_chart_image() ) );
210
-	$image = str_replace( ' ', '%20', $image );
209
+	$image = html_entity_decode(urldecode(give_draw_chart_image()));
210
+	$image = str_replace(' ', '%20', $image);
211 211
 
212
-	$pdf->SetX( 25 );
213
-	$pdf->Image( $image . '&file=.png' );
214
-	$pdf->Ln( 7 );
215
-	$pdf->Output( apply_filters( 'give_sales_earnings_pdf_export_filename', 'give-report-' . date_i18n( 'Y-m-d' ) ) . '.pdf', 'D' );
212
+	$pdf->SetX(25);
213
+	$pdf->Image($image.'&file=.png');
214
+	$pdf->Ln(7);
215
+	$pdf->Output(apply_filters('give_sales_earnings_pdf_export_filename', 'give-report-'.date_i18n('Y-m-d')).'.pdf', 'D');
216 216
 	exit();
217 217
 }
218 218
 
219
-add_action( 'give_generate_pdf', 'give_generate_pdf' );
219
+add_action('give_generate_pdf', 'give_generate_pdf');
220 220
 
221 221
 /**
222 222
  * Draws Chart for PDF Report.
@@ -233,38 +233,38 @@  discard block
 block discarded – undo
233 233
  * @return string $chart->getUrl() URL for the Google Chart
234 234
  */
235 235
 function give_draw_chart_image() {
236
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/GoogleChart.php';
237
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
238
-	require_once GIVE_PLUGIN_DIR . '/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
236
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/GoogleChart.php';
237
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartShapeMarker.php';
238
+	require_once GIVE_PLUGIN_DIR.'/includes/libraries/googlechartlib/markers/GoogleChartTextMarker.php';
239 239
 
240
-	$chart = new GoogleChart( 'lc', 900, 330 );
240
+	$chart = new GoogleChart('lc', 900, 330);
241 241
 
242 242
 	$i        = 1;
243 243
 	$earnings = "";
244 244
 	$sales    = "";
245 245
 
246
-	while ( $i <= 12 ) :
247
-		$earnings .= give_get_earnings_by_date( null, $i, date( 'Y' ) ) . ",";
248
-		$sales    .= give_get_sales_by_date( null, $i, date( 'Y' ) ) . ",";
249
-		$i ++;
246
+	while ($i <= 12) :
247
+		$earnings .= give_get_earnings_by_date(null, $i, date('Y')).",";
248
+		$sales    .= give_get_sales_by_date(null, $i, date('Y')).",";
249
+		$i++;
250 250
 	endwhile;
251 251
 
252
-	$earnings_array = explode( ",", $earnings );
253
-	$sales_array    = explode( ",", $sales );
252
+	$earnings_array = explode(",", $earnings);
253
+	$sales_array    = explode(",", $sales);
254 254
 
255 255
 	$i = 0;
256
-	while ( $i <= 11 ) {
257
-		if ( empty( $sales_array[ $i ] ) ) {
258
-			$sales_array[ $i ] = 0;
256
+	while ($i <= 11) {
257
+		if (empty($sales_array[$i])) {
258
+			$sales_array[$i] = 0;
259 259
 		}
260
-		$i ++;
260
+		$i++;
261 261
 	}
262 262
 
263 263
 	$min_earnings   = 0;
264
-	$max_earnings   = max( $earnings_array );
265
-	$earnings_scale = round( $max_earnings, - 1 );
264
+	$max_earnings   = max($earnings_array);
265
+	$earnings_scale = round($max_earnings, - 1);
266 266
 
267
-	$data = new GoogleChartData( array(
267
+	$data = new GoogleChartData(array(
268 268
 		$earnings_array[0],
269 269
 		$earnings_array[1],
270 270
 		$earnings_array[2],
@@ -277,25 +277,25 @@  discard block
 block discarded – undo
277 277
 		$earnings_array[9],
278 278
 		$earnings_array[10],
279 279
 		$earnings_array[11],
280
-	) );
280
+	));
281 281
 
282
-	$data->setLegend( __( 'Income', 'give' ) );
283
-	$data->setColor( '1b58a3' );
284
-	$chart->addData( $data );
282
+	$data->setLegend(__('Income', 'give'));
283
+	$data->setColor('1b58a3');
284
+	$chart->addData($data);
285 285
 
286
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
287
-	$shape_marker->setColor( '000000' );
288
-	$shape_marker->setSize( 7 );
289
-	$shape_marker->setBorder( 2 );
290
-	$shape_marker->setData( $data );
291
-	$chart->addMarker( $shape_marker );
286
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
287
+	$shape_marker->setColor('000000');
288
+	$shape_marker->setSize(7);
289
+	$shape_marker->setBorder(2);
290
+	$shape_marker->setData($data);
291
+	$chart->addMarker($shape_marker);
292 292
 
293
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
294
-	$value_marker->setColor( '000000' );
295
-	$value_marker->setData( $data );
296
-	$chart->addMarker( $value_marker );
293
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
294
+	$value_marker->setColor('000000');
295
+	$value_marker->setData($data);
296
+	$chart->addMarker($value_marker);
297 297
 
298
-	$data = new GoogleChartData( array(
298
+	$data = new GoogleChartData(array(
299 299
 		$sales_array[0],
300 300
 		$sales_array[1],
301 301
 		$sales_array[2],
@@ -308,46 +308,46 @@  discard block
 block discarded – undo
308 308
 		$sales_array[9],
309 309
 		$sales_array[10],
310 310
 		$sales_array[11],
311
-	) );
312
-	$data->setLegend( __( 'Donations', 'give' ) );
313
-	$data->setColor( 'ff6c1c' );
314
-	$chart->addData( $data );
315
-
316
-	$chart->setTitle( __( 'Donations by Month for all Give Forms', 'give' ), '336699', 18 );
317
-
318
-	$chart->setScale( 0, $max_earnings );
319
-
320
-	$y_axis = new GoogleChartAxis( 'y' );
321
-	$y_axis->setDrawTickMarks( true )->setLabels( array( 0, $max_earnings ) );
322
-	$chart->addAxis( $y_axis );
323
-
324
-	$x_axis = new GoogleChartAxis( 'x' );
325
-	$x_axis->setTickMarks( 5 );
326
-	$x_axis->setLabels( array(
327
-		__( 'Jan', 'give' ),
328
-		__( 'Feb', 'give' ),
329
-		__( 'Mar', 'give' ),
330
-		__( 'Apr', 'give' ),
331
-		__( 'May', 'give' ),
332
-		__( 'June', 'give' ),
333
-		__( 'July', 'give' ),
334
-		__( 'Aug', 'give' ),
335
-		__( 'Sept', 'give' ),
336
-		__( 'Oct', 'give' ),
337
-		__( 'Nov', 'give' ),
338
-		__( 'Dec', 'give' ),
339
-	) );
340
-	$chart->addAxis( $x_axis );
341
-
342
-	$shape_marker = new GoogleChartShapeMarker( GoogleChartShapeMarker::CIRCLE );
343
-	$shape_marker->setSize( 6 );
344
-	$shape_marker->setBorder( 2 );
345
-	$shape_marker->setData( $data );
346
-	$chart->addMarker( $shape_marker );
347
-
348
-	$value_marker = new GoogleChartTextMarker( GoogleChartTextMarker::VALUE );
349
-	$value_marker->setData( $data );
350
-	$chart->addMarker( $value_marker );
311
+	));
312
+	$data->setLegend(__('Donations', 'give'));
313
+	$data->setColor('ff6c1c');
314
+	$chart->addData($data);
315
+
316
+	$chart->setTitle(__('Donations by Month for all Give Forms', 'give'), '336699', 18);
317
+
318
+	$chart->setScale(0, $max_earnings);
319
+
320
+	$y_axis = new GoogleChartAxis('y');
321
+	$y_axis->setDrawTickMarks(true)->setLabels(array(0, $max_earnings));
322
+	$chart->addAxis($y_axis);
323
+
324
+	$x_axis = new GoogleChartAxis('x');
325
+	$x_axis->setTickMarks(5);
326
+	$x_axis->setLabels(array(
327
+		__('Jan', 'give'),
328
+		__('Feb', 'give'),
329
+		__('Mar', 'give'),
330
+		__('Apr', 'give'),
331
+		__('May', 'give'),
332
+		__('June', 'give'),
333
+		__('July', 'give'),
334
+		__('Aug', 'give'),
335
+		__('Sept', 'give'),
336
+		__('Oct', 'give'),
337
+		__('Nov', 'give'),
338
+		__('Dec', 'give'),
339
+	));
340
+	$chart->addAxis($x_axis);
341
+
342
+	$shape_marker = new GoogleChartShapeMarker(GoogleChartShapeMarker::CIRCLE);
343
+	$shape_marker->setSize(6);
344
+	$shape_marker->setBorder(2);
345
+	$shape_marker->setData($data);
346
+	$chart->addMarker($shape_marker);
347
+
348
+	$value_marker = new GoogleChartTextMarker(GoogleChartTextMarker::VALUE);
349
+	$value_marker->setData($data);
350
+	$chart->addMarker($value_marker);
351 351
 
352 352
 	return $chart->getUrl();
353 353
 }
Please login to merge, or discard this patch.
includes/admin/emails/class-donor-note-email.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if access directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
18
-if ( ! class_exists( 'Give_Donor_Note_Email' ) ) :
18
+if ( ! class_exists('Give_Donor_Note_Email')) :
19 19
 
20 20
 	/**
21 21
 	 * Give_Donor_Note_Email
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 		 */
36 36
 		public function init() {
37 37
 			// Initialize empty payment.
38
-			$this->payment = new Give_Payment( 0 );
38
+			$this->payment = new Give_Payment(0);
39 39
 
40
-			$this->load( array(
40
+			$this->load(array(
41 41
 				'id'                    => 'donor-note',
42
-				'label'                 => __( 'Donor Note', 'give' ),
43
-				'description'           => __( 'Sent to the donor when new donation note added to there donation.', 'give' ),
42
+				'label'                 => __('Donor Note', 'give'),
43
+				'description'           => __('Sent to the donor when new donation note added to there donation.', 'give'),
44 44
 				'notification_status'   => 'enabled',
45
-				'recipient_group_name'  => __( 'Donor', 'give' ),
45
+				'recipient_group_name'  => __('Donor', 'give'),
46 46
 				'default_email_subject' => sprintf(
47
-					esc_attr__( 'Note added to your %s donation from %s', 'give' ),
47
+					esc_attr__('Note added to your %s donation from %s', 'give'),
48 48
 					'{donation}',
49 49
 					'{date}'
50 50
 				),
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 					'{donor_note}',
54 54
 					'{receipt_link}'
55 55
 				),
56
-				'default_email_header'  => __( 'Donor Note', 'give' ),
57
-			) );
56
+				'default_email_header'  => __('Donor Note', 'give'),
57
+			));
58 58
 
59
-			add_action( "give_{$this->config['id']}_email_notification", array( $this, 'send_note' ), 10, 2 );
59
+			add_action("give_{$this->config['id']}_email_notification", array($this, 'send_note'), 10, 2);
60 60
 		}
61 61
 
62 62
 		/**
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 		 * @param int $donation_id Donation ID.
69 69
 		 * @param int $note_id     Donor comment.
70 70
 		 */
71
-		public function send_note( $note_id, $donation_id ) {
72
-			$this->recipient_email = give_get_donation_donor_email( $donation_id );
71
+		public function send_note($note_id, $donation_id) {
72
+			$this->recipient_email = give_get_donation_donor_email($donation_id);
73 73
 
74 74
 			// Send email.
75
-			$this->send_email_notification( array(
75
+			$this->send_email_notification(array(
76 76
 				'payment_id' => $donation_id,
77 77
 				'note_id'    => $note_id,
78
-			) );
78
+			));
79 79
 		}
80 80
 	}
81 81
 
Please login to merge, or discard this patch.
includes/admin/emails/class-email-notifications.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @return static
53 53
 	 */
54 54
 	static function get_instance() {
55
-		if ( null === static::$instance ) {
55
+		if (null === static::$instance) {
56 56
 			self::$instance = new static();
57 57
 		}
58 58
 
@@ -66,31 +66,31 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function init() {
68 68
 		// Load files.
69
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/ajax-handler.php';
70
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-setting-field.php';
71
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/filters.php';
69
+		require_once GIVE_PLUGIN_DIR.'includes/admin/emails/ajax-handler.php';
70
+		require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-setting-field.php';
71
+		require_once GIVE_PLUGIN_DIR.'includes/admin/emails/filters.php';
72 72
 
73 73
 		// Load email notifications.
74 74
 		$this->add_emails_notifications();
75 75
 
76
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_metabox_setting_fields' ), 10, 2 );
77
-		add_action( 'init', array( $this, 'preview_email' ) );
78
-		add_action( 'init', array( $this, 'send_preview_email' ) );
79
-		add_action( 'init', array( $this, 'validate_settings' ) );
76
+		add_filter('give_metabox_form_data_settings', array($this, 'add_metabox_setting_fields'), 10, 2);
77
+		add_action('init', array($this, 'preview_email'));
78
+		add_action('init', array($this, 'send_preview_email'));
79
+		add_action('init', array($this, 'validate_settings'));
80 80
 
81 81
 		/* @var Give_Email_Notification $email */
82
-		foreach ( $this->get_email_notifications() as $email ) {
82
+		foreach ($this->get_email_notifications() as $email) {
83 83
 			// Setup email section.
84
-			if( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email ) ) {
85
-				add_filter( 'give_get_sections_emails', array( $email, 'add_section' ) );
86
-				add_filter( "give_hide_section_{$email->config['id']}_on_emails_page", array( $email, 'hide_section' ) );
84
+			if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email)) {
85
+				add_filter('give_get_sections_emails', array($email, 'add_section'));
86
+				add_filter("give_hide_section_{$email->config['id']}_on_emails_page", array($email, 'hide_section'));
87 87
 			}
88 88
 
89 89
 			// Setup email preview.
90
-			if ( Give_Email_Notification_Util::is_email_preview_has_header( $email ) ) {
91
-				add_action( "give_{$email->config['id']}_email_preview", array( $this, 'email_preview_header' ) );
92
-				add_filter( "give_{$email->config['id']}_email_preview_data", array( $this, 'email_preview_data' ) );
93
-				add_filter( "give_{$email->config['id']}_email_preview_message", array( $this, 'email_preview_message' ), 1, 2 );
90
+			if (Give_Email_Notification_Util::is_email_preview_has_header($email)) {
91
+				add_action("give_{$email->config['id']}_email_preview", array($this, 'email_preview_header'));
92
+				add_filter("give_{$email->config['id']}_email_preview_data", array($this, 'email_preview_data'));
93
+				add_filter("give_{$email->config['id']}_email_preview_message", array($this, 'email_preview_message'), 1, 2);
94 94
 			}
95 95
 		}
96 96
 	}
@@ -107,63 +107,63 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return array
109 109
 	 */
110
-	public function add_metabox_setting_fields( $settings, $post_id ) {
110
+	public function add_metabox_setting_fields($settings, $post_id) {
111 111
 		$emails = $this->get_email_notifications();
112 112
 
113 113
 		// Bailout.
114
-		if ( empty( $emails ) ) {
114
+		if (empty($emails)) {
115 115
 			return $settings;
116 116
 		}
117 117
 
118 118
 		// Email notification setting.
119 119
 		$settings['email_notification_options'] = array(
120 120
 			'id'         => 'email_notification_options',
121
-			'title'      => __( 'Email Notifications', 'give' ),
121
+			'title'      => __('Email Notifications', 'give'),
122 122
 			'icon-html' => '<span class="dashicons dashicons-email-alt"></span>',
123 123
 			'fields'     => array(
124 124
 				array(
125
-					'name'        => __( 'Email Options', 'give' ),
125
+					'name'        => __('Email Options', 'give'),
126 126
 					'id'          => '_give_email_options',
127 127
 					'type'        => 'radio_inline',
128 128
 					'default'     => 'global',
129 129
 					'options'     => array(
130
-						'global'   => __( 'Global Options' ),
131
-						'enabled'  => __( 'Customize', 'give' ),
130
+						'global'   => __('Global Options'),
131
+						'enabled'  => __('Customize', 'give'),
132 132
 					),
133 133
 				),
134 134
 				array(
135 135
 					'id'      => '_give_email_template',
136
-					'name'    => esc_html__( 'Email Template', 'give' ),
137
-					'desc'    => esc_html__( 'Choose your template from the available registered template types.', 'give' ),
136
+					'name'    => esc_html__('Email Template', 'give'),
137
+					'desc'    => esc_html__('Choose your template from the available registered template types.', 'give'),
138 138
 					'type'    => 'select',
139 139
 					'default' => 'default',
140 140
 					'options' => give_get_email_templates(),
141 141
 				),
142 142
 				array(
143 143
 					'id'   => '_give_email_logo',
144
-					'name' => esc_html__( 'Logo', 'give' ),
145
-					'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' ),
144
+					'name' => esc_html__('Logo', 'give'),
145
+					'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'),
146 146
 					'type' => 'file',
147 147
 				),
148 148
 				array(
149 149
 					'id'      => '_give_from_name',
150
-					'name'    => esc_html__( 'From Name', 'give' ),
151
-					'desc'    => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ),
152
-					'default' => get_bloginfo( 'name' ),
150
+					'name'    => esc_html__('From Name', 'give'),
151
+					'desc'    => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'),
152
+					'default' => get_bloginfo('name'),
153 153
 					'type'    => 'text',
154 154
 				),
155 155
 				array(
156 156
 					'id'      => '_give_from_email',
157
-					'name'    => esc_html__( 'From Email', 'give' ),
158
-					'desc'    => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ),
159
-					'default' => get_bloginfo( 'admin_email' ),
157
+					'name'    => esc_html__('From Email', 'give'),
158
+					'desc'    => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'),
159
+					'default' => get_bloginfo('admin_email'),
160 160
 					'type'    => 'text',
161 161
 				),
162 162
 				array(
163 163
 					'name'  => 'email_notification_docs',
164 164
 					'type'  => 'docs_link',
165 165
 					'url'   => 'http://docs.givewp.com/email-notification',
166
-					'title' => __( 'Email Notification', 'give' ),
166
+					'title' => __('Email Notification', 'give'),
167 167
 				),
168 168
 			),
169 169
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 			 *
173 173
 			 * @since 2.0
174 174
 			 */
175
-			'sub-fields' => apply_filters( 'give_email_notification_options_metabox_fields', array(), $post_id ),
175
+			'sub-fields' => apply_filters('give_email_notification_options_metabox_fields', array(), $post_id),
176 176
 		);
177 177
 
178 178
 		return $settings;
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	private function add_emails_notifications() {
188 188
 		$this->emails = array(
189
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-donation-email.php',
190
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donation-receipt-email.php',
191
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-offline-donation-email.php',
192
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-offline-donation-instruction-email.php',
193
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-donor-register-email.php',
194
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donor-register-email.php',
195
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donor-note-email.php',
196
-			include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-access-email.php',
189
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-donation-email.php',
190
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donation-receipt-email.php',
191
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-offline-donation-email.php',
192
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-offline-donation-instruction-email.php',
193
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-donor-register-email.php',
194
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donor-register-email.php',
195
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donor-note-email.php',
196
+			include GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-access-email.php',
197 197
 		);
198 198
 
199 199
 		/**
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 		 *
202 202
 		 * @since 2.0
203 203
 		 */
204
-		$this->emails = apply_filters( 'give_email_notifications', $this->emails, $this );
204
+		$this->emails = apply_filters('give_email_notifications', $this->emails, $this);
205 205
 
206 206
 		// Bailout.
207
-		if ( empty( $this->emails ) ) {
207
+		if (empty($this->emails)) {
208 208
 			return;
209 209
 		}
210 210
 
211 211
 		// Initiate email notifications.
212
-		foreach ( $this->emails as $email ) {
212
+		foreach ($this->emails as $email) {
213 213
 			$email->init();
214 214
 		}
215 215
 	}
@@ -236,42 +236,42 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public function preview_email() {
238 238
 		// Bailout.
239
-		if ( ! Give_Email_Notification_Util::can_preview_email() ) {
239
+		if ( ! Give_Email_Notification_Util::can_preview_email()) {
240 240
 			return false;
241 241
 		}
242 242
 
243 243
 		// Security check.
244
-		give_validate_nonce( $_GET['_wpnonce'], 'give-preview-email' );
244
+		give_validate_nonce($_GET['_wpnonce'], 'give-preview-email');
245 245
 
246 246
 		// Get email type.
247
-		$email_type = isset( $_GET['email_type'] ) ? esc_attr( $_GET['email_type'] ) : '';
247
+		$email_type = isset($_GET['email_type']) ? esc_attr($_GET['email_type']) : '';
248 248
 
249 249
 		/* @var Give_Email_Notification $email */
250
-		foreach ( $this->get_email_notifications() as $email ) {
251
-			if ( $email_type !== $email->config['id'] ) {
250
+		foreach ($this->get_email_notifications() as $email) {
251
+			if ($email_type !== $email->config['id']) {
252 252
 				continue;
253 253
 			}
254 254
 
255 255
 			// Set form id.
256
-			$form_id = empty( $_GET['form_id'] ) ? null : absint( $_GET['form_id'] );
256
+			$form_id = empty($_GET['form_id']) ? null : absint($_GET['form_id']);
257 257
 
258 258
 			// Call setup email data to apply filter and other thing to email.
259
-			$email->send_preview_email( false );
259
+			$email->send_preview_email(false);
260 260
 
261 261
 			// Decode message.
262
-			$email_message = $email->preview_email_template_tags( $email->get_email_message( $form_id ) );
262
+			$email_message = $email->preview_email_template_tags($email->get_email_message($form_id));
263 263
 
264 264
 			// Show formatted text in browser even text/plain content type set for an email.
265 265
 			Give()->emails->html = true;
266 266
 
267 267
 			Give()->emails->form_id = $form_id;
268 268
 
269
-			if ( 'text/plain' === $email->config['content_type'] ) {
269
+			if ('text/plain' === $email->config['content_type']) {
270 270
 				// Give()->emails->__set( 'html', false );
271
-				Give()->emails->__set( 'template', 'none' );
271
+				Give()->emails->__set('template', 'none');
272 272
 			}
273 273
 
274
-			if ( $email_message = Give()->emails->build_email( $email_message ) ) {
274
+			if ($email_message = Give()->emails->build_email($email_message)) {
275 275
 
276 276
 				/**
277 277
 				 * Filter the email preview data
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
 				 *
281 281
 				 * @param array
282 282
 				 */
283
-				$email_preview_data = apply_filters( "give_{$email_type}_email_preview_data", array() );
283
+				$email_preview_data = apply_filters("give_{$email_type}_email_preview_data", array());
284 284
 
285 285
 				/**
286 286
 				 * Fire the give_{$email_type}_email_preview action
287 287
 				 *
288 288
 				 * @since 2.0
289 289
 				 */
290
-				do_action( "give_{$email_type}_email_preview", $email );
290
+				do_action("give_{$email_type}_email_preview", $email);
291 291
 
292 292
 				/**
293 293
 				 * Filter the email message
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 				 * @param array                   $email_preview_data
299 299
 				 * @param Give_Email_Notification $email
300 300
 				 */
301
-				echo apply_filters( "give_{$email_type}_email_preview_message", $email_message, $email_preview_data, $email );
301
+				echo apply_filters("give_{$email_type}_email_preview_message", $email_message, $email_preview_data, $email);
302 302
 
303 303
 				exit();
304 304
 			}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 *
315 315
 	 * @param Give_Email_Notification $email
316 316
 	 */
317
-	public function email_preview_header( $email ) {
317
+	public function email_preview_header($email) {
318 318
 		/**
319 319
 		 * Filter the all email preview headers.
320 320
 		 *
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 		 *
323 323
 		 * @param Give_Email_Notification $email
324 324
 		 */
325
-		$email_preview_header = apply_filters( 'give_email_preview_header', give_get_preview_email_header(), $email );
325
+		$email_preview_header = apply_filters('give_email_preview_header', give_get_preview_email_header(), $email);
326 326
 
327 327
 		echo $email_preview_header;
328 328
 	}
@@ -337,9 +337,9 @@  discard block
 block discarded – undo
337 337
 	 *
338 338
 	 * @return array
339 339
 	 */
340
-	public function email_preview_data( $email_preview_data ) {
341
-		$email_preview_data['payment_id'] = absint( give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' ) );
342
-		$email_preview_data['user_id']    = absint( give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' ) );
340
+	public function email_preview_data($email_preview_data) {
341
+		$email_preview_data['payment_id'] = absint(give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id'));
342
+		$email_preview_data['user_id']    = absint(give_check_variable(give_clean($_GET), 'isset', 0, 'user_id'));
343 343
 
344 344
 		return $email_preview_data;
345 345
 	}
@@ -355,12 +355,12 @@  discard block
 block discarded – undo
355 355
 	 *
356 356
 	 * @return string
357 357
 	 */
358
-	public function email_preview_message( $email_message, $email_preview_data ) {
358
+	public function email_preview_message($email_message, $email_preview_data) {
359 359
 		if (
360
-			! empty( $email_preview_data['payment_id'] )
361
-			|| ! empty( $email_preview_data['user_id'] )
360
+			! empty($email_preview_data['payment_id'])
361
+			|| ! empty($email_preview_data['user_id'])
362 362
 		) {
363
-			$email_message = give_do_email_tags( $email_message, $email_preview_data );
363
+			$email_message = give_do_email_tags($email_message, $email_preview_data);
364 364
 		}
365 365
 
366 366
 		return $email_message;
@@ -375,26 +375,26 @@  discard block
 block discarded – undo
375 375
 	 */
376 376
 	public function send_preview_email() {
377 377
 		// Bailout.
378
-		if ( ! Give_Email_Notification_Util::can_send_preview_email() ) {
378
+		if ( ! Give_Email_Notification_Util::can_send_preview_email()) {
379 379
 			return false;
380 380
 		}
381 381
 
382 382
 		// Security check.
383
-		give_validate_nonce( $_GET['_wpnonce'], 'give-send-preview-email' );
383
+		give_validate_nonce($_GET['_wpnonce'], 'give-send-preview-email');
384 384
 
385 385
 		// Get email type.
386
-		$email_type = give_check_variable( give_clean( $_GET ), 'isset', '', 'email_type' );
386
+		$email_type = give_check_variable(give_clean($_GET), 'isset', '', 'email_type');
387 387
 
388 388
 		/* @var Give_Email_Notification $email */
389
-		foreach ( $this->get_email_notifications() as $email ) {
390
-			if ( $email_type === $email->config['id'] && Give_Email_Notification_Util::is_email_preview( $email ) ) {
389
+		foreach ($this->get_email_notifications() as $email) {
390
+			if ($email_type === $email->config['id'] && Give_Email_Notification_Util::is_email_preview($email)) {
391 391
 				$email->send_preview_email();
392 392
 				break;
393 393
 			}
394 394
 		}
395 395
 
396 396
 		// Remove the test email query arg.
397
-		wp_redirect( remove_query_arg( 'give_action' ) );
397
+		wp_redirect(remove_query_arg('give_action'));
398 398
 		exit;
399 399
 	}
400 400
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 * @access public
407 407
 	 */
408 408
 	public function load() {
409
-		add_action( 'init', array( $this, 'init' ), -1 );
409
+		add_action('init', array($this, 'init'), -1);
410 410
 	}
411 411
 
412 412
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		if (
422 422
 			! Give_Admin_Settings::is_saving_settings() ||
423 423
 			'emails' !== give_get_current_setting_tab() ||
424
-			! isset( $_GET['section'] )
424
+			! isset($_GET['section'])
425 425
 		) {
426 426
 			return;
427 427
 		}
@@ -429,18 +429,18 @@  discard block
 block discarded – undo
429 429
 		// Get email type.
430 430
 		$email_type = give_get_current_setting_section();
431 431
 
432
-		if ( ! empty( $_POST["{$email_type}_recipient"] ) ) {
433
-			$_POST["{$email_type}_recipient"] = array_unique( array_filter( $_POST["{$email_type}_recipient"] ) );
432
+		if ( ! empty($_POST["{$email_type}_recipient"])) {
433
+			$_POST["{$email_type}_recipient"] = array_unique(array_filter($_POST["{$email_type}_recipient"]));
434 434
 		}
435 435
 	}
436 436
 }
437 437
 
438 438
 // Helper class.
439
-require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/abstract-email-notification.php';
440
-require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-util.php';
439
+require_once GIVE_PLUGIN_DIR.'includes/admin/emails/abstract-email-notification.php';
440
+require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-util.php';
441 441
 
442 442
 // Add backward compatibility.
443
-require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/backward-compatibility.php';
443
+require_once GIVE_PLUGIN_DIR.'includes/admin/emails/backward-compatibility.php';
444 444
 
445 445
 /**
446 446
  * Initialize functionality.
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-general.php 1 patch
Spacing   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly.
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_General' ) ) :
16
+if ( ! class_exists('Give_Settings_General')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_General.
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'general';
30
-			$this->label = __( 'General', 'give' );
30
+			$this->label = __('General', 'give');
31 31
 
32 32
 			$this->default_tab = 'general-settings';
33 33
 
34
-			if ( $this->id === give_get_current_setting_tab() ) {
35
-				add_action( 'give_save_settings_give_settings', array( $this, '_give_change_donation_stating_number' ), 10, 3 );
36
-				add_action( 'give_admin_field_give_sequential_donation_code_preview', array( $this, '_render_give_sequential_donation_code_preview' ), 10, 3 );
37
-				add_action( 'give_admin_field_give_currency_preview', array( $this, '_render_give_currency_preview' ), 10, 2 );
38
-				add_action( 'give_admin_field_give_unlock_all_settings', array( $this, '_render_give_unlock_all_settings' ), 10, 3 );
34
+			if ($this->id === give_get_current_setting_tab()) {
35
+				add_action('give_save_settings_give_settings', array($this, '_give_change_donation_stating_number'), 10, 3);
36
+				add_action('give_admin_field_give_sequential_donation_code_preview', array($this, '_render_give_sequential_donation_code_preview'), 10, 3);
37
+				add_action('give_admin_field_give_currency_preview', array($this, '_render_give_currency_preview'), 10, 2);
38
+				add_action('give_admin_field_give_unlock_all_settings', array($this, '_render_give_unlock_all_settings'), 10, 3);
39 39
 			}
40 40
 
41 41
 			parent::__construct();
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			$settings        = array();
52 52
 			$current_section = give_get_current_setting_section();
53 53
 
54
-			switch ( $current_section ) {
54
+			switch ($current_section) {
55 55
 				case 'access-control':
56 56
 					$settings = array(
57 57
 						// Section 3: Access control.
@@ -61,20 +61,20 @@  discard block
 block discarded – undo
61 61
 						),
62 62
 						array(
63 63
 							'id'      => 'session_lifetime',
64
-							'name'    => __( 'Session Lifetime', 'give' ),
65
-							'desc'    => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ),
64
+							'name'    => __('Session Lifetime', 'give'),
65
+							'desc'    => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'),
66 66
 							'type'    => 'select',
67 67
 							'options' => array(
68
-								'86400'  => __( '24 Hours', 'give' ),
69
-								'172800' => __( '48 Hours', 'give' ),
70
-								'259200' => __( '72 Hours', 'give' ),
71
-								'604800' => __( '1 Week', 'give' ),
68
+								'86400'  => __('24 Hours', 'give'),
69
+								'172800' => __('48 Hours', 'give'),
70
+								'259200' => __('72 Hours', 'give'),
71
+								'604800' => __('1 Week', 'give'),
72 72
 							),
73 73
 						),
74 74
 						array(
75 75
 							'id'         => 'limit_display_donations',
76
-							'name'       => __( 'Limit Donations Displayed', 'give' ),
77
-							'desc'       => __( 'Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give' ),
76
+							'name'       => __('Limit Donations Displayed', 'give'),
77
+							'desc'       => __('Adjusts the number of donations displayed to a non logged-in user when they attempt to access the Donation History page without an active session. For security reasons, it\'s best to leave this at 1-3 donations.', 'give'),
78 78
 							'default'    => '1',
79 79
 							'type'       => 'number',
80 80
 							'css'        => 'width:50px;',
@@ -84,47 +84,47 @@  discard block
 block discarded – undo
84 84
 							),
85 85
 						),
86 86
 						array(
87
-							'name'    => __( 'Email Access', 'give' ),
88
-							'desc'    => __( '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' ),
87
+							'name'    => __('Email Access', 'give'),
88
+							'desc'    => __('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'),
89 89
 							'id'      => 'email_access',
90 90
 							'type'    => 'radio_inline',
91 91
 							'default' => 'disabled',
92 92
 							'options' => array(
93
-								'enabled'  => __( 'Enabled', 'give' ),
94
-								'disabled' => __( 'Disabled', 'give' ),
93
+								'enabled'  => __('Enabled', 'give'),
94
+								'disabled' => __('Disabled', 'give'),
95 95
 							),
96 96
 						),
97 97
 						array(
98
-							'name'    => __( 'Enable reCAPTCHA', 'give' ),
99
-							'desc'    => __( 'Would you like to enable the reCAPTCHA feature?', 'give' ),
98
+							'name'    => __('Enable reCAPTCHA', 'give'),
99
+							'desc'    => __('Would you like to enable the reCAPTCHA feature?', 'give'),
100 100
 							'id'      => 'enable_recaptcha',
101 101
 							'type'    => 'radio_inline',
102 102
 							'default' => 'disabled',
103 103
 							'options' => array(
104
-								'enabled'  => __( 'Enabled', 'give' ),
105
-								'disabled' => __( 'Disabled', 'give' ),
104
+								'enabled'  => __('Enabled', 'give'),
105
+								'disabled' => __('Disabled', 'give'),
106 106
 							),
107 107
 						),
108 108
 						array(
109 109
 							'id'      => 'recaptcha_key',
110
-							'name'    => __( 'reCAPTCHA Site Key', 'give' ),
110
+							'name'    => __('reCAPTCHA Site Key', 'give'),
111 111
 							/* translators: %s: https://www.google.com/recaptcha/ */
112
-							'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 and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ),
112
+							'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 and paste your reCAPTCHA site key here. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')),
113 113
 							'default' => '',
114 114
 							'type'    => 'text',
115 115
 						),
116 116
 						array(
117 117
 							'id'      => 'recaptcha_secret',
118
-							'name'    => __( 'reCAPTCHA Secret Key', 'give' ),
119
-							'desc'    => __( 'Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give' ),
118
+							'name'    => __('reCAPTCHA Secret Key', 'give'),
119
+							'desc'    => __('Please paste the reCAPTCHA secret key here from your  reCAPTCHA API Keys panel.', 'give'),
120 120
 							'default' => '',
121 121
 							'type'    => 'text',
122 122
 						),
123 123
 						array(
124
-							'name'  => __( 'Access Control Docs Link', 'give' ),
124
+							'name'  => __('Access Control Docs Link', 'give'),
125 125
 							'id'    => 'access_control_docs_link',
126
-							'url'   => esc_url( 'http://docs.givewp.com/settings-access-control' ),
127
-							'title' => __( 'Access Control', 'give' ),
126
+							'url'   => esc_url('http://docs.givewp.com/settings-access-control'),
127
+							'title' => __('Access Control', 'give'),
128 128
 							'type'  => 'give_docs_link',
129 129
 						),
130 130
 						array(
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 					break;
136 136
 
137 137
 				case 'currency-settings' :
138
-					$currency_position_before = __( 'Before - %s&#x200e;10', 'give' );
139
-					$currency_position_after  = __( 'After - 10%s&#x200f;', 'give' );
138
+					$currency_position_before = __('Before - %s&#x200e;10', 'give');
139
+					$currency_position_after  = __('After - 10%s&#x200f;', 'give');
140 140
 
141 141
 					$settings = array(
142 142
 						// Section 2: Currency
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 							'id'   => 'give_title_general_settings_2',
146 146
 						),
147 147
 						array(
148
-							'name' => __( 'Currency Settings', 'give' ),
148
+							'name' => __('Currency Settings', 'give'),
149 149
 							'desc' => '',
150 150
 							'type' => 'give_title',
151 151
 							'id'   => 'give_title_general_settings_2',
152 152
 						),
153 153
 						array(
154
-							'name'    => __( 'Currency', 'give' ),
155
-							'desc'    => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ),
154
+							'name'    => __('Currency', 'give'),
155
+							'desc'    => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'),
156 156
 							'id'      => 'currency',
157 157
 							'class'   => 'give-select-chosen',
158 158
 							'type'    => 'select',
@@ -160,64 +160,64 @@  discard block
 block discarded – undo
160 160
 							'default' => 'USD',
161 161
 						),
162 162
 						array(
163
-							'name'       => __( 'Currency Position', 'give' ),
164
-							'desc'       => __( 'The position of the currency symbol.', 'give' ),
163
+							'name'       => __('Currency Position', 'give'),
164
+							'desc'       => __('The position of the currency symbol.', 'give'),
165 165
 							'id'         => 'currency_position',
166 166
 							'type'       => 'select',
167 167
 							'options'    => array(
168 168
 								/* translators: %s: currency symbol */
169
-								'before' => sprintf( $currency_position_before, give_currency_symbol( give_get_currency() ) ),
169
+								'before' => sprintf($currency_position_before, give_currency_symbol(give_get_currency())),
170 170
 								/* translators: %s: currency symbol */
171
-								'after'  => sprintf( $currency_position_after, give_currency_symbol( give_get_currency() ) ),
171
+								'after'  => sprintf($currency_position_after, give_currency_symbol(give_get_currency())),
172 172
 							),
173 173
 							'default'    => 'before',
174 174
 							'attributes' => array(
175
-								'data-before-template' => sprintf( $currency_position_before, '{currency_pos}' ),
176
-								'data-after-template'  => sprintf( $currency_position_after, '{currency_pos}' ),
175
+								'data-before-template' => sprintf($currency_position_before, '{currency_pos}'),
176
+								'data-after-template'  => sprintf($currency_position_after, '{currency_pos}'),
177 177
 							),
178 178
 						),
179 179
 						array(
180
-							'name'    => __( 'Thousands Separator', 'give' ),
181
-							'desc'    => __( 'The symbol (typically , or .) to separate thousands.', 'give' ),
180
+							'name'    => __('Thousands Separator', 'give'),
181
+							'desc'    => __('The symbol (typically , or .) to separate thousands.', 'give'),
182 182
 							'id'      => 'thousands_separator',
183 183
 							'type'    => 'text',
184 184
 							'default' => ',',
185 185
 							'css'     => 'width:12em;',
186 186
 						),
187 187
 						array(
188
-							'name'    => __( 'Decimal Separator', 'give' ),
189
-							'desc'    => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ),
188
+							'name'    => __('Decimal Separator', 'give'),
189
+							'desc'    => __('The symbol (usually , or .) to separate decimal points.', 'give'),
190 190
 							'id'      => 'decimal_separator',
191 191
 							'type'    => 'text',
192 192
 							'default' => '.',
193 193
 							'css'     => 'width:12em;',
194 194
 						),
195 195
 						array(
196
-							'name'    => __( 'Number of Decimals', 'give' ),
197
-							'desc'    => __( 'The number of decimal points displayed in amounts.', 'give' ),
196
+							'name'    => __('Number of Decimals', 'give'),
197
+							'desc'    => __('The number of decimal points displayed in amounts.', 'give'),
198 198
 							'id'      => 'number_decimals',
199 199
 							'type'    => 'text',
200 200
 							'default' => 2,
201 201
 							'css'     => 'width:12em;',
202 202
 						),
203 203
 						array(
204
-							'name'    => __( 'Currency Preview', 'give' ),
205
-							'desc'    => __( 'A preview of the formatted currency. This preview cannot be edited directly as it is generated from the settings above.', 'give' ),
204
+							'name'    => __('Currency Preview', 'give'),
205
+							'desc'    => __('A preview of the formatted currency. This preview cannot be edited directly as it is generated from the settings above.', 'give'),
206 206
 							'id'      => 'currency_preview',
207 207
 							'type'    => 'give_currency_preview',
208
-							'default' => give_format_amount( 123456.12345,
208
+							'default' => give_format_amount(123456.12345,
209 209
 								array(
210 210
 									'sanitize' => false,
211
-									'currency' => give_get_option( 'currency' ),
211
+									'currency' => give_get_option('currency'),
212 212
 								)
213 213
 							),
214 214
 							'css'     => 'width:12em;',
215 215
 						),
216 216
 						array(
217
-							'name'  => __( 'Currency Options Docs Link', 'give' ),
217
+							'name'  => __('Currency Options Docs Link', 'give'),
218 218
 							'id'    => 'currency_settings_docs_link',
219
-							'url'   => esc_url( 'http://docs.givewp.com/settings-currency' ),
220
-							'title' => __( 'Currency Settings', 'give' ),
219
+							'url'   => esc_url('http://docs.givewp.com/settings-currency'),
220
+							'title' => __('Currency Settings', 'give'),
221 221
 							'type'  => 'give_docs_link',
222 222
 						),
223 223
 						array(
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
 					$countries = give_get_country();
234 234
 
235 235
 					// get the list of the states of which default country is selected.
236
-					$states = give_get_states( $countries );
236
+					$states = give_get_states($countries);
237 237
 
238 238
 					// Get the country list that does not have any states init.
239 239
 					$no_states_country = give_no_states_country_list();
240 240
 
241 241
 					$states_label = give_get_states_label();
242 242
 					$country      = give_get_country();
243
-					$label        = __( 'State', 'give' );
243
+					$label        = __('State', 'give');
244 244
 					// Check if $country code exists in the array key for states label.
245
-					if ( array_key_exists( $country, $states_label ) ) {
246
-						$label = $states_label[ $country ];
245
+					if (array_key_exists($country, $states_label)) {
246
+						$label = $states_label[$country];
247 247
 					}
248 248
 
249 249
 
@@ -254,58 +254,58 @@  discard block
 block discarded – undo
254 254
 							'id'   => 'give_title_general_settings_1',
255 255
 						),
256 256
 						array(
257
-							'name' => __( 'General Settings', 'give' ),
257
+							'name' => __('General Settings', 'give'),
258 258
 							'desc' => '',
259 259
 							'type' => 'give_title',
260 260
 							'id'   => 'give_title_general_settings_1',
261 261
 						),
262 262
 						array(
263
-							'name'       => __( 'Success Page', 'give' ),
263
+							'name'       => __('Success Page', 'give'),
264 264
 							/* translators: %s: [give_receipt] */
265
-							'desc'       => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ),
265
+							'desc'       => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'),
266 266
 							'id'         => 'success_page',
267 267
 							'class'      => 'give-select give-select-chosen',
268 268
 							'type'       => 'select',
269
-							'options'    => give_cmb2_get_post_options( array(
269
+							'options'    => give_cmb2_get_post_options(array(
270 270
 								'post_type'   => 'page',
271 271
 								'numberposts' => 30,
272
-							) ),
272
+							)),
273 273
 							'attributes' => array(
274 274
 								'data-search-type' => 'pages'
275 275
 							)
276 276
 						),
277 277
 						array(
278
-							'name'       => __( 'Failed Donation Page', 'give' ),
279
-							'desc'       => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ),
278
+							'name'       => __('Failed Donation Page', 'give'),
279
+							'desc'       => __('The page donors are sent to if their donation is cancelled or fails.', 'give'),
280 280
 							'class'      => 'give-select give-select-chosen',
281 281
 							'id'         => 'failure_page',
282 282
 							'type'       => 'select',
283
-							'options'    => give_cmb2_get_post_options( array(
283
+							'options'    => give_cmb2_get_post_options(array(
284 284
 								'post_type'   => 'page',
285 285
 								'numberposts' => 30,
286
-							) ),
286
+							)),
287 287
 							'attributes' => array(
288 288
 								'data-search-type' => 'pages'
289 289
 							)
290 290
 						),
291 291
 						array(
292
-							'name'       => __( 'Donation History Page', 'give' ),
292
+							'name'       => __('Donation History Page', 'give'),
293 293
 							/* translators: %s: [donation_history] */
294
-							'desc'       => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ),
294
+							'desc'       => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'),
295 295
 							'id'         => 'history_page',
296 296
 							'class'      => 'give-select give-select-chosen',
297 297
 							'type'       => 'select',
298
-							'options'    => give_cmb2_get_post_options( array(
298
+							'options'    => give_cmb2_get_post_options(array(
299 299
 								'post_type'   => 'page',
300 300
 								'numberposts' => 30,
301
-							) ),
301
+							)),
302 302
 							'attributes' => array(
303 303
 								'data-search-type' => 'pages'
304 304
 							)
305 305
 						),
306 306
 						array(
307
-							'name'       => __( 'Base Country', 'give' ),
308
-							'desc'       => __( 'The country your site operates from.', 'give' ),
307
+							'name'       => __('Base Country', 'give'),
308
+							'desc'       => __('The country your site operates from.', 'give'),
309 309
 							'id'         => 'base_country',
310 310
 							'type'       => 'select',
311 311
 							'options'    => give_get_country_list(),
@@ -321,12 +321,12 @@  discard block
 block discarded – undo
321 321
 						 * @since 1.8.14
322 322
 						 */
323 323
 						array(
324
-							'wrapper_class' => ( array_key_exists( $countries, $no_states_country ) ? 'give-hidden' : '' ),
325
-							'name'          => __( 'Base State/Province', 'give' ),
326
-							'desc'          => __( 'The state/province your site operates from.', 'give' ),
324
+							'wrapper_class' => (array_key_exists($countries, $no_states_country) ? 'give-hidden' : ''),
325
+							'name'          => __('Base State/Province', 'give'),
326
+							'desc'          => __('The state/province your site operates from.', 'give'),
327 327
 							'id'            => 'base_state',
328
-							'type'          => ( empty( $states ) ? 'text' : 'select' ),
329
-							'class'         => ( empty( $states ) ? '' : 'give-select give-select-chosen' ),
328
+							'type'          => (empty($states) ? 'text' : 'select'),
329
+							'class'         => (empty($states) ? '' : 'give-select give-select-chosen'),
330 330
 							'options'       => $states,
331 331
 							'attributes'    => array(
332 332
 								'data-search-type' => 'no_ajax',
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 							),
335 335
 						),
336 336
 						array(
337
-							'name'  => __( 'General Options Docs Link', 'give' ),
337
+							'name'  => __('General Options Docs Link', 'give'),
338 338
 							'id'    => 'general_options_docs_link',
339
-							'url'   => esc_url( 'http://docs.givewp.com/settings-general' ),
340
-							'title' => __( 'General Options', 'give' ),
339
+							'url'   => esc_url('http://docs.givewp.com/settings-general'),
340
+							'title' => __('General Options', 'give'),
341 341
 							'type'  => 'give_docs_link',
342 342
 						),
343 343
 						array(
@@ -357,48 +357,48 @@  discard block
 block discarded – undo
357 357
 							'type' => 'title'
358 358
 						),
359 359
 						array(
360
-							'name'    => __( 'Sequential Ordering', 'give' ),
360
+							'name'    => __('Sequential Ordering', 'give'),
361 361
 							'id'      => "{$current_section}_status",
362
-							'desc'    => __( 'Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give' ),
362
+							'desc'    => __('Custom donation numbering that increases sequentially to prevent gaps between donation IDs. If disabled, then donation numbers are generated from WordPress post IDs, which will result in gaps between numbers.', 'give'),
363 363
 							'type'    => 'radio_inline',
364 364
 							'default' => 'disabled',
365 365
 							'options' => array(
366
-								'enabled'  => __( 'Enabled', 'give' ),
367
-								'disabled' => __( 'Disabled', 'give' )
366
+								'enabled'  => __('Enabled', 'give'),
367
+								'disabled' => __('Disabled', 'give')
368 368
 							)
369 369
 						),
370 370
 						array(
371
-							'name' => __( 'Next Donation Number', 'give' ),
371
+							'name' => __('Next Donation Number', 'give'),
372 372
 							'id'   => "{$current_section}_number",
373 373
 							'desc' => sprintf(
374
-								__( 'The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give' ),
375
-								'<code>' . Give()->seq_donation_number->get_next_number() . '</code>'
374
+								__('The number used to generate the next donation ID. This value must be greater than or equal to %s to avoid conflicts with existing donation IDs.', 'give'),
375
+								'<code>'.Give()->seq_donation_number->get_next_number().'</code>'
376 376
 							),
377 377
 							'type' => 'number',
378 378
 						),
379 379
 						array(
380
-							'name' => __( 'Number Prefix', 'give' ),
380
+							'name' => __('Number Prefix', 'give'),
381 381
 							'id'   => "{$current_section}_number_prefix",
382 382
 							'desc' => sprintf(
383
-								__( 'The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ),
383
+								__('The prefix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'),
384 384
 								'<code>-</code>'
385 385
 							),
386 386
 							'type' => 'text',
387 387
 						),
388 388
 						array(
389
-							'name' => __( 'Number Suffix', 'give' ),
389
+							'name' => __('Number Suffix', 'give'),
390 390
 							'id'   => "{$current_section}_number_suffix",
391 391
 							'desc' => sprintf(
392
-								__( 'The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give' ),
392
+								__('The suffix appended to all sequential donation numbers. Spaces are replaced by %s.', 'give'),
393 393
 								'<code>-</code>'
394 394
 							),
395 395
 							'type' => 'text',
396 396
 						),
397 397
 						array(
398
-							'name'    => __( 'Number Padding', 'give' ),
398
+							'name'    => __('Number Padding', 'give'),
399 399
 							'id'      => "{$current_section}_number_padding",
400 400
 							'desc'    => sprintf(
401
-								__( 'The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give' ),
401
+								__('The minimum number of digits in the sequential donation number. Enter %s to display %s as %s.', 'give'),
402 402
 								'<code>4</code>',
403 403
 								'<code>1</code>',
404 404
 								'<code>0001</code>'
@@ -407,16 +407,16 @@  discard block
 block discarded – undo
407 407
 							'default' => '0',
408 408
 						),
409 409
 						array(
410
-							'name' => __( 'Donation ID Preview', 'give' ),
410
+							'name' => __('Donation ID Preview', 'give'),
411 411
 							'id'   => "{$current_section}_preview",
412 412
 							'type' => 'give_sequential_donation_code_preview',
413
-							'desc' => __( 'A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give' ),
413
+							'desc' => __('A preview of the next sequential donation ID. This preview cannot be edited directly as it is generated from the settings above.', 'give'),
414 414
 						),
415 415
 						array(
416
-							'name'  => __( 'Sequential Ordering Docs Link', 'give' ),
416
+							'name'  => __('Sequential Ordering Docs Link', 'give'),
417 417
 							'id'    => "{$current_section}_doc link",
418
-							'url'   => esc_url( 'http://docs.givewp.com/settings-sequential-ordering' ),
419
-							'title' => __( 'Sequential Ordering', 'give' ),
418
+							'url'   => esc_url('http://docs.givewp.com/settings-sequential-ordering'),
419
+							'title' => __('Sequential Ordering', 'give'),
420 420
 							'type'  => 'give_docs_link',
421 421
 						),
422 422
 						array(
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 			 * Filter the general settings.
431 431
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
432 432
 			 */
433
-			$settings = apply_filters( 'give_settings_general', $settings );
433
+			$settings = apply_filters('give_settings_general', $settings);
434 434
 
435 435
 			/**
436 436
 			 * Filter the settings.
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 			 *
440 440
 			 * @param  array $settings
441 441
 			 */
442
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
442
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
443 443
 
444 444
 			// Output.
445 445
 			return $settings;
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
 		 */
454 454
 		public function get_sections() {
455 455
 			$sections = array(
456
-				'general-settings'    => __( 'General', 'give' ),
457
-				'currency-settings'   => __( 'Currency', 'give' ),
458
-				'access-control'      => __( 'Access Control', 'give' ),
459
-				'sequential-ordering' => __( 'Sequential Ordering', 'give' ),
456
+				'general-settings'    => __('General', 'give'),
457
+				'currency-settings'   => __('Currency', 'give'),
458
+				'access-control'      => __('Access Control', 'give'),
459
+				'sequential-ordering' => __('Sequential Ordering', 'give'),
460 460
 			);
461 461
 
462
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
462
+			return apply_filters('give_get_sections_'.$this->id, $sections);
463 463
 		}
464 464
 
465 465
 
@@ -475,23 +475,23 @@  discard block
 block discarded – undo
475 475
 		 *
476 476
 		 * @return bool
477 477
 		 */
478
-		public function _give_change_donation_stating_number( $update_options, $option_name, $old_options ) {
479
-			if ( ! isset( $_POST['sequential-ordering_number'] ) ) {
478
+		public function _give_change_donation_stating_number($update_options, $option_name, $old_options) {
479
+			if ( ! isset($_POST['sequential-ordering_number'])) {
480 480
 				return false;
481 481
 			}
482 482
 
483
-			if ( ( $next_number = Give()->seq_donation_number->get_next_number() ) > $update_options['sequential-ordering_number'] ) {
484
-				give_update_option( 'sequential-ordering_number', $next_number );
483
+			if (($next_number = Give()->seq_donation_number->get_next_number()) > $update_options['sequential-ordering_number']) {
484
+				give_update_option('sequential-ordering_number', $next_number);
485 485
 
486 486
 				Give_Admin_Settings::add_error(
487 487
 					'give-invalid-sequential-starting-number',
488 488
 					sprintf(
489
-						__( 'Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give' ),
489
+						__('Next Donation Number must be equal to or larger than %s to avoid conflicts with existing donation IDs.', 'give'),
490 490
 						$next_number
491 491
 					)
492 492
 				);
493
-			} elseif ( $update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number'] ) {
494
-				update_option( '_give_reset_sequential_number', 1, false );
493
+			} elseif ($update_options['sequential-ordering_number'] !== $old_options['sequential-ordering_number']) {
494
+				update_option('_give_reset_sequential_number', 1, false);
495 495
 			}
496 496
 
497 497
 			return true;
@@ -505,16 +505,16 @@  discard block
 block discarded – undo
505 505
 		 *
506 506
 		 * @param $field
507 507
 		 */
508
-		public function _render_give_sequential_donation_code_preview( $field ) {
508
+		public function _render_give_sequential_donation_code_preview($field) {
509 509
 			?>
510
-			<tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>>
510
+			<tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>>
511 511
 				<th scope="row" class="titledesc">
512 512
 					<label
513
-						for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label>
513
+						for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label>
514 514
 				</th>
515 515
 				<td class="give-forminp">
516
-					<input id="<?php echo esc_attr( $field['id'] ); ?>" class="give-input-field" type="text" disabled>
517
-					<?php echo Give_Admin_Settings::get_field_description( $field ); ?>
516
+					<input id="<?php echo esc_attr($field['id']); ?>" class="give-input-field" type="text" disabled>
517
+					<?php echo Give_Admin_Settings::get_field_description($field); ?>
518 518
 				</td>
519 519
 			</tr>
520 520
 			<?php
@@ -530,22 +530,22 @@  discard block
 block discarded – undo
530 530
 		 *
531 531
 		 * @return void
532 532
 		 */
533
-		public function _render_give_currency_preview( $field, $value ) {
533
+		public function _render_give_currency_preview($field, $value) {
534 534
 			$currency          = give_get_currency();
535 535
 			$currency_position = give_get_currency_position();
536
-			$currency_symbol   = give_currency_symbol( $currency, false );
537
-			$formatted_currency = ( 'before' === $currency_position )
538
-				? sprintf( '%1$s%2$s', esc_html( $currency_symbol ), esc_html( $field['default'] ) )
539
-				: sprintf( '%1$s%2$s', esc_html( $field['default'] ), esc_html( $currency_symbol ) );
536
+			$currency_symbol   = give_currency_symbol($currency, false);
537
+			$formatted_currency = ('before' === $currency_position)
538
+				? sprintf('%1$s%2$s', esc_html($currency_symbol), esc_html($field['default']))
539
+				: sprintf('%1$s%2$s', esc_html($field['default']), esc_html($currency_symbol));
540 540
 			?>
541
-			<tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>>
541
+			<tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>>
542 542
 				<th scope="row" class="titledesc">
543 543
 					<label
544
-						for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label>
544
+						for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label>
545 545
 				</th>
546 546
 				<td class="give-forminp">
547
-					<input id="<?php echo esc_attr( $field['id'] ); ?>" class="give-input-field" type="text" disabled value="<?php echo esc_attr( $formatted_currency ); ?>">
548
-					<?php echo Give_Admin_Settings::get_field_description( $field ); ?>
547
+					<input id="<?php echo esc_attr($field['id']); ?>" class="give-input-field" type="text" disabled value="<?php echo esc_attr($formatted_currency); ?>">
548
+					<?php echo Give_Admin_Settings::get_field_description($field); ?>
549 549
 				</td>
550 550
 			</tr>
551 551
 			<?php
@@ -559,16 +559,16 @@  discard block
 block discarded – undo
559 559
 		 *
560 560
 		 * @param $field
561 561
 		 */
562
-		public function _render_give_unlock_all_settings( $field ) {
562
+		public function _render_give_unlock_all_settings($field) {
563 563
 			?>
564
-			<tr valign="top" <?php echo ! empty( $field['wrapper_class'] ) ? 'class="' . $field['wrapper_class'] . '"' : '' ?>>
564
+			<tr valign="top" <?php echo ! empty($field['wrapper_class']) ? 'class="'.$field['wrapper_class'].'"' : '' ?>>
565 565
 				<th scope="row" class="titledesc">
566 566
 					<label
567
-						for="<?php echo esc_attr( $field['id'] ); ?>"><?php echo esc_html( $field['name'] ) ?></label>
567
+						for="<?php echo esc_attr($field['id']); ?>"><?php echo esc_html($field['name']) ?></label>
568 568
 				</th>
569 569
 				<td class="give-forminp">
570
-					<?php echo Give_Admin_Settings::get_field_description( $field ); ?>
571
-					<a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __( 'Unlock all settings', 'give' ); ?></a>
570
+					<?php echo Give_Admin_Settings::get_field_description($field); ?>
571
+					<a href="" id="<?php echo $field['id']; ?>" data-message="<?php echo $field['confirmation_msg'] ?>"><?php echo __('Unlock all settings', 'give'); ?></a>
572 572
 				</td>
573 573
 			</tr>
574 574
 			<?php
Please login to merge, or discard this patch.
includes/admin/payments/view-payment-details.php 1 patch
Spacing   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! current_user_can( 'view_give_payments' ) ) {
17
+if ( ! current_user_can('view_give_payments')) {
18 18
 	wp_die(
19
-		__( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array(
19
+		__('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array(
20 20
 			'response' => 403,
21 21
 		)
22 22
 	);
@@ -28,35 +28,35 @@  discard block
 block discarded – undo
28 28
  * @since 1.0
29 29
  * @return void
30 30
  */
31
-if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
32
-	wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
31
+if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
32
+	wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
33 33
 }
34 34
 
35 35
 // Setup the variables
36
-$payment_id = absint( $_GET['id'] );
37
-$payment    = new Give_Payment( $payment_id );
36
+$payment_id = absint($_GET['id']);
37
+$payment    = new Give_Payment($payment_id);
38 38
 
39 39
 // Sanity check... fail if donation ID is invalid
40 40
 $payment_exists = $payment->ID;
41
-if ( empty( $payment_exists ) ) {
42
-	wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
41
+if (empty($payment_exists)) {
42
+	wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400));
43 43
 }
44 44
 
45 45
 $number       = $payment->number;
46 46
 $payment_meta = $payment->get_meta();
47 47
 
48
-$company_name   = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : '';
49
-$transaction_id = esc_attr( $payment->transaction_id );
48
+$company_name   = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : '';
49
+$transaction_id = esc_attr($payment->transaction_id);
50 50
 $user_id        = $payment->user_id;
51 51
 $donor_id       = $payment->customer_id;
52
-$payment_date   = strtotime( $payment->date );
53
-$user_info      = give_get_payment_meta_user_info( $payment_id );
52
+$payment_date   = strtotime($payment->date);
53
+$user_info      = give_get_payment_meta_user_info($payment_id);
54 54
 $address        = $payment->address;
55 55
 $currency_code  = $payment->currency;
56 56
 $gateway        = $payment->gateway;
57 57
 $currency_code  = $payment->currency;
58 58
 $payment_mode   = $payment->mode;
59
-$base_url       = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
59
+$base_url       = admin_url('edit.php?post_type=give_forms&page=give-payment-history');
60 60
 
61 61
 ?>
62 62
 <div class="wrap give-wrap">
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 		<?php
66 66
 		printf(
67 67
 		/* translators: %s: donation number */
68
-			esc_html__( 'Donation %s', 'give' ),
68
+			esc_html__('Donation %s', 'give'),
69 69
 			$number
70 70
 		);
71
-		if ( $payment_mode == 'test' ) {
71
+		if ($payment_mode == 'test') {
72 72
 			echo Give()->tooltips->render_span(array(
73
-				'label' => __( 'This donation was made in test mode.', 'give' ),
74
-				'tag_content' => __( 'Test Donation', 'give' ),
73
+				'label' => __('This donation was made in test mode.', 'give'),
74
+				'tag_content' => __('Test Donation', 'give'),
75 75
 				'position'=> 'right',
76 76
 				'attributes' => array(
77 77
 					'id' => 'test-payment-label',
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @param int $payment_id Payment id.
92 92
 	 */
93
-	do_action( 'give_view_donation_details_before', $payment_id );
93
+	do_action('give_view_donation_details_before', $payment_id);
94 94
 	?>
95 95
 
96 96
 	<hr class="wp-header-end">
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		 *
105 105
 		 * @param int $payment_id Payment id.
106 106
 		 */
107
-		do_action( 'give_view_donation_details_form_top', $payment_id );
107
+		do_action('give_view_donation_details_form_top', $payment_id);
108 108
 		?>
109 109
 		<div id="poststuff">
110 110
 			<div id="give-dashboard-widgets-wrap">
@@ -120,16 +120,16 @@  discard block
 block discarded – undo
120 120
 							 *
121 121
 							 * @param int $payment_id Payment id.
122 122
 							 */
123
-							do_action( 'give_view_donation_details_sidebar_before', $payment_id );
123
+							do_action('give_view_donation_details_sidebar_before', $payment_id);
124 124
 							?>
125 125
 
126 126
 							<div id="give-order-update" class="postbox give-order-data">
127 127
 
128 128
 								<div class="give-order-top">
129
-									<h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
129
+									<h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3>
130 130
 
131 131
 									<?php
132
-									if ( current_user_can( 'view_give_payments' ) ) {
132
+									if (current_user_can('view_give_payments')) {
133 133
 										echo sprintf(
134 134
 											'<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>',
135 135
 											$payment_id,
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 													), $base_url
142 142
 												), 'give_donation_nonce'
143 143
 											),
144
-											sprintf( __( 'Delete Donation %s', 'give' ), $payment_id )
144
+											sprintf(__('Delete Donation %s', 'give'), $payment_id)
145 145
 										);
146 146
 									}
147 147
 									?>
@@ -158,34 +158,34 @@  discard block
 block discarded – undo
158 158
 										 *
159 159
 										 * @param int $payment_id Payment id.
160 160
 										 */
161
-										do_action( 'give_view_donation_details_totals_before', $payment_id );
161
+										do_action('give_view_donation_details_totals_before', $payment_id);
162 162
 										?>
163 163
 
164 164
 										<div class="give-admin-box-inside">
165 165
 											<p>
166
-												<label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>&nbsp;
166
+												<label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label>&nbsp;
167 167
 												<select id="give-payment-status" name="give-payment-status" class="medium-text">
168
-													<?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
169
-														<option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
168
+													<?php foreach (give_get_payment_statuses() as $key => $status) : ?>
169
+														<option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option>
170 170
 													<?php endforeach; ?>
171 171
 												</select>
172
-												<span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
172
+												<span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span>
173 173
 											</p>
174 174
 										</div>
175 175
 
176 176
 										<div class="give-admin-box-inside">
177 177
 											<?php $localized_date_format = give_get_localized_date_format_to_js(); ?>
178 178
 											<p>
179
-												<label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>&nbsp;
180
-												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( get_option( 'date_format' ), $payment_date ) ); ?>" class="medium-text give_datepicker" placeholder="<?php printf( esc_attr( $localized_date_format ) ); ?>"/>
179
+												<label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label>&nbsp;
180
+												<input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date(get_option('date_format'), $payment_date)); ?>" class="medium-text give_datepicker" placeholder="<?php printf(esc_attr($localized_date_format)); ?>"/>
181 181
 											</p>
182 182
 										</div>
183 183
 
184 184
 										<div class="give-admin-box-inside">
185 185
 											<p>
186
-												<label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>&nbsp;
187
-												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
188
-												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
186
+												<label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label>&nbsp;
187
+												<input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
188
+												<input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/>
189 189
 											</p>
190 190
 										</div>
191 191
 
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 										 *
200 200
 										 * @param int $payment_id Payment id.
201 201
 										 */
202
-										do_action( 'give_view_donation_details_update_inner', $payment_id );
202
+										do_action('give_view_donation_details_update_inner', $payment_id);
203 203
 										?>
204 204
 
205 205
 										<div class="give-order-payment give-admin-box-inside">
206 206
 											<p>
207
-												<label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>&nbsp;
208
-												<?php echo give_currency_symbol( $payment->currency ); ?>
209
-												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/>
207
+												<label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label>&nbsp;
208
+												<?php echo give_currency_symbol($payment->currency); ?>
209
+												&nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/>
210 210
 											</p>
211 211
 										</div>
212 212
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 										 *
219 219
 										 * @param int $payment_id Payment id.
220 220
 										 */
221
-										do_action( 'give_view_donation_details_totals_after', $payment_id );
221
+										do_action('give_view_donation_details_totals_after', $payment_id);
222 222
 										?>
223 223
 
224 224
 									</div>
@@ -236,26 +236,26 @@  discard block
 block discarded – undo
236 236
 									 *
237 237
 									 * @param int $payment_id Payment id.
238 238
 									 */
239
-									do_action( 'give_view_donation_details_update_before', $payment_id );
239
+									do_action('give_view_donation_details_update_before', $payment_id);
240 240
 									?>
241 241
 
242 242
 									<div id="major-publishing-actions">
243 243
 										<div id="publishing-action">
244
-											<input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
244
+											<input type="submit" class="button button-primary right" value="<?php esc_attr_e('Save Donation', 'give'); ?>"/>
245 245
 											<?php
246
-											if ( give_is_payment_complete( $payment_id ) ) {
246
+											if (give_is_payment_complete($payment_id)) {
247 247
 												$url = add_query_arg(
248 248
 													array(
249 249
 														'give-action' => 'email_links',
250 250
 														'purchase_id' => $payment_id,
251 251
 													),
252
-													admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id )
252
+													admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id)
253 253
 												);
254 254
 
255 255
 												echo sprintf(
256 256
 													'<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
257
-													esc_url( $url ),
258
-													esc_html__( 'Resend Receipt', 'give' )
257
+													esc_url($url),
258
+													esc_html__('Resend Receipt', 'give')
259 259
 												);
260 260
 											}
261 261
 											?>
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 									 *
271 271
 									 * @param int $payment_id Payment id.
272 272
 									 */
273
-									do_action( 'give_view_donation_details_update_after', $payment_id );
273
+									do_action('give_view_donation_details_update_after', $payment_id);
274 274
 									?>
275 275
 
276 276
 								</div>
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 							<div id="give-order-details" class="postbox give-order-data">
283 283
 
284
-								<h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
284
+								<h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3>
285 285
 
286 286
 								<div class="inside">
287 287
 									<div class="give-admin-box">
@@ -294,30 +294,30 @@  discard block
 block discarded – undo
294 294
 										 *
295 295
 										 * @param int $payment_id Payment id.
296 296
 										 */
297
-										do_action( 'give_view_donation_details_payment_meta_before', $payment_id );
297
+										do_action('give_view_donation_details_payment_meta_before', $payment_id);
298 298
 
299
-										$gateway = give_get_payment_gateway( $payment_id );
300
-										if ( $gateway ) :
299
+										$gateway = give_get_payment_gateway($payment_id);
300
+										if ($gateway) :
301 301
 											?>
302 302
 											<div class="give-order-gateway give-admin-box-inside">
303 303
 												<p>
304
-													<strong><?php _e( 'Gateway:', 'give' ); ?></strong>&nbsp;
305
-													<?php echo give_get_gateway_admin_label( $gateway ); ?>
304
+													<strong><?php _e('Gateway:', 'give'); ?></strong>&nbsp;
305
+													<?php echo give_get_gateway_admin_label($gateway); ?>
306 306
 												</p>
307 307
 											</div>
308 308
 										<?php endif; ?>
309 309
 
310 310
 										<div class="give-order-payment-key give-admin-box-inside">
311 311
 											<p>
312
-												<strong><?php _e( 'Key:', 'give' ); ?></strong>&nbsp;
313
-												<?php echo give_get_payment_key( $payment_id ); ?>
312
+												<strong><?php _e('Key:', 'give'); ?></strong>&nbsp;
313
+												<?php echo give_get_payment_key($payment_id); ?>
314 314
 											</p>
315 315
 										</div>
316 316
 
317 317
 										<div class="give-order-ip give-admin-box-inside">
318 318
 											<p>
319
-												<strong><?php _e( 'IP:', 'give' ); ?></strong>&nbsp;
320
-												<?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
319
+												<strong><?php _e('IP:', 'give'); ?></strong>&nbsp;
320
+												<?php echo esc_html(give_get_payment_user_ip($payment_id)); ?>
321 321
 											</p>
322 322
 										</div>
323 323
 
@@ -325,18 +325,18 @@  discard block
 block discarded – undo
325 325
 										// Display the transaction ID present.
326 326
 										// The transaction ID is the charge ID from the gateway.
327 327
 										// For instance, stripe "ch_BzvwYCchqOy5Nt".
328
-										if ( $transaction_id != $payment_id ) : ?>
328
+										if ($transaction_id != $payment_id) : ?>
329 329
 											<div class="give-order-tx-id give-admin-box-inside">
330 330
 												<p>
331
-													<strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong>&nbsp;
332
-													<?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
331
+													<strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question"  data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong>&nbsp;
332
+													<?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?>
333 333
 												</p>
334 334
 											</div>
335 335
 										<?php endif; ?>
336 336
 
337 337
 										<div class="give-admin-box-inside">
338
-											<p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
339
-												<a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
338
+											<p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?>
339
+												<a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor &raquo;', 'give'); ?></a>
340 340
 											</p>
341 341
 										</div>
342 342
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 										 *
349 349
 										 * @param int $payment_id Payment id.
350 350
 										 */
351
-										do_action( 'give_view_donation_details_payment_meta_after', $payment_id );
351
+										do_action('give_view_donation_details_payment_meta_after', $payment_id);
352 352
 										?>
353 353
 
354 354
 									</div>
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 							 *
369 369
 							 * @param int $payment_id Payment id.
370 370
 							 */
371
-							do_action( 'give_view_donation_details_sidebar_after', $payment_id );
371
+							do_action('give_view_donation_details_sidebar_after', $payment_id);
372 372
 							?>
373 373
 
374 374
 						</div>
@@ -388,31 +388,31 @@  discard block
 block discarded – undo
388 388
 							 *
389 389
 							 * @param int $payment_id Payment id.
390 390
 							 */
391
-							do_action( 'give_view_donation_details_main_before', $payment_id );
391
+							do_action('give_view_donation_details_main_before', $payment_id);
392 392
 							?>
393 393
 
394 394
 							<?php $column_count = 'columns-3'; ?>
395 395
 							<div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
396
-								<h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
396
+								<h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3>
397 397
 
398 398
 								<div class="inside">
399 399
 
400 400
 									<div class="column-container">
401 401
 										<div class="column">
402 402
 											<p>
403
-												<strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
403
+												<strong><?php _e('Donation Form ID:', 'give'); ?></strong><br>
404 404
 												<?php
405
-												if ( $payment_meta['form_id'] ) :
405
+												if ($payment_meta['form_id']) :
406 406
 													printf(
407 407
 														'<a href="%1$s">%2$s</a>',
408
-														admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ),
408
+														admin_url('post.php?action=edit&post='.$payment_meta['form_id']),
409 409
 														$payment_meta['form_id']
410 410
 													);
411 411
 												endif;
412 412
 												?>
413 413
 											</p>
414 414
 											<p>
415
-												<strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
415
+												<strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br>
416 416
 												<?php
417 417
 												echo Give()->html->forms_dropdown(
418 418
 													array(
@@ -428,21 +428,21 @@  discard block
 block discarded – undo
428 428
 										</div>
429 429
 										<div class="column">
430 430
 											<p>
431
-												<strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
432
-												<?php echo date_i18n( give_date_format(), $payment_date ); ?>
431
+												<strong><?php _e('Donation Date:', 'give'); ?></strong><br>
432
+												<?php echo date_i18n(give_date_format(), $payment_date); ?>
433 433
 											</p>
434 434
 											<p>
435
-												<strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
435
+												<strong><?php _e('Donation Level:', 'give'); ?></strong><br>
436 436
 												<span class="give-donation-level">
437 437
 													<?php
438
-													$var_prices = give_has_variable_prices( $payment_meta['form_id'] );
439
-													if ( empty( $var_prices ) ) {
440
-														_e( 'n/a', 'give' );
438
+													$var_prices = give_has_variable_prices($payment_meta['form_id']);
439
+													if (empty($var_prices)) {
440
+														_e('n/a', 'give');
441 441
 													} else {
442 442
 														$prices_atts = array();
443
-														if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) {
444
-															foreach ( $variable_prices as $variable_price ) {
445
-																$prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
443
+														if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) {
444
+															foreach ($variable_prices as $variable_price) {
445
+																$prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false));
446 446
 															}
447 447
 														}
448 448
 														// Variable price dropdown options.
@@ -451,12 +451,12 @@  discard block
 block discarded – undo
451 451
 															'name'             => 'give-variable-price',
452 452
 															'chosen'           => true,
453 453
 															'show_option_all'  => '',
454
-															'show_option_none' => ( '' === $payment->price_id ? __( 'None', 'give' ) : '' ),
455
-															'select_atts'      => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
454
+															'show_option_none' => ('' === $payment->price_id ? __('None', 'give') : ''),
455
+															'select_atts'      => 'data-prices='.esc_attr(wp_json_encode($prices_atts)),
456 456
 															'selected'         => $payment->price_id,
457 457
 														);
458 458
 														// Render variable prices select tag html.
459
-														give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
459
+														give_get_form_variable_price_dropdown($variable_price_dropdown_option, true);
460 460
 													}
461 461
 													?>
462 462
 												</span>
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
 										</div>
465 465
 										<div class="column">
466 466
 											<p>
467
-												<strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
468
-												<?php echo give_donation_amount( $payment, true ); ?>
467
+												<strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br>
468
+												<?php echo give_donation_amount($payment, true); ?>
469 469
 											</p>
470 470
 
471
-											<?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ):  ?>
471
+											<?php if (give_is_anonymous_donation_field_enabled($payment->form_id)):  ?>
472 472
 												<div>
473
-													<strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong>
473
+													<strong><?php esc_html_e('Anonymous Donation:', 'give'); ?></strong>
474 474
 													<ul class="give-radio-inline">
475 475
 														<li>
476 476
 															<label>
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 																	name="give_anonymous_donation"
479 479
 																	value="1"
480 480
 																	type="radio"
481
-																	<?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?>
482
-																><?php _e( 'Yes', 'give' ); ?>
481
+																	<?php checked(1, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?>
482
+																><?php _e('Yes', 'give'); ?>
483 483
 															</label>
484 484
 														</li>
485 485
 														<li>
@@ -488,8 +488,8 @@  discard block
 block discarded – undo
488 488
 																	name="give_anonymous_donation"
489 489
 																	value="0"
490 490
 																	type="radio"
491
-																	<?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ) ?>
492
-																><?php _e( 'No', 'give' ); ?>
491
+																	<?php checked(0, absint(give_get_meta($payment_id, '_give_anonymous_donation', true))) ?>
492
+																><?php _e('No', 'give'); ?>
493 493
 															</label>
494 494
 														</li>
495 495
 													</ul>
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 												 *
507 507
 												 * @param int $payment_id Payment id.
508 508
 												 */
509
-												do_action( 'give_donation_details_thead_before', $payment_id );
509
+												do_action('give_donation_details_thead_before', $payment_id);
510 510
 
511 511
 
512 512
 												/**
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 												 *
519 519
 												 * @param int $payment_id Payment id.
520 520
 												 */
521
-												do_action( 'give_donation_details_thead_after', $payment_id );
521
+												do_action('give_donation_details_thead_after', $payment_id);
522 522
 
523 523
 												/**
524 524
 												 * Fires in donation details page, in the donation-information metabox, before the body elements.
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 												 *
530 530
 												 * @param int $payment_id Payment id.
531 531
 												 */
532
-												do_action( 'give_donation_details_tbody_before', $payment_id );
532
+												do_action('give_donation_details_tbody_before', $payment_id);
533 533
 
534 534
 												/**
535 535
 												 * Fires in donation details page, in the donation-information metabox, after the body elements.
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 												 *
541 541
 												 * @param int $payment_id Payment id.
542 542
 												 */
543
-												do_action( 'give_donation_details_tbody_after', $payment_id );
543
+												do_action('give_donation_details_tbody_after', $payment_id);
544 544
 												?>
545 545
 											</p>
546 546
 										</div>
@@ -560,66 +560,66 @@  discard block
 block discarded – undo
560 560
 							 *
561 561
 							 * @param int $payment_id Payment id.
562 562
 							 */
563
-							do_action( 'give_view_donation_details_donor_detail_before', $payment_id );
563
+							do_action('give_view_donation_details_donor_detail_before', $payment_id);
564 564
 							?>
565 565
 
566 566
 							<div id="give-donor-details" class="postbox">
567
-								<h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
567
+								<h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3>
568 568
 
569 569
 								<div class="inside">
570 570
 
571
-									<?php $donor = new Give_Donor( $donor_id ); ?>
571
+									<?php $donor = new Give_Donor($donor_id); ?>
572 572
 
573 573
 									<div class="column-container donor-info">
574 574
 										<div class="column">
575 575
 											<p>
576
-												<strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
576
+												<strong><?php esc_html_e('Donor ID:', 'give'); ?></strong><br>
577 577
 												<?php
578
-												if ( ! empty( $donor->id ) ) {
578
+												if ( ! empty($donor->id)) {
579 579
 													printf(
580 580
 														'<a href="%1$s">%2$s</a>',
581
-														esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ),
582
-														intval( $donor->id )
581
+														esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)),
582
+														intval($donor->id)
583 583
 													);
584 584
 												}
585 585
 												?>
586
-												<span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span>
586
+												<span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e('Create New Donor', 'give'); ?></a>)</span>
587 587
 											</p>
588 588
 											<p>
589
-												<strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
590
-												<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
589
+												<strong><?php esc_html_e('Donor Since:', 'give'); ?></strong><br>
590
+												<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
591 591
 											</p>
592 592
 										</div>
593 593
 										<div class="column">
594 594
 											<p>
595
-												<strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
595
+												<strong><?php esc_html_e('Donor Name:', 'give'); ?></strong><br>
596 596
 												<?php
597
-												$donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
598
-												$donor_name         = give_get_donor_name_by( $donor_id, 'donor' );
597
+												$donor_billing_name = give_get_donor_name_by($payment_id, 'donation');
598
+												$donor_name         = give_get_donor_name_by($donor_id, 'donor');
599 599
 
600 600
 												// Check whether the donor name and WP_User name is same or not.
601
-												if ( $donor_billing_name !== $donor_name ) {
601
+												if ($donor_billing_name !== $donor_name) {
602 602
 													echo sprintf(
603 603
 														'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
604
-														esc_html( $donor_billing_name ),
605
-														esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
606
-														esc_html( $donor_name )
604
+														esc_html($donor_billing_name),
605
+														esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")),
606
+														esc_html($donor_name)
607 607
 													);
608 608
 												} else {
609
-													echo esc_html( $donor_name );
609
+													echo esc_html($donor_name);
610 610
 												}
611 611
 												?>
612 612
 											</p>
613 613
 											<p>
614
-												<strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
614
+												<strong><?php esc_html_e('Donor Email:', 'give'); ?></strong><br>
615 615
 												<?php
616 616
 												// Show Donor donation email first and Primary email on parenthesis if not match both email.
617
-												echo hash_equals( $donor->email, $payment->email )
617
+												echo hash_equals($donor->email, $payment->email)
618 618
 													? $payment->email
619 619
 													: sprintf(
620 620
 														'%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
621 621
 														$payment->email,
622
-														esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
622
+														esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")),
623 623
 														$donor->email
624 624
 													);
625 625
 												?>
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 										</div>
628 628
 										<div class="column">
629 629
 											<p>
630
-												<strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
630
+												<strong><?php esc_html_e('Change Donor:', 'give'); ?></strong><br>
631 631
 												<?php
632 632
 												echo Give()->html->donor_dropdown(
633 633
 													array(
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 												?>
639 639
 											</p>
640 640
 											<p>
641
-												<?php if ( ! empty( $company_name ) ) {
641
+												<?php if ( ! empty($company_name)) {
642 642
 													?>
643
-													<strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br>
643
+													<strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br>
644 644
 													<?php
645 645
 													echo $company_name;
646 646
 												} ?>
@@ -651,19 +651,19 @@  discard block
 block discarded – undo
651 651
 									<div class="column-container new-donor" style="display: none">
652 652
 										<div class="column">
653 653
 											<p>
654
-												<label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
654
+												<label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label>
655 655
 												<input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
656 656
 											</p>
657 657
 										</div>
658 658
 										<div class="column">
659 659
 											<p>
660
-												<label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
660
+												<label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label>
661 661
 												<input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
662 662
 											</p>
663 663
 										</div>
664 664
 										<div class="column">
665 665
 											<p>
666
-												<label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
666
+												<label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label>
667 667
 												<input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
668 668
 											</p>
669 669
 										</div>
@@ -671,9 +671,9 @@  discard block
 block discarded – undo
671 671
 											<p>
672 672
 												<input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
673 673
 												<input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
674
-												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
674
+												<a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a>
675 675
 												<br>
676
-												<em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
676
+												<em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em>
677 677
 											</p>
678 678
 										</div>
679 679
 									</div>
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 									 * @param array $payment_meta Payment meta.
689 689
 									 * @param array $user_info    User information.
690 690
 									 */
691
-									do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
691
+									do_action('give_payment_personal_details_list', $payment_meta, $user_info);
692 692
 
693 693
 									/**
694 694
 									 * Fires on the donation details page, in the donor-details metabox.
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 									 *
698 698
 									 * @param int $payment_id Payment id.
699 699
 									 */
700
-									do_action( 'give_payment_view_details', $payment_id );
700
+									do_action('give_payment_view_details', $payment_id);
701 701
 									?>
702 702
 
703 703
 								</div>
@@ -713,11 +713,11 @@  discard block
 block discarded – undo
713 713
 							 *
714 714
 							 * @param int $payment_id Payment id.
715 715
 							 */
716
-							do_action( 'give_view_donation_details_billing_before', $payment_id );
716
+							do_action('give_view_donation_details_billing_before', $payment_id);
717 717
 							?>
718 718
 
719 719
 							<div id="give-billing-details" class="postbox">
720
-								<h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
720
+								<h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3>
721 721
 
722 722
 								<div class="inside">
723 723
 
@@ -727,9 +727,9 @@  discard block
 block discarded – undo
727 727
 											<div class="data column-container">
728 728
 
729 729
 												<?php
730
-												$address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
730
+												$address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country());
731 731
 
732
-												$address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
732
+												$address['state'] = ( ! empty($address['state']) ? $address['state'] : '');
733 733
 
734 734
 												// Get the country list that does not have any states init.
735 735
 												$no_states_country = give_no_states_country_list();
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 
738 738
 												<div class="row">
739 739
 													<div id="give-order-address-country-wrap">
740
-														<label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
740
+														<label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label>
741 741
 														<?php
742 742
 														echo Give()->html->select(
743 743
 															array(
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
 																'show_option_all'  => false,
748 748
 																'show_option_none' => false,
749 749
 																'chosen'           => true,
750
-																'placeholder'      => esc_attr__( 'Select a country', 'give' ),
751
-																'data'             => array( 'search-type' => 'no_ajax' ),
750
+																'placeholder'      => esc_attr__('Select a country', 'give'),
751
+																'data'             => array('search-type' => 'no_ajax'),
752 752
 															)
753 753
 														);
754 754
 														?>
@@ -757,35 +757,35 @@  discard block
 block discarded – undo
757 757
 
758 758
 												<div class="row">
759 759
 													<div class="give-wrap-address-line1">
760
-														<label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
761
-														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
760
+														<label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label>
761
+														<input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/>
762 762
 													</div>
763 763
 												</div>
764 764
 
765 765
 												<div class="row">
766 766
 													<div class="give-wrap-address-line2">
767
-														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
768
-														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
767
+														<label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label>
768
+														<input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/>
769 769
 													</div>
770 770
 												</div>
771 771
 
772 772
 												<div class="row">
773 773
 													<div class="give-wrap-address-city">
774
-														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
775
-														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
774
+														<label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label>
775
+														<input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/>
776 776
 													</div>
777 777
 												</div>
778 778
 
779 779
 												<?php
780
-												$state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
780
+												$state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false);
781 781
 												?>
782 782
 												<div class="row">
783
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
784
-														<div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
785
-															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
783
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state">
784
+														<div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>">
785
+															<label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label>
786 786
 															<?php
787
-															$states = give_get_states( $address['country'] );
788
-															if ( ! empty( $states ) ) {
787
+															$states = give_get_states($address['country']);
788
+															if ( ! empty($states)) {
789 789
 																echo Give()->html->select(
790 790
 																	array(
791 791
 																		'options'          => $states,
@@ -794,23 +794,23 @@  discard block
 block discarded – undo
794 794
 																		'show_option_all'  => false,
795 795
 																		'show_option_none' => false,
796 796
 																		'chosen'           => true,
797
-																		'placeholder'      => esc_attr__( 'Select a state', 'give' ),
798
-																		'data'             => array( 'search-type' => 'no_ajax' ),
797
+																		'placeholder'      => esc_attr__('Select a state', 'give'),
798
+																		'data'             => array('search-type' => 'no_ajax'),
799 799
 																	)
800 800
 																);
801 801
 															} else {
802 802
 																?>
803
-																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
803
+																<input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/>
804 804
 																<?php
805 805
 															}
806 806
 															?>
807 807
 														</div>
808 808
 													</div>
809 809
 
810
-													<div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
810
+													<div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip">
811 811
 														<div class="give-wrap-address-zip">
812
-															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
813
-															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
812
+															<label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label>
813
+															<input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/>
814 814
 														</div>
815 815
 													</div>
816 816
 												</div>
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
 									 *
830 830
 									 * @param int $payment_id Payment id.
831 831
 									 */
832
-									do_action( 'give_payment_billing_details', $payment_id );
832
+									do_action('give_payment_billing_details', $payment_id);
833 833
 									?>
834 834
 
835 835
 								</div>
@@ -845,40 +845,40 @@  discard block
 block discarded – undo
845 845
 							 *
846 846
 							 * @param int $payment_id Payment id.
847 847
 							 */
848
-							do_action( 'give_view_donation_details_billing_after', $payment_id );
848
+							do_action('give_view_donation_details_billing_after', $payment_id);
849 849
 							?>
850 850
 
851 851
 							<div id="give-payment-notes" class="postbox">
852
-								<h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
852
+								<h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3>
853 853
 
854 854
 								<div class="inside">
855 855
 									<div id="give-payment-notes-inner">
856 856
 										<?php
857
-										$notes = give_get_payment_notes( $payment_id );
858
-										if ( ! empty( $notes ) ) {
857
+										$notes = give_get_payment_notes($payment_id);
858
+										if ( ! empty($notes)) {
859 859
 											$no_notes_display = ' style="display:none;"';
860
-											foreach ( $notes as $note ) :
860
+											foreach ($notes as $note) :
861 861
 
862
-												echo give_get_payment_note_html( $note, $payment_id );
862
+												echo give_get_payment_note_html($note, $payment_id);
863 863
 
864 864
 											endforeach;
865 865
 										} else {
866 866
 											$no_notes_display = '';
867 867
 										}
868 868
 
869
-										echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
869
+										echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>';
870 870
 										?>
871 871
 									</div>
872 872
 									<textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
873 873
 
874 874
 									<div class="give-clearfix">
875 875
 										<p>
876
-											<label for="donation_note_type" class="screen-reader-text"><?php _e( 'Note type', 'give' ); ?></label>
876
+											<label for="donation_note_type" class="screen-reader-text"><?php _e('Note type', 'give'); ?></label>
877 877
 											<select name="donation_note_type" id="donation_note_type">
878
-												<option value=""><?php _e( 'Private note', 'give' ); ?></option>
879
-												<option value="donor"><?php _e( 'Note to donor', 'give' ); ?></option>
878
+												<option value=""><?php _e('Private note', 'give'); ?></option>
879
+												<option value="donor"><?php _e('Note to donor', 'give'); ?></option>
880 880
 											</select>
881
-											<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
881
+											<button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button>
882 882
 										</p>
883 883
 									</div>
884 884
 
@@ -895,18 +895,18 @@  discard block
 block discarded – undo
895 895
 							 *
896 896
 							 * @param int $payment_id Payment id.
897 897
 							 */
898
-							do_action( 'give_view_donation_details_main_after', $payment_id );
898
+							do_action('give_view_donation_details_main_after', $payment_id);
899 899
 							?>
900 900
 
901
-							<?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?>
901
+							<?php if (give_is_donor_comment_field_enabled($payment->form_id)) : ?>
902 902
 								<div id="give-payment-donor-comment" class="postbox">
903
-									<h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3>
903
+									<h3 class="hndle"><?php _e('Donor Comment', 'give'); ?></h3>
904 904
 
905 905
 									<div class="inside">
906 906
 										<div id="give-payment-donor-comment-inner">
907 907
 											<p>
908 908
 												<?php
909
-												$donor_comment = give_get_donor_donation_comment( $payment_id, $payment->donor_id );
909
+												$donor_comment = give_get_donor_donation_comment($payment_id, $payment->donor_id);
910 910
 
911 911
 												echo sprintf(
912 912
 													'<input type="hidden" name="give_comment_id" value="%s">',
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 
916 916
 												echo sprintf(
917 917
 													'<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>',
918
-													__( 'Add a comment', 'give' ),
918
+													__('Add a comment', 'give'),
919 919
 													$donor_comment instanceof WP_Comment ? $donor_comment->comment_content : ''
920 920
 												);
921 921
 												?>
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 							 *
937 937
 							 * @param int $payment_id Payment id.
938 938
 							 */
939
-							do_action( 'give_view_donation_details_main_after', $payment_id );
939
+							do_action('give_view_donation_details_main_after', $payment_id);
940 940
 							?>
941 941
 
942 942
 						</div>
@@ -958,11 +958,11 @@  discard block
 block discarded – undo
958 958
 		 *
959 959
 		 * @param int $payment_id Payment id.
960 960
 		 */
961
-		do_action( 'give_view_donation_details_form_bottom', $payment_id );
961
+		do_action('give_view_donation_details_form_bottom', $payment_id);
962 962
 
963
-		wp_nonce_field( 'give_update_payment_details_nonce' );
963
+		wp_nonce_field('give_update_payment_details_nonce');
964 964
 		?>
965
-		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
965
+		<input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/>
966 966
 		<input type="hidden" name="give_action" value="update_payment_details"/>
967 967
 	</form>
968 968
 	<?php
@@ -973,6 +973,6 @@  discard block
 block discarded – undo
973 973
 	 *
974 974
 	 * @param int $payment_id Payment id.
975 975
 	 */
976
-	do_action( 'give_view_donation_details_after', $payment_id );
976
+	do_action('give_view_donation_details_after', $payment_id);
977 977
 	?>
978 978
 </div><!-- /.wrap -->
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 1 patch
Spacing   +149 added lines, -149 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,48 +25,48 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return      void
27 27
  */
28
-function give_update_payment_details( $data ) {
28
+function give_update_payment_details($data) {
29 29
 
30
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
31
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	check_admin_referer( 'give_update_payment_details_nonce' );
34
+	check_admin_referer('give_update_payment_details_nonce');
35 35
 
36 36
 	// Retrieve the payment ID.
37
-	$payment_id = absint( $data['give_payment_id'] );
37
+	$payment_id = absint($data['give_payment_id']);
38 38
 
39 39
 	/* @var Give_Payment $payment */
40
-	$payment = new Give_Payment( $payment_id );
40
+	$payment = new Give_Payment($payment_id);
41 41
 
42 42
 	$status = $data['give-payment-status'];
43
-	$date   = sanitize_text_field( $data['give-payment-date'] );
44
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
43
+	$date   = sanitize_text_field($data['give-payment-date']);
44
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
45 45
 
46 46
 	// Restrict to our high and low.
47
-	if ( $hour > 23 ) {
47
+	if ($hour > 23) {
48 48
 		$hour = 23;
49
-	} elseif ( $hour < 0 ) {
49
+	} elseif ($hour < 0) {
50 50
 		$hour = 00;
51 51
 	}
52 52
 
53
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
53
+	$minute = sanitize_text_field($data['give-payment-time-min']);
54 54
 
55 55
 	// Restrict to our high and low.
56
-	if ( $minute > 59 ) {
56
+	if ($minute > 59) {
57 57
 		$minute = 59;
58
-	} elseif ( $minute < 0 ) {
58
+	} elseif ($minute < 0) {
59 59
 		$minute = 00;
60 60
 	}
61 61
 
62
-	$address = give_clean( $data['give-payment-address'][0] );
62
+	$address = give_clean($data['give-payment-address'][0]);
63 63
 
64 64
 	$curr_total = $payment->total;
65
-	$new_total  = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) );
66
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
65
+	$new_total  = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0));
66
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
67 67
 
68
-	$curr_donor_id = sanitize_text_field( $data['give-current-donor'] );
69
-	$new_donor_id  = sanitize_text_field( $data['donor-id'] );
68
+	$curr_donor_id = sanitize_text_field($data['give-current-donor']);
69
+	$new_donor_id  = sanitize_text_field($data['donor-id']);
70 70
 
71 71
 	/**
72 72
 	 * Fires before updating edited donation.
@@ -76,74 +76,74 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param int $payment_id The ID of the payment.
78 78
 	 */
79
-	do_action( 'give_update_edited_donation', $payment_id );
79
+	do_action('give_update_edited_donation', $payment_id);
80 80
 
81 81
 	$payment->date = $date;
82
-	$payment->anonymous = isset( $data['give_anonymous_donation'] ) ? absint( $data['give_anonymous_donation'] ) : 0;
82
+	$payment->anonymous = isset($data['give_anonymous_donation']) ? absint($data['give_anonymous_donation']) : 0;
83 83
 
84 84
 
85
-	$updated       = $payment->save();
85
+	$updated = $payment->save();
86 86
 
87
-	if ( 0 === $updated ) {
88
-		wp_die( __( 'Error Updating Donation.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
87
+	if (0 === $updated) {
88
+		wp_die(__('Error Updating Donation.', 'give'), __('Error', 'give'), array('response' => 400));
89 89
 	}
90 90
 
91 91
 	$donor_changed = false;
92 92
 
93
-	if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) {
93
+	if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') {
94 94
 
95
-		$email      = ! empty( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : '';
96
-		$first_name = ! empty( $data['give-new-donor-first-name'] ) ? sanitize_text_field( $data['give-new-donor-first-name'] ) : '';
97
-		$last_name  = ! empty( $data['give-new-donor-last-name'] ) ? sanitize_text_field( $data['give-new-donor-last-name'] ) : '';
98
-		$names      = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) );
95
+		$email      = ! empty($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : '';
96
+		$first_name = ! empty($data['give-new-donor-first-name']) ? sanitize_text_field($data['give-new-donor-first-name']) : '';
97
+		$last_name  = ! empty($data['give-new-donor-last-name']) ? sanitize_text_field($data['give-new-donor-last-name']) : '';
98
+		$names      = strip_tags(wp_unslash(trim("{$first_name} {$last_name}")));
99 99
 
100
-		if ( empty( $email ) || empty( $first_name ) ) {
101
-			wp_die( __( 'New Donor requires first name and email address.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
100
+		if (empty($email) || empty($first_name)) {
101
+			wp_die(__('New Donor requires first name and email address.', 'give'), __('Error', 'give'), array('response' => 400));
102 102
 		}
103 103
 
104
-		$donor = new Give_Donor( $email );
105
-		if ( empty( $donor->id ) ) {
106
-			$donor_data = array( 'name' => $names, 'email' => $email );
107
-			$user_id       = email_exists( $email );
108
-			if ( false !== $user_id ) {
104
+		$donor = new Give_Donor($email);
105
+		if (empty($donor->id)) {
106
+			$donor_data = array('name' => $names, 'email' => $email);
107
+			$user_id = email_exists($email);
108
+			if (false !== $user_id) {
109 109
 				$donor_data['user_id'] = $user_id;
110 110
 			}
111 111
 
112
-			if ( ! $donor->create( $donor_data ) ) {
112
+			if ( ! $donor->create($donor_data)) {
113 113
 				// Failed to create the new donor, assume the previous donor.
114 114
 				$donor_changed = false;
115
-				$donor         = new Give_Donor( $curr_donor_id );
116
-				give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) );
115
+				$donor         = new Give_Donor($curr_donor_id);
116
+				give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give'));
117 117
 			}
118 118
 		}
119 119
 
120 120
 		// Create and Update Donor First Name and Last Name in Meta Fields.
121
-		$donor->update_meta( '_give_donor_first_name', $first_name );
122
-		$donor->update_meta( '_give_donor_last_name', $last_name );
121
+		$donor->update_meta('_give_donor_first_name', $first_name);
122
+		$donor->update_meta('_give_donor_last_name', $last_name);
123 123
 
124 124
 		$new_donor_id = $donor->id;
125 125
 
126
-		$previous_donor = new Give_Donor( $curr_donor_id );
126
+		$previous_donor = new Give_Donor($curr_donor_id);
127 127
 
128 128
 		$donor_changed = true;
129 129
 
130
-	} elseif ( $curr_donor_id !== $new_donor_id ) {
130
+	} elseif ($curr_donor_id !== $new_donor_id) {
131 131
 
132
-		$donor = new Give_Donor( $new_donor_id );
132
+		$donor = new Give_Donor($new_donor_id);
133 133
 		$email    = $donor->email;
134 134
 		$names    = $donor->name;
135 135
 
136
-		$previous_donor = new Give_Donor( $curr_donor_id );
136
+		$previous_donor = new Give_Donor($curr_donor_id);
137 137
 
138 138
 		$donor_changed = true;
139 139
 
140 140
 	} else {
141
-		$donor = new Give_Donor( $curr_donor_id );
141
+		$donor = new Give_Donor($curr_donor_id);
142 142
 		$email    = $donor->email;
143 143
 		$names    = $donor->name;
144 144
 	}
145 145
 
146
-	if ( $donor_changed ) {
146
+	if ($donor_changed) {
147 147
 
148 148
 		// Setup first and last name from input values.
149 149
 		$first_name = $donor->get_first_name();
@@ -153,26 +153,26 @@  discard block
 block discarded – undo
153 153
 		$payment->last_name  = $last_name;
154 154
 
155 155
 		// Remove the stats and payment from the previous donor and attach it to the new donor.
156
-		$previous_donor->remove_payment( $payment_id, false );
157
-		$donor->attach_payment( $payment_id, false );
156
+		$previous_donor->remove_payment($payment_id, false);
157
+		$donor->attach_payment($payment_id, false);
158 158
 
159
-		if ( 'publish' == $status ) {
159
+		if ('publish' == $status) {
160 160
 
161 161
 			// Reduce previous user donation count and amount.
162 162
 			$previous_donor->decrease_donation_count();
163
-			$previous_donor->decrease_value( $curr_total );
163
+			$previous_donor->decrease_value($curr_total);
164 164
 
165 165
 			// If donation was completed adjust stats of new donors.
166 166
 			$donor->increase_purchase_count();
167
-			$donor->increase_value( $new_total );
167
+			$donor->increase_value($new_total);
168 168
 		}
169 169
 
170 170
 		$payment->customer_id = $donor->id;
171 171
 	} else {
172 172
 
173
-		if ( 'publish' === $status ) {
173
+		if ('publish' === $status) {
174 174
 			// Update user donation stat.
175
-			$donor->update_donation_value( $curr_total, $new_total );
175
+			$donor->update_donation_value($curr_total, $new_total);
176 176
 		}
177 177
 	}
178 178
 
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
 	$payment->total      = $new_total;
184 184
 
185 185
 	// Check for payment notes.
186
-	if ( ! empty( $data['give-payment-note'] ) ) {
186
+	if ( ! empty($data['give-payment-note'])) {
187 187
 
188
-		$note = wp_kses( $data['give-payment-note'], array() );
189
-		give_insert_payment_note( $payment_id, $note );
188
+		$note = wp_kses($data['give-payment-note'], array());
189
+		give_insert_payment_note($payment_id, $note);
190 190
 
191 191
 	}
192 192
 
@@ -194,77 +194,77 @@  discard block
 block discarded – undo
194 194
 	$payment->status = $status;
195 195
 
196 196
 	// Adjust total store earnings if the payment total has been changed.
197
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
197
+	if ($new_total !== $curr_total && 'publish' == $status) {
198 198
 
199
-		if ( $new_total > $curr_total ) {
199
+		if ($new_total > $curr_total) {
200 200
 			// Increase if our new total is higher.
201 201
 			$difference = $new_total - $curr_total;
202
-			give_increase_total_earnings( $difference );
202
+			give_increase_total_earnings($difference);
203 203
 
204 204
 			// Increase form earnings.
205
-			give_increase_earnings( $payment->form_id, $difference, $payment->ID );
206
-		} elseif ( $curr_total > $new_total ) {
205
+			give_increase_earnings($payment->form_id, $difference, $payment->ID);
206
+		} elseif ($curr_total > $new_total) {
207 207
 			// Decrease if our new total is lower.
208 208
 			$difference = $curr_total - $new_total;
209
-			give_decrease_total_earnings( $difference );
209
+			give_decrease_total_earnings($difference);
210 210
 
211 211
 			// Decrease form earnings.
212
-			give_decrease_form_earnings( $payment->form_id, $difference, $payment->ID );
212
+			give_decrease_form_earnings($payment->form_id, $difference, $payment->ID);
213 213
 		}
214 214
 	}
215 215
 
216 216
 	$payment->save();
217 217
 
218 218
 	// Get new give form ID.
219
-	$new_form_id     = absint( $data['give-payment-form-select'] );
220
-	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
219
+	$new_form_id     = absint($data['give-payment-form-select']);
220
+	$current_form_id = absint($payment->get_meta('_give_payment_form_id'));
221 221
 
222 222
 	// We are adding payment transfer code in last to remove any conflict with above functionality.
223 223
 	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
224 224
 	// Check if user want to transfer current payment to new give form id.
225
-	if ( $new_form_id && $new_form_id != $current_form_id ) {
225
+	if ($new_form_id && $new_form_id != $current_form_id) {
226 226
 
227 227
 		// Get new give form title.
228
-		$new_form_title = get_the_title( $new_form_id );
228
+		$new_form_title = get_the_title($new_form_id);
229 229
 
230 230
 		// Update payment give form meta data.
231
-		$payment->update_meta( '_give_payment_form_id', $new_form_id );
232
-		$payment->update_meta( '_give_payment_form_title', $new_form_title );
231
+		$payment->update_meta('_give_payment_form_id', $new_form_id);
232
+		$payment->update_meta('_give_payment_form_title', $new_form_title);
233 233
 
234 234
 		// Update price id payment metadata.
235
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
236
-			$payment->update_meta( '_give_payment_price_id', '' );
235
+		if ( ! give_has_variable_prices($new_form_id)) {
236
+			$payment->update_meta('_give_payment_price_id', '');
237 237
 		}
238 238
 
239 239
 		// If donation was completed, adjust stats of forms.
240
-		if ( 'publish' == $status ) {
240
+		if ('publish' == $status) {
241 241
 
242 242
 			// Decrease sale of old give form. For other payment status.
243
-			$current_form = new Give_Donate_Form( $current_form_id );
243
+			$current_form = new Give_Donate_Form($current_form_id);
244 244
 			$current_form->decrease_sales();
245
-			$current_form->decrease_earnings( $curr_total, $payment->ID );
245
+			$current_form->decrease_earnings($curr_total, $payment->ID);
246 246
 
247 247
 			// Increase sale of new give form.
248
-			$new_form = new Give_Donate_Form( $new_form_id );
248
+			$new_form = new Give_Donate_Form($new_form_id);
249 249
 			$new_form->increase_sales();
250
-			$new_form->increase_earnings( $new_total, $payment->ID );
250
+			$new_form->increase_earnings($new_total, $payment->ID);
251 251
 		}
252 252
 
253 253
 		// Re setup payment to update new meta value in object.
254
-		$payment->update_payment_setup( $payment->ID );
254
+		$payment->update_payment_setup($payment->ID);
255 255
 
256 256
 		// Update form id in payment logs.
257
-		Give()->async_process->data( array(
258
-			'data' => array( $new_form_id, $payment_id ),
257
+		Give()->async_process->data(array(
258
+			'data' => array($new_form_id, $payment_id),
259 259
 			'hook' => 'give_update_log_form_id',
260
-		) )->dispatch();
260
+		))->dispatch();
261 261
 	}
262 262
 
263 263
 	// Update price id if current form is variable form.
264 264
 	/* @var Give_Donate_Form $form */
265
-	$form = new Give_Donate_Form( $payment->form_id );
265
+	$form = new Give_Donate_Form($payment->form_id);
266 266
 
267
-	if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) {
267
+	if (isset($data['give-variable-price']) && $form->has_variable_prices()) {
268 268
 
269 269
 		// Get payment meta data.
270 270
 		$payment_meta = $payment->get_meta();
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
 		$price_id = '';
274 274
 
275 275
 		// Get price info
276
-		if( 0 <= $data['give-variable-price'] ) {
277
-			foreach ( $form->prices as $variable_price ) {
278
-				if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) {
276
+		if (0 <= $data['give-variable-price']) {
277
+			foreach ($form->prices as $variable_price) {
278
+				if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) {
279 279
 					$price_info = $variable_price;
280 280
 					break;
281 281
 				}
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 		}
284 284
 
285 285
 		// Set price id.
286
-		if( ! empty( $price_info ) ) {
286
+		if ( ! empty($price_info)) {
287 287
 			$price_id = $data['give-variable-price'];
288 288
 
289
-			if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) {
289
+			if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) {
290 290
 				// Set price id to amount match.
291 291
 				$price_id = $price_info['_give_id']['level_id'];
292 292
 			}
293 293
 
294
-		} elseif( $form->is_custom_price_mode() ){
294
+		} elseif ($form->is_custom_price_mode()) {
295 295
 			$price_id = 'custom';
296 296
 		}
297 297
 
@@ -299,34 +299,34 @@  discard block
 block discarded – undo
299 299
 		$payment_meta['price_id'] = $price_id;
300 300
 
301 301
 		// Update payment give form meta data.
302
-		$payment->update_meta( '_give_payment_price_id', $price_id );
303
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
302
+		$payment->update_meta('_give_payment_price_id', $price_id);
303
+		$payment->update_meta('_give_payment_meta', $payment_meta);
304 304
 
305 305
 		// Re setup payment to update new meta value in object.
306
-		$payment->update_payment_setup( $payment->ID );
306
+		$payment->update_payment_setup($payment->ID);
307 307
 	}
308 308
 
309
-	$comment_id            = isset( $data['give_comment_id'] ) ? absint( $data['give_comment_id'] ) : 0;
310
-	$is_anonymous_donation = give_is_anonymous_donation_field_enabled( $payment->form_id );
309
+	$comment_id            = isset($data['give_comment_id']) ? absint($data['give_comment_id']) : 0;
310
+	$is_anonymous_donation = give_is_anonymous_donation_field_enabled($payment->form_id);
311 311
 
312
-	if ( $is_anonymous_donation ) {
313
-		give_update_meta( $payment->ID, '_give_anonymous_donation', $payment->anonymous );
314
-		Give()->donor_meta->update_meta( $payment->donor_id, '_give_anonymous_donor', $payment->anonymous );
312
+	if ($is_anonymous_donation) {
313
+		give_update_meta($payment->ID, '_give_anonymous_donation', $payment->anonymous);
314
+		Give()->donor_meta->update_meta($payment->donor_id, '_give_anonymous_donor', $payment->anonymous);
315 315
 
316 316
 		// Update comment meta if admin is not updating comment.
317
-		if( $comment_id ) {
318
-			update_comment_meta( $comment_id, '_give_anonymous_donation', $payment->anonymous );
317
+		if ($comment_id) {
318
+			update_comment_meta($comment_id, '_give_anonymous_donation', $payment->anonymous);
319 319
 		}
320 320
 	}
321 321
 
322 322
 	// Update comment.
323
-	if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) {
323
+	if (give_is_donor_comment_field_enabled($payment->form_id)) {
324 324
 		// We are access comment directly from $_POST because comment formatting remove because of give_clean in give_post_actions.
325
-		$data['give_comment'] = trim( $_POST['give_comment'] );
325
+		$data['give_comment'] = trim($_POST['give_comment']);
326 326
 
327
-		if ( empty( $data['give_comment'] ) ) {
327
+		if (empty($data['give_comment'])) {
328 328
 			// Delete comment if empty
329
-			Give_Comment::delete( $comment_id, $payment_id, 'payment' );
329
+			Give_Comment::delete($comment_id, $payment_id, 'payment');
330 330
 
331 331
 		} else {
332 332
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 				'comment_author_email' => $payment->email
338 338
 			);
339 339
 
340
-			if ( $comment_id ) {
340
+			if ($comment_id) {
341 341
 				$comment_args['comment_ID'] = $comment_id;
342 342
 			}
343 343
 
@@ -348,16 +348,16 @@  discard block
 block discarded – undo
348 348
 				$comment_args
349 349
 			);
350 350
 
351
-			if ( $is_update_comment_meta ) {
352
-				update_comment_meta( $comment_id, '_give_anonymous_donation', $is_anonymous_donation );
351
+			if ($is_update_comment_meta) {
352
+				update_comment_meta($comment_id, '_give_anonymous_donation', $is_anonymous_donation);
353 353
 			}
354 354
 		}
355 355
 
356
-		$donor_has_comment = empty( $data['give_comment'] )
357
-			? ( $latest_comment = give_get_donor_latest_comment( $payment->donor_id ) && empty( $latest_comment ) ? '0' : '1' )
356
+		$donor_has_comment = empty($data['give_comment'])
357
+			? ($latest_comment = give_get_donor_latest_comment($payment->donor_id) && empty($latest_comment) ? '0' : '1')
358 358
 			: '1';
359 359
 
360
-		Give()->donor_meta->update_meta( $payment->donor_id, '_give_has_comment', $donor_has_comment );
360
+		Give()->donor_meta->update_meta($payment->donor_id, '_give_has_comment', $donor_has_comment);
361 361
 	}
362 362
 
363 363
 	/**
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
 	 *
369 369
 	 * @param int $payment_id The ID of the payment.
370 370
 	 */
371
-	do_action( 'give_updated_edited_donation', $payment_id );
371
+	do_action('give_updated_edited_donation', $payment_id);
372 372
 
373
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id=' . $payment_id ) );
373
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=payment-updated&id='.$payment_id));
374 374
 	exit;
375 375
 }
376 376
 
377
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
377
+add_action('give_update_payment_details', 'give_update_payment_details');
378 378
 
379 379
 /**
380 380
  * Trigger a Donation Deletion.
@@ -385,60 +385,60 @@  discard block
 block discarded – undo
385 385
  *
386 386
  * @return void
387 387
  */
388
-function give_trigger_donation_delete( $data ) {
389
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) {
388
+function give_trigger_donation_delete($data) {
389
+	if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) {
390 390
 
391
-		$payment_id = absint( $data['purchase_id'] );
391
+		$payment_id = absint($data['purchase_id']);
392 392
 
393
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
394
-			wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
393
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
394
+			wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
395 395
 		}
396 396
 
397
-		give_delete_donation( $payment_id );
398
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted' ) );
397
+		give_delete_donation($payment_id);
398
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-messages[]=donation-deleted'));
399 399
 		give_die();
400 400
 	}
401 401
 }
402 402
 
403
-add_action( 'give_delete_payment', 'give_trigger_donation_delete' );
403
+add_action('give_delete_payment', 'give_trigger_donation_delete');
404 404
 
405 405
 /**
406 406
  * AJAX Store Donation Note
407 407
  */
408 408
 function give_ajax_store_payment_note() {
409
-	$payment_id = absint( $_POST['payment_id'] );
410
-	$note       = wp_kses( $_POST['note'], array() );
411
-	$note_type  = give_clean( $_POST['type'] );
409
+	$payment_id = absint($_POST['payment_id']);
410
+	$note       = wp_kses($_POST['note'], array());
411
+	$note_type  = give_clean($_POST['type']);
412 412
 
413
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
414
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
413
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
414
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
415 415
 	}
416 416
 
417
-	if ( empty( $payment_id ) ) {
418
-		die( '-1' );
417
+	if (empty($payment_id)) {
418
+		die('-1');
419 419
 	}
420 420
 
421
-	if ( empty( $note ) ) {
422
-		die( '-1' );
421
+	if (empty($note)) {
422
+		die('-1');
423 423
 	}
424 424
 
425
-	$note_id = give_insert_payment_note( $payment_id, $note );
425
+	$note_id = give_insert_payment_note($payment_id, $note);
426 426
 
427
-	if( $note_id && $note_type ) {
428
-		add_comment_meta( $note_id, 'note_type', $note_type, true );
427
+	if ($note_id && $note_type) {
428
+		add_comment_meta($note_id, 'note_type', $note_type, true);
429 429
 
430 430
 		/**
431 431
 		 * Fire the action
432 432
 		 *
433 433
 		 * @since 2.3.0
434 434
 		 */
435
-		do_action( 'give_donor-note_email_notification', $note_id, $payment_id );
435
+		do_action('give_donor-note_email_notification', $note_id, $payment_id);
436 436
 	}
437 437
 
438
-	die( give_get_payment_note_html( $note_id ) );
438
+	die(give_get_payment_note_html($note_id));
439 439
 }
440 440
 
441
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
441
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
442 442
 
443 443
 /**
444 444
  * Triggers a donation note deletion without ajax
@@ -449,24 +449,24 @@  discard block
 block discarded – undo
449 449
  *
450 450
  * @return void
451 451
  */
452
-function give_trigger_payment_note_deletion( $data ) {
452
+function give_trigger_payment_note_deletion($data) {
453 453
 
454
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
454
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
455 455
 		return;
456 456
 	}
457 457
 
458
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
459
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
458
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
459
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
460 460
 	}
461 461
 
462
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
462
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-messages[]=donation-note-deleted&id='.absint($data['payment_id']));
463 463
 
464
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
464
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
465 465
 
466
-	wp_redirect( $edit_order_url );
466
+	wp_redirect($edit_order_url);
467 467
 }
468 468
 
469
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
469
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
470 470
 
471 471
 /**
472 472
  * Delete a payment note deletion with ajax
@@ -477,16 +477,16 @@  discard block
 block discarded – undo
477 477
  */
478 478
 function give_ajax_delete_payment_note() {
479 479
 
480
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
481
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
480
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
481
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
482 482
 	}
483 483
 
484
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
485
-		die( '1' );
484
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
485
+		die('1');
486 486
 	} else {
487
-		die( '-1' );
487
+		die('-1');
488 488
 	}
489 489
 
490 490
 }
491 491
 
492
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
492
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
  */
39 39
 
40 40
 // Exit if accessed directly.
41
-if ( ! defined( 'ABSPATH' ) ) {
41
+if ( ! defined('ABSPATH')) {
42 42
 	exit;
43 43
 }
44 44
 
45
-if ( ! class_exists( 'Give' ) ) :
45
+if ( ! class_exists('Give')) :
46 46
 
47 47
 	/**
48 48
 	 * Main Give Class
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		 * @return    Give
280 280
 		 */
281 281
 		public static function instance() {
282
-			if ( is_null( self::$_instance ) ) {
282
+			if (is_null(self::$_instance)) {
283 283
 				self::$_instance = new self();
284 284
 			}
285 285
 
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 		 */
292 292
 		public function __construct() {
293 293
 			// PHP version
294
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
295
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
294
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
295
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
296 296
 			}
297 297
 
298 298
 			// Bailout: Need minimum php version to load plugin.
299
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
300
-				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
299
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
300
+				add_action('admin_notices', array($this, 'minimum_phpversion_notice'));
301 301
 
302 302
 				return;
303 303
 			}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 			$this->includes();
307 307
 			$this->init_hooks();
308 308
 
309
-			do_action( 'give_loaded' );
309
+			do_action('give_loaded');
310 310
 		}
311 311
 
312 312
 		/**
@@ -315,11 +315,11 @@  discard block
 block discarded – undo
315 315
 		 * @since  1.8.9
316 316
 		 */
317 317
 		private function init_hooks() {
318
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
319
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
318
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
319
+			add_action('plugins_loaded', array($this, 'init'), 0);
320 320
 
321 321
 			// Set up localization on init Hook.
322
-			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
322
+			add_action('init', array($this, 'load_textdomain'), 0);
323 323
 		}
324 324
 
325 325
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			 *
336 336
 			 * @since 1.8.9
337 337
 			 */
338
-			do_action( 'before_give_init' );
338
+			do_action('before_give_init');
339 339
 
340 340
 			// Set up localization.
341 341
 			$this->load_textdomain();
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			 *
371 371
 			 * @since 1.8.7
372 372
 			 */
373
-			do_action( 'give_init', $this );
373
+			do_action('give_init', $this);
374 374
 
375 375
 		}
376 376
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 		 */
388 388
 		public function __clone() {
389 389
 			// Cloning instances of the class is forbidden.
390
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
390
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
391 391
 		}
392 392
 
393 393
 		/**
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 		 */
401 401
 		public function __wakeup() {
402 402
 			// Unserializing instances of the class is forbidden.
403
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
403
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
404 404
 		}
405 405
 
406 406
 		/**
@@ -414,33 +414,33 @@  discard block
 block discarded – undo
414 414
 		private function setup_constants() {
415 415
 
416 416
 			// Plugin version
417
-			if ( ! defined( 'GIVE_VERSION' ) ) {
418
-				define( 'GIVE_VERSION', '2.2.4' );
417
+			if ( ! defined('GIVE_VERSION')) {
418
+				define('GIVE_VERSION', '2.2.4');
419 419
 			}
420 420
 
421 421
 			// Plugin Root File
422
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
423
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
422
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
423
+				define('GIVE_PLUGIN_FILE', __FILE__);
424 424
 			}
425 425
 
426 426
 			// Plugin Folder Path
427
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
428
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
427
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
428
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
429 429
 			}
430 430
 
431 431
 			// Plugin Folder URL
432
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
433
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
432
+			if ( ! defined('GIVE_PLUGIN_URL')) {
433
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
434 434
 			}
435 435
 
436 436
 			// Plugin Basename aka: "give/give.php"
437
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
438
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
437
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
438
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
439 439
 			}
440 440
 
441 441
 			// Make sure CAL_GREGORIAN is defined
442
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
443
-				define( 'CAL_GREGORIAN', 1 );
442
+			if ( ! defined('CAL_GREGORIAN')) {
443
+				define('CAL_GREGORIAN', 1);
444 444
 			}
445 445
 		}
446 446
 
@@ -458,180 +458,180 @@  discard block
 block discarded – undo
458 458
 			/**
459 459
 			 * Composer's autoload.php.
460 460
 			 */
461
-			if ( file_exists( GIVE_PLUGIN_DIR . 'vendor/autoload.php' ) ) {
462
-				require_once GIVE_PLUGIN_DIR . 'vendor/autoload.php';
461
+			if (file_exists(GIVE_PLUGIN_DIR.'vendor/autoload.php')) {
462
+				require_once GIVE_PLUGIN_DIR.'vendor/autoload.php';
463 463
 			} else {
464 464
 				// Load autoloader.
465
-				require_once GIVE_PLUGIN_DIR . 'includes/libraries/tcpdf/tcpdf.php';
465
+				require_once GIVE_PLUGIN_DIR.'includes/libraries/tcpdf/tcpdf.php';
466 466
 			}
467 467
 
468 468
 			/**
469 469
 			 * Load libraries.
470 470
 			 */
471
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
472
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
471
+			if ( ! class_exists('WP_Async_Request')) {
472
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
473 473
 			}
474 474
 
475
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
476
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
475
+			if ( ! class_exists('WP_Background_Process')) {
476
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
477 477
 			}
478 478
 
479 479
 			/**
480 480
 			 * Load plugin files
481 481
 			 */
482
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
484 484
 			$give_options = give_get_settings();
485 485
 
486
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
488
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
489
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
490
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
491
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
497
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
498
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-readme-parser.php';
500
-
501
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php';
502
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
503
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
504
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
505
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
506
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
507
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
508
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
509
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
510
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php';
511
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
512
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor-wall-widget.php';
513
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
514
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sessions.php';
515
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
516
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
517
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
518
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
519
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
520
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
521
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-comment.php';
522
-
523
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
524
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
525
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
526
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
527
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
528
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
529
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
530
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
531
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
532
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
533
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
534
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
535
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
536
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
537
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
538
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
539
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
540
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
541
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
542
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
543
-
544
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
545
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
546
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
547
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
548
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
549
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
550
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php';
551
-
552
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
553
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
554
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
555
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
556
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
557
-
558
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
559
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
560
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
561
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
562
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
563
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
564
-
565
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
566
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-wall.php';
567
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donor-stats.php';
568
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
569
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/frontend-donor-functions.php';
570
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/actions.php';
571
-
572
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
573
-
574
-			require_once GIVE_PLUGIN_DIR . 'blocks/load.php';
575
-
576
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
577
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
488
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
489
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
490
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
491
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
497
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
498
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-readme-parser.php';
500
+
501
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php';
502
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
503
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
504
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
505
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
506
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
507
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
508
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
509
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
510
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php';
511
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
512
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor-wall-widget.php';
513
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
514
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sessions.php';
515
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
516
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
517
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
518
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
519
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
520
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
521
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-comment.php';
522
+
523
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
524
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
525
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
526
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
527
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
528
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
529
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
530
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
531
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
532
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
533
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
534
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
535
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
536
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
537
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
538
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
539
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
540
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
541
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
542
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
543
+
544
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
545
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
546
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
547
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
548
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
549
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
550
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php';
551
+
552
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
553
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
554
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
555
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
556
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
557
+
558
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
559
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
560
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
561
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
562
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
563
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
564
+
565
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
566
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-wall.php';
567
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donor-stats.php';
568
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
569
+			require_once GIVE_PLUGIN_DIR.'includes/donors/frontend-donor-functions.php';
570
+			require_once GIVE_PLUGIN_DIR.'includes/donors/actions.php';
571
+
572
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
573
+
574
+			require_once GIVE_PLUGIN_DIR.'blocks/load.php';
575
+
576
+			if (defined('WP_CLI') && WP_CLI) {
577
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
578 578
 			}
579 579
 
580
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
581
-
582
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
583
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
584
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
585
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
586
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
587
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
588
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
589
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
590
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
591
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
592
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
593
-
594
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
595
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
596
-
597
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
598
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
599
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
600
-
601
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
602
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-give-form-duplicator.php';
603
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
604
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
605
-
606
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
607
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
608
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
609
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
610
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php';
611
-
612
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
613
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
614
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
615
-
616
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
617
-
618
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
619
-
620
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
621
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
622
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
623
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
624
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
625
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
626
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
627
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php';
628
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
629
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
630
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php';
631
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donor-wall.php';
580
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
581
+
582
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
583
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
584
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
585
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
586
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
587
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
588
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
589
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
590
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
591
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
592
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
593
+
594
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
595
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
596
+
597
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
598
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
599
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
600
+
601
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
602
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-give-form-duplicator.php';
603
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
604
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
605
+
606
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
607
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
608
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
609
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
610
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php';
611
+
612
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
613
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
614
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
615
+
616
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
617
+
618
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
619
+
620
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
621
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
622
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
623
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
624
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
625
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
626
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
627
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php';
628
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
629
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
630
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php';
631
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donor-wall.php';
632 632
 			}// End if().
633 633
 
634
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
634
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
635 635
 
636 636
 		}
637 637
 
@@ -646,16 +646,16 @@  discard block
 block discarded – undo
646 646
 		public function load_textdomain() {
647 647
 
648 648
 			// Set filter for Give's languages directory
649
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
650
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
649
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
650
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
651 651
 
652 652
 			// Traditional WordPress plugin locale filter.
653
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
654
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
653
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
654
+			$locale = apply_filters('plugin_locale', $locale, 'give');
655 655
 
656
-			unload_textdomain( 'give' );
657
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
658
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
656
+			unload_textdomain('give');
657
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
658
+			load_plugin_textdomain('give', false, $give_lang_dir);
659 659
 
660 660
 		}
661 661
 
@@ -668,21 +668,21 @@  discard block
 block discarded – undo
668 668
 		 */
669 669
 		public function minimum_phpversion_notice() {
670 670
 			// Bailout.
671
-			if ( ! is_admin() ) {
671
+			if ( ! is_admin()) {
672 672
 				return;
673 673
 			}
674 674
 
675
-			$notice_desc  = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
676
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
677
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
678
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
679
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
680
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
681
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
675
+			$notice_desc  = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
676
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
677
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
678
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
679
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
680
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
681
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
682 682
 
683 683
 			echo sprintf(
684 684
 				'<div class="notice notice-error">%1$s</div>',
685
-				wp_kses_post( $notice_desc )
685
+				wp_kses_post($notice_desc)
686 686
 			);
687 687
 		}
688 688
 
Please login to merge, or discard this patch.