Completed
Pull Request — master (#1201)
by Ravinder
23:20
created
includes/admin/reporting/class-api-requests-logs-list-table.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return void
65 65
 	 */
66
-	public function search_box( $text, $input_id ) {
67
-		$input_id = $input_id . '-search-input';
66
+	public function search_box($text, $input_id) {
67
+		$input_id = $input_id.'-search-input';
68 68
 
69
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
70
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
69
+		if ( ! empty($_REQUEST['orderby'])) {
70
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
71 71
 		}
72
-		if ( ! empty( $_REQUEST['order'] ) ) {
73
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
72
+		if ( ! empty($_REQUEST['order'])) {
73
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
74 74
 		}
75 75
 		?>
76 76
 		<p class="search-box">
77 77
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
78 78
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" />
79
-			<?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?>
79
+			<?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?>
80 80
 		</p>
81 81
 	<?php
82 82
 	}
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function get_columns() {
92 92
 		$columns = array(
93
-			'ID'      => esc_html__( 'Log ID', 'give' ),
94
-			'details' => esc_html__( 'Request Details', 'give' ),
95
-			'ip'      => esc_html__( 'Request IP', 'give' ),
96
-			'date'    => esc_html__( 'Date', 'give' )
93
+			'ID'      => esc_html__('Log ID', 'give'),
94
+			'details' => esc_html__('Request Details', 'give'),
95
+			'ip'      => esc_html__('Request IP', 'give'),
96
+			'date'    => esc_html__('Date', 'give')
97 97
 		);
98 98
 
99 99
 		return $columns;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @return string Column Name
112 112
 	 */
113
-	public function column_default( $item, $column_name ) {
114
-		switch ( $column_name ) {
113
+	public function column_default($item, $column_name) {
114
+		switch ($column_name) {
115 115
 			default:
116
-				return $item[ $column_name ];
116
+				return $item[$column_name];
117 117
 		}
118 118
 	}
119 119
 
@@ -127,26 +127,26 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @return void
129 129
 	 */
130
-	public function column_details( $item ) {
130
+	public function column_details($item) {
131 131
 		?>
132
-		<a href="#TB_inline?width=640&amp;inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e( 'View Request', 'give' ); ?></a>
132
+		<a href="#TB_inline?width=640&amp;inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox"><?php esc_html_e('View Request', 'give'); ?></a>
133 133
 		<div id="log-details-<?php echo $item['ID']; ?>" style="display:none;">
134 134
 			<?php
135 135
 
136
-			$request = get_post_field( 'post_excerpt', $item['ID'] );
137
-			$error   = get_post_field( 'post_content', $item['ID'] );
138
-			echo '<p><strong>' . esc_html__( 'API Request:', 'give' ) . '</strong></p>';
139
-			echo '<div>' . $request . '</div>';
140
-			if ( ! empty( $error ) ) {
141
-				echo '<p><strong>' . esc_html__( 'Error', 'give' ) . '</strong></p>';
142
-				echo '<div>' . esc_html( $error ) . '</div>';
136
+			$request = get_post_field('post_excerpt', $item['ID']);
137
+			$error   = get_post_field('post_content', $item['ID']);
138
+			echo '<p><strong>'.esc_html__('API Request:', 'give').'</strong></p>';
139
+			echo '<div>'.$request.'</div>';
140
+			if ( ! empty($error)) {
141
+				echo '<p><strong>'.esc_html__('Error', 'give').'</strong></p>';
142
+				echo '<div>'.esc_html($error).'</div>';
143 143
 			}
144
-			echo '<p><strong>' . esc_html__( 'API User:', 'give' ) . '</strong></p>';
145
-			echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>';
146
-			echo '<p><strong>' . esc_html__( 'API Key:', 'give' ) . '</strong></p>';
147
-			echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>';
148
-			echo '<p><strong>' . esc_html__( 'Request Date:', 'give' ) . '</strong></p>';
149
-			echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>';
144
+			echo '<p><strong>'.esc_html__('API User:', 'give').'</strong></p>';
145
+			echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>';
146
+			echo '<p><strong>'.esc_html__('API Key:', 'give').'</strong></p>';
147
+			echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>';
148
+			echo '<p><strong>'.esc_html__('Request Date:', 'give').'</strong></p>';
149
+			echo '<div>'.get_post_field('post_date', $item['ID']).'</div>';
150 150
 			?>
151 151
 		</div>
152 152
 	<?php
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return mixed String if search is present, false otherwise
161 161
 	 */
162 162
 	public function get_search() {
163
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
163
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
164 164
 	}
165 165
 
166 166
 
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 	 *
177 177
 	 * @param string $which
178 178
 	 */
179
-	protected function display_tablenav( $which ) {
180
-		if ( 'top' === $which ) {
181
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
179
+	protected function display_tablenav($which) {
180
+		if ('top' === $which) {
181
+			wp_nonce_field('bulk-'.$this->_args['plural']);
182 182
 		}
183 183
 		?>
184
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
184
+		<div class="tablenav <?php echo esc_attr($which); ?>">
185 185
 
186 186
 			<div class="alignleft actions bulkactions">
187
-				<?php $this->bulk_actions( $which ); ?>
187
+				<?php $this->bulk_actions($which); ?>
188 188
 			</div>
189 189
 			<?php
190
-			$this->extra_tablenav( $which );
191
-			$this->pagination( $which );
190
+			$this->extra_tablenav($which);
191
+			$this->pagination($which);
192 192
 			?>
193 193
 
194 194
 			<br class="clear"/>
@@ -210,31 +210,31 @@  discard block
 block discarded – undo
210 210
 
211 211
 		$search = $this->get_search();
212 212
 
213
-		if ( $search ) {
214
-			if ( filter_var( $search, FILTER_VALIDATE_IP ) ) {
213
+		if ($search) {
214
+			if (filter_var($search, FILTER_VALIDATE_IP)) {
215 215
 				// This is an IP address search
216 216
 				$key = '_give_log_request_ip';
217
-			} else if ( is_email( $search ) ) {
217
+			} else if (is_email($search)) {
218 218
 				// This is an email search
219
-				$userdata = get_user_by( 'email', $search );
219
+				$userdata = get_user_by('email', $search);
220 220
 
221
-				if ( $userdata ) {
221
+				if ($userdata) {
222 222
 					$search = $userdata->ID;
223 223
 				}
224 224
 
225 225
 				$key = '_give_log_user';
226
-			} elseif ( strlen( $search ) == 32 ) {
226
+			} elseif (strlen($search) == 32) {
227 227
 				// Look for an API key
228 228
 				$key = '_give_log_key';
229
-			} elseif ( stristr( $search, 'token:' ) ) {
229
+			} elseif (stristr($search, 'token:')) {
230 230
 				// Look for an API token
231
-				$search = str_ireplace( 'token:', '', $search );
231
+				$search = str_ireplace('token:', '', $search);
232 232
 				$key    = '_give_log_token';
233 233
 			} else {
234 234
 				// This is (probably) a user ID search
235
-				$userdata = get_userdata( $search );
235
+				$userdata = get_userdata($search);
236 236
 
237
-				if ( $userdata ) {
237
+				if ($userdata) {
238 238
 					$search = $userdata->ID;
239 239
 				}
240 240
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @return int Current page number
261 261
 	 */
262 262
 	public function get_paged() {
263
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
263
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
264 264
 	}
265 265
 
266 266
 	/**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @since  1.0
271 271
 	 * @return void
272 272
 	 */
273
-	function bulk_actions( $which = '' ) {
273
+	function bulk_actions($which = '') {
274 274
 		give_log_views();
275 275
 	}
276 276
 
@@ -293,14 +293,14 @@  discard block
 block discarded – undo
293 293
 			'meta_query' => $this->get_meta_query()
294 294
 		);
295 295
 
296
-		$logs = $give_logs->get_connected_logs( $log_query );
296
+		$logs = $give_logs->get_connected_logs($log_query);
297 297
 
298
-		if ( $logs ) {
299
-			foreach ( $logs as $log ) {
298
+		if ($logs) {
299
+			foreach ($logs as $log) {
300 300
 
301 301
 				$logs_data[] = array(
302 302
 					'ID'   => $log->ID,
303
-					'ip'   => get_post_meta( $log->ID, '_give_log_request_ip', true ),
303
+					'ip'   => get_post_meta($log->ID, '_give_log_request_ip', true),
304 304
 					'date' => $log->post_date
305 305
 				);
306 306
 			}
@@ -328,14 +328,14 @@  discard block
 block discarded – undo
328 328
 		$columns               = $this->get_columns();
329 329
 		$hidden                = array(); // No hidden columns
330 330
 		$sortable              = $this->get_sortable_columns();
331
-		$this->_column_headers = array( $columns, $hidden, $sortable );
331
+		$this->_column_headers = array($columns, $hidden, $sortable);
332 332
 		$this->items           = $this->get_logs();
333
-		$total_items           = $give_logs->get_log_count( 0, 'api_requests' );
333
+		$total_items           = $give_logs->get_log_count(0, 'api_requests');
334 334
 
335
-		$this->set_pagination_args( array(
335
+		$this->set_pagination_args(array(
336 336
 				'total_items' => $total_items,
337 337
 				'per_page'    => $this->per_page,
338
-				'total_pages' => ceil( $total_items / $this->per_page )
338
+				'total_pages' => ceil($total_items / $this->per_page)
339 339
 			)
340 340
 		);
341 341
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/tools/class-give-tools-recount-income.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -54,50 +54,50 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function get_data() {
56 56
 
57
-		if ( $this->step == 1 ) {
58
-			$this->delete_data( 'give_temp_recount_income' );
57
+		if ($this->step == 1) {
58
+			$this->delete_data('give_temp_recount_income');
59 59
 		}
60 60
 
61
-		$total = get_option( 'give_temp_recount_income', false );
61
+		$total = get_option('give_temp_recount_income', false);
62 62
 
63
-		if ( false === $total ) {
63
+		if (false === $total) {
64 64
 			$total = (float) 0;
65
-			$this->store_data( 'give_temp_recount_income', $total );
65
+			$this->store_data('give_temp_recount_income', $total);
66 66
 		}
67 67
 
68
-		$accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) );
68
+		$accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish'));
69 69
 
70
-		$args = apply_filters( 'give_recount_income_args', array(
70
+		$args = apply_filters('give_recount_income_args', array(
71 71
 			'number' => $this->per_step,
72 72
 			'page'   => $this->step,
73 73
 			'status' => $accepted_statuses,
74 74
 			'fields' => 'ids'
75
-		) );
75
+		));
76 76
 
77
-		$payments = give_get_payments( $args );
77
+		$payments = give_get_payments($args);
78 78
 
79
-		if ( ! empty( $payments ) ) {
79
+		if ( ! empty($payments)) {
80 80
 
81
-			foreach ( $payments as $payment ) {
81
+			foreach ($payments as $payment) {
82 82
 
83
-				$total += give_get_payment_amount( $payment );
83
+				$total += give_get_payment_amount($payment);
84 84
 
85 85
 			}
86 86
 
87
-			if ( $total < 0 ) {
87
+			if ($total < 0) {
88 88
 				$totals = 0;
89 89
 			}
90 90
 
91
-			$total = round( $total, give_currency_decimal_filter() );
91
+			$total = round($total, give_currency_decimal_filter());
92 92
 
93
-			$this->store_data( 'give_temp_recount_income', $total );
93
+			$this->store_data('give_temp_recount_income', $total);
94 94
 
95 95
 			return true;
96 96
 
97 97
 		}
98 98
 
99
-		update_option( 'give_income_total', $total );
100
-		set_transient( 'give_income_total', $total, 86400 );
99
+		update_option('give_income_total', $total);
100
+		set_transient('give_income_total', $total, 86400);
101 101
 
102 102
 		return false;
103 103
 
@@ -111,25 +111,25 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function get_percentage_complete() {
113 113
 
114
-		$total = $this->get_stored_data( 'give_recount_income_total' );
114
+		$total = $this->get_stored_data('give_recount_income_total');
115 115
 
116
-		if ( false === $total ) {
117
-			$args = apply_filters( 'give_recount_income_total_args', array() );
116
+		if (false === $total) {
117
+			$args = apply_filters('give_recount_income_total_args', array());
118 118
 
119
-			$counts = give_count_payments( $args );
120
-			$total  = absint( $counts->publish );
121
-			$total  = apply_filters( 'give_recount_store_income_total', $total );
119
+			$counts = give_count_payments($args);
120
+			$total  = absint($counts->publish);
121
+			$total  = apply_filters('give_recount_store_income_total', $total);
122 122
 
123
-			$this->store_data( 'give_recount_income_total', $total );
123
+			$this->store_data('give_recount_income_total', $total);
124 124
 		}
125 125
 
126 126
 		$percentage = 100;
127 127
 
128
-		if ( $total > 0 ) {
129
-			$percentage = ( ( $this->per_step * $this->step ) / $total ) * 100;
128
+		if ($total > 0) {
129
+			$percentage = (($this->per_step * $this->step) / $total) * 100;
130 130
 		}
131 131
 
132
-		if ( $percentage > 100 ) {
132
+		if ($percentage > 100) {
133 133
 			$percentage = 100;
134 134
 		}
135 135
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 *
144 144
 	 * @param array $request The Form Data passed into the batch processing
145 145
 	 */
146
-	public function set_properties( $request ) {
146
+	public function set_properties($request) {
147 147
 	}
148 148
 
149 149
 	/**
@@ -154,31 +154,31 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	public function process_step() {
156 156
 
157
-		if ( ! $this->can_export() ) {
158
-			wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
157
+		if ( ! $this->can_export()) {
158
+			wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
159 159
 		}
160 160
 
161 161
 		$had_data = $this->get_data();
162 162
 
163
-		if ( $had_data ) {
163
+		if ($had_data) {
164 164
 			$this->done = false;
165 165
 
166 166
 			return true;
167 167
 		} else {
168
-			$this->delete_data( 'give_recount_income_total' );
169
-			$this->delete_data( 'give_temp_recount_income' );
168
+			$this->delete_data('give_recount_income_total');
169
+			$this->delete_data('give_temp_recount_income');
170 170
 			$this->done    = true;
171
-			$this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' );
171
+			$this->message = esc_html__('Income stats have been successfully recounted.', 'give');
172 172
 
173 173
 			return false;
174 174
 		}
175 175
 	}
176 176
 
177 177
 	public function headers() {
178
-		ignore_user_abort( true );
178
+		ignore_user_abort(true);
179 179
 
180
-		if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
181
-			set_time_limit( 0 );
180
+		if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
181
+			set_time_limit(0);
182 182
 		}
183 183
 	}
184 184
 
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return mixed       Returns the data from the database
208 208
 	 */
209
-	private function get_stored_data( $key ) {
209
+	private function get_stored_data($key) {
210 210
 		global $wpdb;
211
-		$value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) );
211
+		$value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key));
212 212
 
213
-		return empty( $value ) ? false : maybe_unserialize( $value );
213
+		return empty($value) ? false : maybe_unserialize($value);
214 214
 	}
215 215
 
216 216
 	/**
@@ -223,10 +223,10 @@  discard block
 block discarded – undo
223 223
 	 *
224 224
 	 * @return void
225 225
 	 */
226
-	private function store_data( $key, $value ) {
226
+	private function store_data($key, $value) {
227 227
 		global $wpdb;
228 228
 
229
-		$value = maybe_serialize( $value );
229
+		$value = maybe_serialize($value);
230 230
 
231 231
 		$data = array(
232 232
 			'option_name'  => $key,
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			'%s',
241 241
 		);
242 242
 
243
-		$wpdb->replace( $wpdb->options, $data, $formats );
243
+		$wpdb->replace($wpdb->options, $data, $formats);
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return void
254 254
 	 */
255
-	private function delete_data( $key ) {
255
+	private function delete_data($key) {
256 256
 		global $wpdb;
257
-		$wpdb->delete( $wpdb->options, array( 'option_name' => $key ) );
257
+		$wpdb->delete($wpdb->options, array('option_name' => $key));
258 258
 	}
259 259
 
260 260
 }
Please login to merge, or discard this patch.
includes/gateways/manual.php 1 patch
Spacing   +14 added lines, -14 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
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  * @since 1.0
21 21
  * @return void
22 22
  */
23
-add_action( 'give_manual_cc_form', '__return_false' );
23
+add_action('give_manual_cc_form', '__return_false');
24 24
 
25 25
 /**
26 26
  * Processes the purchase data and uses the Manual Payment gateway to record
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return void
34 34
  */
35
-function give_manual_payment( $purchase_data ) {
35
+function give_manual_payment($purchase_data) {
36 36
 
37
-	if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) {
38
-		wp_die( esc_html__( 'Nonce verification has failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
37
+	if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) {
38
+		wp_die(esc_html__('Nonce verification has failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
39 39
 	}
40 40
 	
41 41
 	//Create payment_data array
42 42
 	$payment_data = array(
43 43
 		'price'           => $purchase_data['price'],
44 44
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
45
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
45
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
46 46
 		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
47 47
 		'date'            => $purchase_data['date'],
48 48
 		'user_email'      => $purchase_data['user_email'],
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 		'status'          => 'pending'
53 53
 	);
54 54
 	// Record the pending payment
55
-	$payment = give_insert_payment( $payment_data );
55
+	$payment = give_insert_payment($payment_data);
56 56
 
57
-	if ( $payment ) {
58
-		give_update_payment_status( $payment, 'publish' );
57
+	if ($payment) {
58
+		give_update_payment_status($payment, 'publish');
59 59
 		give_send_to_success_page();
60 60
 	} else {
61 61
 		give_record_gateway_error(
62
-			esc_html__( 'Payment Error', 'give' ),
62
+			esc_html__('Payment Error', 'give'),
63 63
 			sprintf(
64 64
 				/* translators: %s: payment data */
65
-				esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ),
66
-				json_encode( $payment_data )
65
+				esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'),
66
+				json_encode($payment_data)
67 67
 			),
68 68
 			$payment
69 69
 		);
70 70
 		// If errors are present, send the user back to the purchase page so they can be corrected
71
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
71
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
72 72
 	}
73 73
 }
74 74
 
75
-add_action( 'give_gateway_manual', 'give_manual_payment' );
75
+add_action('give_gateway_manual', 'give_manual_payment');
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateways-reports-table.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 
54 54
 	}
55 55
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
68
-		switch ( $column_name ) {
67
+	public function column_default($item, $column_name) {
68
+		switch ($column_name) {
69 69
 			default:
70
-				return $item[ $column_name ];
70
+				return $item[$column_name];
71 71
 		}
72 72
 	}
73 73
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function get_columns() {
82 82
 		$columns = array(
83
-			'label'           => esc_attr__( 'Gateway', 'give' ),
84
-			'complete_sales'  => esc_attr__( 'Complete Transactions', 'give' ),
85
-			'pending_sales'   => esc_attr__( 'Pending / Failed Transactions', 'give' ),
86
-			'total_sales'     => esc_attr__( 'Total Transactions', 'give' ),
87
-			'total_donations' => esc_attr__( 'Total Donations', 'give' )
83
+			'label'           => esc_attr__('Gateway', 'give'),
84
+			'complete_sales'  => esc_attr__('Complete Transactions', 'give'),
85
+			'pending_sales'   => esc_attr__('Pending / Failed Transactions', 'give'),
86
+			'total_sales'     => esc_attr__('Total Transactions', 'give'),
87
+			'total_donations' => esc_attr__('Total Donations', 'give')
88 88
 		);
89 89
 
90 90
 		return $columns;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return int Current page number
100 100
 	 */
101 101
 	public function get_paged() {
102
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
102
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
103 103
 	}
104 104
 
105 105
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @since  1.0
111 111
 	 * @return void
112 112
 	 */
113
-	public function bulk_actions( $which = '' ) {
113
+	public function bulk_actions($which = '') {
114 114
 		// These aren't really bulk actions but this outputs the markup in the right place
115 115
 		give_report_views();
116 116
 	}
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
 	 *
124 124
 	 * @param string $which
125 125
 	 */
126
-	protected function display_tablenav( $which ) {
126
+	protected function display_tablenav($which) {
127 127
 
128
-		if ( 'top' == $which ) {
129
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
128
+		if ('top' == $which) {
129
+			wp_nonce_field('bulk-'.$this->_args['plural']);
130 130
 		}
131 131
 		?>
132
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
132
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
133 133
 
134
-			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span></h3>
134
+			<h3 class="alignleft reports-earnings-title"><span><?php esc_html_e('Donation Methods Report', 'give'); ?></span></h3>
135 135
 
136 136
 			<div class="alignright tablenav-right">
137 137
 				<div class="actions bulkactions">
138
-					<?php $this->bulk_actions( $which ); ?>
138
+					<?php $this->bulk_actions($which); ?>
139 139
 				</div>
140 140
 				<?php
141
-				$this->extra_tablenav( $which );
142
-				$this->pagination( $which );
141
+				$this->extra_tablenav($which);
142
+				$this->pagination($which);
143 143
 				?>
144 144
 			</div>
145 145
 
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
 		$gateways     = give_get_payment_gateways();
165 165
 		$stats        = new Give_Payment_Stats();
166 166
 
167
-		foreach ( $gateways as $gateway_id => $gateway ) {
167
+		foreach ($gateways as $gateway_id => $gateway) {
168 168
 
169
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
170
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
169
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
170
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
171 171
 
172 172
 			$reports_data[] = array(
173 173
 				'ID'              => $gateway_id,
174 174
 				'label'           => $gateway['admin_label'],
175
-				'complete_sales'  => give_format_amount( $complete_count, false ),
176
-				'pending_sales'   => give_format_amount( $pending_count, false ),
177
-				'total_sales'     => give_format_amount( $complete_count + $pending_count, false ),
178
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) )
175
+				'complete_sales'  => give_format_amount($complete_count, false),
176
+				'pending_sales'   => give_format_amount($pending_count, false),
177
+				'total_sales'     => give_format_amount($complete_count + $pending_count, false),
178
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id)))
179 179
 			);
180 180
 		}
181 181
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 		$columns               = $this->get_columns();
198 198
 		$hidden                = array(); // No hidden columns
199 199
 		$sortable              = $this->get_sortable_columns();
200
-		$this->_column_headers = array( $columns, $hidden, $sortable );
200
+		$this->_column_headers = array($columns, $hidden, $sortable);
201 201
 		$this->items           = $this->reports_data();
202 202
 
203 203
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/logs.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @return void
24 24
  */
25 25
 function give_logs_view_sales() {
26
-	include( dirname( __FILE__ ) . '/class-sales-logs-list-table.php' );
26
+	include(dirname(__FILE__).'/class-sales-logs-list-table.php');
27 27
 
28 28
 	$logs_table = new Give_Sales_Log_Table();
29 29
 	$logs_table->prepare_items();
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
 }
33 33
 
34
-add_action( 'give_logs_view_sales', 'give_logs_view_sales' );
34
+add_action('give_logs_view_sales', 'give_logs_view_sales');
35 35
 
36 36
 
37 37
 /**
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
  * @return void
44 44
  */
45 45
 function give_logs_view_gateway_errors() {
46
-	include( dirname( __FILE__ ) . '/class-gateway-error-logs-list-table.php' );
46
+	include(dirname(__FILE__).'/class-gateway-error-logs-list-table.php');
47 47
 
48 48
 	$logs_table = new Give_Gateway_Error_Log_Table();
49 49
 	$logs_table->prepare_items();
50 50
 	$logs_table->display();
51 51
 }
52 52
 
53
-add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' );
53
+add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors');
54 54
 
55 55
 /**
56 56
  * API Request Logs
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  * @return void
63 63
  */
64 64
 function give_logs_view_api_requests() {
65
-	include( dirname( __FILE__ ) . '/class-api-requests-logs-list-table.php' );
65
+	include(dirname(__FILE__).'/class-api-requests-logs-list-table.php');
66 66
 
67 67
 	$logs_table = new Give_API_Request_Log_Table();
68 68
 	$logs_table->prepare_items();
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 		 *
76 76
 		 * @since 1.0
77 77
 		 */
78
-		do_action( 'give_logs_api_requests_top' );
78
+		do_action('give_logs_api_requests_top');
79 79
 		?>
80 80
 
81
-		<form id="give-logs-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs' ); ?>">
81
+		<form id="give-logs-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs'); ?>">
82 82
 			<?php
83
-			$logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' );
83
+			$logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests');
84 84
 			$logs_table->display();
85 85
 			?>
86 86
 			<input type="hidden" name="post_type" value="give_forms"/>
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
 		 *
94 94
 		 * @since 1.0
95 95
 		 */
96
-		do_action( 'give_logs_api_requests_bottom' );
96
+		do_action('give_logs_api_requests_bottom');
97 97
 		?>
98 98
 
99 99
 	</div>
100 100
 	<?php
101 101
 }
102 102
 
103
-add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' );
103
+add_action('give_logs_view_api_requests', 'give_logs_view_api_requests');
104 104
 
105 105
 
106 106
 /**
@@ -111,12 +111,12 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function give_log_default_views() {
113 113
 	$views = array(
114
-		'sales'          => esc_html__( 'Donations', 'give' ),
115
-		'gateway_errors' => esc_html__( 'Payment Errors', 'give' ),
116
-		'api_requests'   => esc_html__( 'API Requests', 'give' )
114
+		'sales'          => esc_html__('Donations', 'give'),
115
+		'gateway_errors' => esc_html__('Payment Errors', 'give'),
116
+		'api_requests'   => esc_html__('API Requests', 'give')
117 117
 	);
118 118
 
119
-	$views = apply_filters( 'give_log_views', $views );
119
+	$views = apply_filters('give_log_views', $views);
120 120
 
121 121
 	return $views;
122 122
 }
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function give_log_views() {
131 131
 	$views        = give_log_default_views();
132
-	$current_view = isset( $_GET['view'] ) && array_key_exists( $_GET['view'], give_log_default_views() ) ? sanitize_text_field( $_GET['view'] ) : 'sales';
132
+	$current_view = isset($_GET['view']) && array_key_exists($_GET['view'], give_log_default_views()) ? sanitize_text_field($_GET['view']) : 'sales';
133 133
 	?>
134 134
 	<form id="give-logs-filter" method="get" action="edit.php">
135 135
 		<select id="give-logs-view" name="view">
136 136
 			<optgroup label="Log Type:">
137
-				<?php foreach ( $views as $view_id => $label ): ?>
138
-					<option value="<?php echo esc_attr( $view_id ); ?>" <?php selected( $view_id, $current_view ); ?>><?php echo $label; ?></option>
137
+				<?php foreach ($views as $view_id => $label): ?>
138
+					<option value="<?php echo esc_attr($view_id); ?>" <?php selected($view_id, $current_view); ?>><?php echo $label; ?></option>
139 139
 				<?php endforeach; ?>
140 140
 			</optgroup>
141 141
 		</select>
@@ -148,14 +148,14 @@  discard block
 block discarded – undo
148 148
 		 *
149 149
 		 * @since 1.0
150 150
 		 */
151
-		do_action( 'give_log_view_actions' );
151
+		do_action('give_log_view_actions');
152 152
 		?>
153 153
 
154 154
 		<input type="hidden" name="post_type" value="give_forms"/>
155 155
 		<input type="hidden" name="page" value="give-reports"/>
156 156
 		<input type="hidden" name="tab" value="logs"/>
157 157
 
158
-		<?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?>
158
+		<?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?>
159 159
 	</form>
160 160
 	<?php
161 161
 }
162 162
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/export/export-actions.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
27 27
 	}
28 28
 
29
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php';
29
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php';
30 30
 
31 31
 	/**
32 32
 	 * Fires before batch export.
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param atring $class Export class.
37 37
 	 */
38
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
38
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
39 39
 
40 40
 	$export = new $_REQUEST['class'];
41 41
 	$export->export();
42 42
 
43 43
 }
44 44
 
45
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
45
+add_action('give_form_batch_export', 'give_process_batch_export_form');
46 46
 
47 47
 /**
48 48
  * Exports earnings for a specified time period
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
  * @return void
54 54
  */
55 55
 function give_export_earnings() {
56
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php';
56
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php';
57 57
 
58 58
 	$earnings_export = new Give_Earnings_Export();
59 59
 
60 60
 	$earnings_export->export();
61 61
 }
62 62
 
63
-add_action( 'give_earnings_export', 'give_export_earnings' );
63
+add_action('give_earnings_export', 'give_export_earnings');
64 64
 
65 65
 
66 66
 /**
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
  * @return void
74 74
  */
75 75
 function give_export_all_customers() {
76
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php';
76
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php';
77 77
 
78 78
 	$customer_export = new Give_Donors_Export();
79 79
 
80 80
 	$customer_export->export();
81 81
 }
82 82
 
83
-add_action( 'give_email_export', 'give_export_all_customers' );
83
+add_action('give_email_export', 'give_export_all_customers');
84 84
 
85 85
 /**
86 86
  * Add a hook allowing extensions to register a hook on the batch export process
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  * @return void
90 90
  */
91 91
 function give_register_batch_exporters() {
92
-	if ( is_admin() ) {
92
+	if (is_admin()) {
93 93
 		/**
94 94
 		 * Fires in the admin, while plugins loaded.
95 95
 		 *
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
 		 *
100 100
 		 * @param string $class Export class.
101 101
 		 */
102
-		do_action( 'give_register_batch_exporter' );
102
+		do_action('give_register_batch_exporter');
103 103
 	}
104 104
 }
105 105
 
106
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
106
+add_action('plugins_loaded', 'give_register_batch_exporters');
107 107
 
108 108
 /**
109 109
  * Register the payments batch exporter
110 110
  * @since  1.5
111 111
  */
112 112
 function give_register_payments_batch_export() {
113
-	add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 );
113
+	add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1);
114 114
 }
115 115
 
116
-add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 );
116
+add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10);
117 117
 
118 118
 /**
119 119
  * Loads the payments batch process if needed
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return void
126 126
  */
127
-function give_include_payments_batch_processor( $class ) {
127
+function give_include_payments_batch_processor($class) {
128 128
 
129
-	if ( 'Give_Batch_Payments_Export' === $class ) {
130
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php';
129
+	if ('Give_Batch_Payments_Export' === $class) {
130
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php';
131 131
 	}
132 132
 
133 133
 }
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
  * @since  1.5.2
138 138
  */
139 139
 function give_register_customers_batch_export() {
140
-	add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 );
140
+	add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1);
141 141
 }
142 142
 
143
-add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 );
143
+add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10);
144 144
 
145 145
 /**
146 146
  * Loads the customers batch process if needed
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
  *
152 152
  * @return void
153 153
  */
154
-function give_include_customers_batch_processor( $class ) {
154
+function give_include_customers_batch_processor($class) {
155 155
 
156
-	if ( 'Give_Batch_Customers_Export' === $class ) {
157
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php';
156
+	if ('Give_Batch_Customers_Export' === $class) {
157
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php';
158 158
 	}
159 159
 
160 160
 }
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
  * @since  1.5
166 166
  */
167 167
 function give_register_forms_batch_export() {
168
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
168
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
169 169
 }
170 170
 
171
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
171
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
172 172
 
173 173
 /**
174 174
  * Loads the file downloads batch process if needed
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return void
181 181
  */
182
-function give_include_forms_batch_processor( $class ) {
182
+function give_include_forms_batch_processor($class) {
183 183
 
184
-	if ( 'Give_Batch_Forms_Export' === $class ) {
185
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php';
184
+	if ('Give_Batch_Forms_Export' === $class) {
185
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php';
186 186
 	}
187 187
 
188 188
 }
189 189
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/forms/metabox.php 1 patch
Spacing   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' );
17
+add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
18 18
 
19 19
 /**
20 20
  * Define the metabox and field configurations.
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array
25 25
  */
26
-function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
26
+function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
27 27
 
28 28
 	$post_id               = give_get_admin_post_id();
29
-	$price                 = give_get_form_price( $post_id );
30
-	$custom_amount_minimum = give_get_form_minimum_price( $post_id );
31
-	$goal                  = give_get_form_goal( $post_id );
32
-	$variable_pricing      = give_has_variable_prices( $post_id );
33
-	$prices                = give_get_variable_prices( $post_id );
29
+	$price                 = give_get_form_price($post_id);
30
+	$custom_amount_minimum = give_get_form_minimum_price($post_id);
31
+	$goal                  = give_get_form_goal($post_id);
32
+	$variable_pricing      = give_has_variable_prices($post_id);
33
+	$prices                = give_get_variable_prices($post_id);
34 34
 
35 35
 	//No empty prices - min. 1.00 for new forms
36
-	if ( empty( $price ) && is_null( $post_id ) ) {
37
-		$price = esc_attr( give_format_amount( '1.00' ) );
36
+	if (empty($price) && is_null($post_id)) {
37
+		$price = esc_attr(give_format_amount('1.00'));
38 38
 	}
39 39
 
40 40
 	//Min. $1.00 for new forms
41
-	if ( empty( $custom_amount_minimum ) ) {
42
-		$custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) );
41
+	if (empty($custom_amount_minimum)) {
42
+		$custom_amount_minimum = esc_attr(give_format_amount('1.00'));
43 43
 	}
44 44
 
45 45
 	// Start with an underscore to hide fields from custom fields list
@@ -48,327 +48,327 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Repeatable Field Groups
50 50
 	 */
51
-	$meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array(
51
+	$meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
52 52
 		'id'           => 'form_field_options',
53
-		'title'        => esc_html__( 'Donation Options', 'give' ),
54
-		'object_types' => array( 'give_forms' ),
53
+		'title'        => esc_html__('Donation Options', 'give'),
54
+		'object_types' => array('give_forms'),
55 55
 		'context'      => 'normal',
56 56
 		'priority'     => 'high', //Show above Content WYSIWYG
57
-		'fields'       => apply_filters( 'give_forms_donation_form_metabox_fields', array(
57
+		'fields'       => apply_filters('give_forms_donation_form_metabox_fields', array(
58 58
 				//Donation Option
59 59
 				array(
60
-					'name'        => esc_html__( 'Donation Option', 'give' ),
61
-					'description' => esc_html__( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
62
-					'id'          => $prefix . 'price_option',
60
+					'name'        => esc_html__('Donation Option', 'give'),
61
+					'description' => esc_html__('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
62
+					'id'          => $prefix.'price_option',
63 63
 					'type'        => 'radio_inline',
64 64
 					'default'     => 'set',
65
-					'options'     => apply_filters( 'give_forms_price_options', array(
66
-						'set'   => esc_html__( 'Set Donation', 'give' ),
67
-						'multi' => esc_html__( 'Multi-level Donation', 'give' ),
68
-					) ),
65
+					'options'     => apply_filters('give_forms_price_options', array(
66
+						'set'   => esc_html__('Set Donation', 'give'),
67
+						'multi' => esc_html__('Multi-level Donation', 'give'),
68
+					)),
69 69
 				),
70 70
 				array(
71
-					'name'         => esc_html__( 'Set Donation', 'give' ),
72
-					'description'  => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
73
-					'id'           => $prefix . 'set_price',
71
+					'name'         => esc_html__('Set Donation', 'give'),
72
+					'description'  => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
73
+					'id'           => $prefix.'set_price',
74 74
 					'type'         => 'text_small',
75 75
 					'row_classes'  => 'give-subfield',
76 76
 					'render_row_cb' 	=> 'give_cmb_amount_field_render_row_cb',
77 77
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
78 78
                     'attributes'   => array(
79
-						'placeholder' => give_format_decimal( '1.00' ),
80
-						'value'       => give_format_decimal( $price ),
79
+						'placeholder' => give_format_decimal('1.00'),
80
+						'value'       => give_format_decimal($price),
81 81
 						'class'       => 'cmb-type-text-small give-money-field',
82 82
 					),
83 83
 				),
84 84
 				//Donation levels: Header
85 85
 				array(
86
-					'id'   => $prefix . 'levels_header',
86
+					'id'   => $prefix.'levels_header',
87 87
 					'type' => 'levels_repeater_header',
88 88
 				),
89 89
 				//Donation Levels: Repeatable CMB2 Group
90 90
 				array(
91
-					'id'          => $prefix . 'donation_levels',
91
+					'id'          => $prefix.'donation_levels',
92 92
 					'type'        => 'group',
93 93
 					'row_classes' => 'give-subfield',
94 94
 					'options'     => array(
95
-						'add_button'    => esc_html__( 'Add Level', 'give' ),
95
+						'add_button'    => esc_html__('Add Level', 'give'),
96 96
 						'remove_button' => '<span class="dashicons dashicons-no"></span>',
97 97
 						'sortable'      => true, // beta
98 98
 					),
99 99
 					// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
100
-					'fields'      => apply_filters( 'give_donation_levels_table_row', array(
100
+					'fields'      => apply_filters('give_donation_levels_table_row', array(
101 101
 						array(
102
-							'name' => esc_html__( 'ID', 'give' ),
103
-							'id'   => $prefix . 'id',
102
+							'name' => esc_html__('ID', 'give'),
103
+							'id'   => $prefix.'id',
104 104
 							'type' => 'levels_id',
105 105
 						),
106 106
 						array(
107
-							'name'              => esc_html__( 'Amount', 'give' ),
108
-							'id'                => $prefix . 'amount',
107
+							'name'              => esc_html__('Amount', 'give'),
108
+							'id'                => $prefix.'amount',
109 109
 							'type'              => 'text_small',
110
-							'before_field'      => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
111
-							'after_field'       => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
110
+							'before_field'      => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
111
+							'after_field'       => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
112 112
 							'sanitization_cb'   => 'give_sanitize_price_field_value',
113 113
                             'attributes'        => array(
114
-								'placeholder' => give_format_decimal( '1.00' ),
114
+								'placeholder' => give_format_decimal('1.00'),
115 115
 								'class'       => 'cmb-type-text-small give-money-field',
116 116
 							),
117 117
 							'before'       => 'give_format_admin_multilevel_amount',
118 118
 						),
119 119
 						array(
120
-							'name'       => esc_html__( 'Text', 'give' ),
121
-							'id'         => $prefix . 'text',
120
+							'name'       => esc_html__('Text', 'give'),
121
+							'id'         => $prefix.'text',
122 122
 							'type'       => 'text',
123 123
 							'attributes' => array(
124
-								'placeholder' => esc_html__( 'Donation Level', 'give' ),
124
+								'placeholder' => esc_html__('Donation Level', 'give'),
125 125
 								'class'       => 'give-multilevel-text-field',
126 126
 							),
127 127
 						),
128 128
 						array(
129
-							'name' => esc_html__( 'Default', 'give' ),
130
-							'id'   => $prefix . 'default',
129
+							'name' => esc_html__('Default', 'give'),
130
+							'id'   => $prefix.'default',
131 131
 							'type' => 'give_default_radio_inline'
132 132
 						),
133
-					) ),
133
+					)),
134 134
 				),
135 135
 				//Display Style
136 136
 				array(
137
-					'name'        => esc_html__( 'Display Style', 'give' ),
138
-					'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
139
-					'id'          => $prefix . 'display_style',
137
+					'name'        => esc_html__('Display Style', 'give'),
138
+					'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
139
+					'id'          => $prefix.'display_style',
140 140
 					'type'        => 'radio_inline',
141 141
 					'default'     => 'buttons',
142 142
 					'options'     => array(
143
-						'buttons'  => esc_html__( 'Buttons', 'give' ),
144
-						'radios'   => esc_html__( 'Radios', 'give' ),
145
-						'dropdown' => esc_html__( 'Dropdown', 'give' ),
143
+						'buttons'  => esc_html__('Buttons', 'give'),
144
+						'radios'   => esc_html__('Radios', 'give'),
145
+						'dropdown' => esc_html__('Dropdown', 'give'),
146 146
 					),
147 147
 				),
148 148
 				//Custom Amount
149 149
 				array(
150
-					'name'        => esc_html__( 'Custom Amount', 'give' ),
151
-					'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
152
-					'id'          => $prefix . 'custom_amount',
150
+					'name'        => esc_html__('Custom Amount', 'give'),
151
+					'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
152
+					'id'          => $prefix.'custom_amount',
153 153
 					'type'        => 'radio_inline',
154 154
 					'default'     => 'no',
155 155
 					'options'     => array(
156
-						'yes' => esc_html__( 'Yes', 'give' ),
157
-						'no'  => esc_html__( 'No', 'give' ),
156
+						'yes' => esc_html__('Yes', 'give'),
157
+						'no'  => esc_html__('No', 'give'),
158 158
 					),
159 159
 				),
160 160
 				array(
161
-					'name'              => esc_html__( 'Custom Amount Minimum', 'give' ),
162
-					'description'       => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ),
163
-					'id'                => $prefix . 'custom_amount_minimum',
161
+					'name'              => esc_html__('Custom Amount Minimum', 'give'),
162
+					'description'       => esc_html__('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
163
+					'id'                => $prefix.'custom_amount_minimum',
164 164
 					'type'              => 'text_small',
165 165
 					'row_classes'       => 'give-subfield',
166 166
 					'render_row_cb'     => 'give_cmb_amount_field_render_row_cb',
167 167
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
168 168
 					'attributes'   => array(
169 169
 						'placeholder' => give_format_decimal('1.00'),
170
-						'value'       => give_format_decimal( $custom_amount_minimum ),
170
+						'value'       => give_format_decimal($custom_amount_minimum),
171 171
 						'class'       => 'cmb-type-text-small give-money-field',
172 172
 					)
173 173
 				),
174 174
 				array(
175
-					'name'        => esc_html__( 'Custom Amount Text', 'give' ),
176
-					'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
177
-					'id'          => $prefix . 'custom_amount_text',
175
+					'name'        => esc_html__('Custom Amount Text', 'give'),
176
+					'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
177
+					'id'          => $prefix.'custom_amount_text',
178 178
 					'type'        => 'text',
179 179
 					'row_classes' => 'give-subfield',
180 180
 					'attributes'  => array(
181 181
 						'rows'        => 3,
182
-						'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
182
+						'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
183 183
 					),
184 184
 				),
185 185
 				//Goals
186 186
 				array(
187
-					'name'        => esc_html__( 'Goal', 'give' ),
188
-					'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
189
-					'id'          => $prefix . 'goal_option',
187
+					'name'        => esc_html__('Goal', 'give'),
188
+					'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
189
+					'id'          => $prefix.'goal_option',
190 190
 					'type'        => 'radio_inline',
191 191
 					'default'     => 'no',
192 192
 					'options'     => array(
193
-						'yes' => esc_html__( 'Yes', 'give' ),
194
-						'no'  => esc_html__( 'No', 'give' ),
193
+						'yes' => esc_html__('Yes', 'give'),
194
+						'no'  => esc_html__('No', 'give'),
195 195
 					),
196 196
 				),
197 197
 				array(
198
-					'name'              => esc_html__( 'Goal Amount', 'give' ),
199
-					'description'       => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ),
200
-					'id'                => $prefix . 'set_goal',
198
+					'name'              => esc_html__('Goal Amount', 'give'),
199
+					'description'       => esc_html__('This is the monetary goal amount you want to reach for this donation form.', 'give'),
200
+					'id'                => $prefix.'set_goal',
201 201
 					'type'              => 'text_small',
202 202
 					'row_classes'       => 'give-subfield',
203 203
 					'render_row_cb' 	=> 'give_cmb_amount_field_render_row_cb',
204 204
 					'sanitization_cb'   => 'give_sanitize_price_field_value',
205 205
 					'attributes'        => array(
206
-						'placeholder' => give_format_decimal( '0.00' ),
207
-						'value'       => give_format_decimal( $goal ),
206
+						'placeholder' => give_format_decimal('0.00'),
207
+						'value'       => give_format_decimal($goal),
208 208
 						'class'       => 'cmb-type-text-small give-money-field',
209 209
 					),
210 210
 				),
211 211
 
212 212
 				array(
213
-					'name'        => esc_html__( 'Goal Format', 'give' ),
214
-					'description' => esc_html__( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
215
-					'id'          => $prefix . 'goal_format',
213
+					'name'        => esc_html__('Goal Format', 'give'),
214
+					'description' => esc_html__('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
215
+					'id'          => $prefix.'goal_format',
216 216
 					'type'        => 'radio_inline',
217 217
 					'default'     => 'amount',
218 218
 					'row_classes' => 'give-subfield',
219 219
 					'options'     => array(
220
-						'amount'     => esc_html__( 'Amount', 'give' ),
221
-						'percentage' => esc_html__( 'Percentage', 'give' ),
220
+						'amount'     => esc_html__('Amount', 'give'),
221
+						'percentage' => esc_html__('Percentage', 'give'),
222 222
 					),
223 223
 				),
224 224
 				array(
225
-					'name'        => esc_html__( 'Goal Progress Bar Color', 'give' ),
226
-					'id'          => $prefix . 'goal_color',
225
+					'name'        => esc_html__('Goal Progress Bar Color', 'give'),
226
+					'id'          => $prefix.'goal_color',
227 227
 					'type'        => 'colorpicker',
228 228
 					'row_classes' => 'give-subfield',
229 229
 					'default'     => '#2bc253',
230 230
 				),
231 231
 
232 232
 				array(
233
-					'name'        => esc_html__( 'Close Form when Goal Achieved', 'give' ),
234
-					'desc'        => esc_html__( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
235
-					'id'          => $prefix . 'close_form_when_goal_achieved',
233
+					'name'        => esc_html__('Close Form when Goal Achieved', 'give'),
234
+					'desc'        => esc_html__('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
235
+					'id'          => $prefix.'close_form_when_goal_achieved',
236 236
 					'type'        => 'radio_inline',
237 237
 					'row_classes' => 'give-subfield',
238 238
 					'options'     => array(
239
-						'yes' => esc_html__( 'Yes', 'give' ),
240
-						'no'  => esc_html__( 'No', 'give' ),
239
+						'yes' => esc_html__('Yes', 'give'),
240
+						'no'  => esc_html__('No', 'give'),
241 241
 					),
242 242
 					'default'     => 'no',
243 243
 				),
244 244
 				array(
245
-					'name'        => esc_html__( 'Goal Achieved Message', 'give' ),
246
-					'desc'        => esc_html__( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
247
-					'id'          => $prefix . 'form_goal_achieved_message',
245
+					'name'        => esc_html__('Goal Achieved Message', 'give'),
246
+					'desc'        => esc_html__('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
247
+					'id'          => $prefix.'form_goal_achieved_message',
248 248
 					'type'        => 'textarea',
249 249
 					'row_classes' => 'give-subfield',
250 250
 					'attributes'  => array(
251
-						'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
251
+						'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'),
252 252
 					),
253 253
 				)
254 254
 			)
255 255
 		)
256
-	) );
256
+	));
257 257
 
258 258
 
259 259
 	/**
260 260
 	 * Content Field
261 261
 	 */
262
-	$meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array(
262
+	$meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
263 263
 		'id'           => 'form_content_options',
264
-		'title'        => esc_html__( 'Form Content', 'give' ),
265
-		'object_types' => array( 'give_forms' ),
264
+		'title'        => esc_html__('Form Content', 'give'),
265
+		'object_types' => array('give_forms'),
266 266
 		'context'      => 'normal',
267 267
 		'priority'     => 'high', //Show above Content WYSIWYG
268
-		'fields'       => apply_filters( 'give_forms_content_options_metabox_fields', array(
268
+		'fields'       => apply_filters('give_forms_content_options_metabox_fields', array(
269 269
 				//Donation Option
270 270
 				array(
271
-					'name'        => esc_html__( 'Display Content', 'give' ),
272
-					'description' => esc_html__( 'Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give' ),
273
-					'id'          => $prefix . 'content_option',
271
+					'name'        => esc_html__('Display Content', 'give'),
272
+					'description' => esc_html__('Do you want to display content? If you choose to display content, a WYSIWYG editor will appear which you will be able to enter content.', 'give'),
273
+					'id'          => $prefix.'content_option',
274 274
 					'type'        => 'select',
275
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
276
-							'none'           => esc_html__( 'No Content', 'give' ),
277
-							'give_pre_form'  => esc_html__( 'Display content ABOVE the fields', 'give' ),
278
-							'give_post_form' => esc_html__( 'Display content BELOW the fields', 'give' ),
275
+					'options'     => apply_filters('give_forms_content_options_select', array(
276
+							'none'           => esc_html__('No Content', 'give'),
277
+							'give_pre_form'  => esc_html__('Display content ABOVE the fields', 'give'),
278
+							'give_post_form' => esc_html__('Display content BELOW the fields', 'give'),
279 279
 						)
280 280
 					),
281 281
 					'default'     => 'none',
282 282
 				),
283 283
 				array(
284
-					'name'        => esc_html__( 'Content', 'give' ),
285
-					'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
286
-					'id'          => $prefix . 'form_content',
284
+					'name'        => esc_html__('Content', 'give'),
285
+					'description' => esc_html__('This content will display on the single give form page.', 'give'),
286
+					'id'          => $prefix.'form_content',
287 287
 					'row_classes' => 'give-subfield',
288 288
 					'type'        => 'wysiwyg'
289 289
 				),
290 290
 			)
291 291
 		)
292
-	) );
292
+	));
293 293
 
294 294
 
295 295
 	/**
296 296
 	 * Display Options
297 297
 	 */
298
-	$meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array(
298
+	$meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
299 299
 			'id'           => 'form_display_options',
300
-			'title'        => esc_html__( 'Form Display Options', 'give' ),
301
-			'object_types' => array( 'give_forms' ),
300
+			'title'        => esc_html__('Form Display Options', 'give'),
301
+			'object_types' => array('give_forms'),
302 302
 			'context'      => 'normal', //  'normal', 'advanced', or 'side'
303 303
 			'priority'     => 'high', //Show above Content WYSIWYG
304 304
 			'show_names'   => true, // Show field names on the left
305
-			'fields'       => apply_filters( 'give_forms_display_options_metabox_fields', array(
305
+			'fields'       => apply_filters('give_forms_display_options_metabox_fields', array(
306 306
 					array(
307
-						'name'    => esc_html__( 'Payment Fields', 'give' ),
308
-						'desc'    => esc_html__( 'How would you like to display donation information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ),
309
-						'id'      => $prefix . 'payment_display',
307
+						'name'    => esc_html__('Payment Fields', 'give'),
308
+						'desc'    => esc_html__('How would you like to display donation information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
309
+						'id'      => $prefix.'payment_display',
310 310
 						'type'    => 'select',
311 311
 						'options' => array(
312
-							'onpage' => esc_html__( 'Show on Page', 'give' ),
313
-							'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
314
-							'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
312
+							'onpage' => esc_html__('Show on Page', 'give'),
313
+							'reveal' => esc_html__('Reveal Upon Click', 'give'),
314
+							'modal'  => esc_html__('Modal Window Upon Click', 'give'),
315 315
 						),
316 316
 						'default' => 'onpage',
317 317
 					),
318 318
 					array(
319
-						'id'          => $prefix . 'reveal_label',
320
-						'name'        => esc_html__( 'Reveal / Modal Open Text', 'give' ),
321
-						'desc'        => esc_html__( 'The button label for completing the donation.', 'give' ),
319
+						'id'          => $prefix.'reveal_label',
320
+						'name'        => esc_html__('Reveal / Modal Open Text', 'give'),
321
+						'desc'        => esc_html__('The button label for completing the donation.', 'give'),
322 322
 						'type'        => 'text_small',
323 323
 						'row_classes' => 'give-subfield',
324 324
 						'attributes'  => array(
325
-							'placeholder' => esc_attr__( 'Donate Now', 'give' ),
325
+							'placeholder' => esc_attr__('Donate Now', 'give'),
326 326
 						),
327 327
 					),
328 328
 					array(
329
-						'id'         => $prefix . 'checkout_label',
330
-						'name'       => esc_html__( 'Complete Donation Text', 'give' ),
331
-						'desc'       => esc_html__( 'The button label for completing a donation.', 'give' ),
329
+						'id'         => $prefix.'checkout_label',
330
+						'name'       => esc_html__('Complete Donation Text', 'give'),
331
+						'desc'       => esc_html__('The button label for completing a donation.', 'give'),
332 332
 						'type'       => 'text_small',
333 333
 						'attributes' => array(
334
-							'placeholder' => esc_html__( 'Donate Now', 'give' ),
334
+							'placeholder' => esc_html__('Donate Now', 'give'),
335 335
 						),
336 336
 					),
337 337
 					array(
338
-						'name' => esc_html__( 'Default Gateway', 'give' ),
339
-						'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
340
-						'id'   => $prefix . 'default_gateway',
338
+						'name' => esc_html__('Default Gateway', 'give'),
339
+						'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
340
+						'id'   => $prefix.'default_gateway',
341 341
 						'type' => 'default_gateway'
342 342
 					),
343 343
 					array(
344
-						'name' => esc_html__( 'Disable Guest Donations', 'give' ),
345
-						'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ),
346
-						'id'   => $prefix . 'logged_in_only',
344
+						'name' => esc_html__('Disable Guest Donations', 'give'),
345
+						'desc' => esc_html__('Do you want to require users be logged-in to make donations?', 'give'),
346
+						'id'   => $prefix.'logged_in_only',
347 347
 						'type' => 'checkbox'
348 348
 					),
349 349
 					array(
350
-						'name'    => esc_html__( 'Register / Login Form', 'give' ),
351
-						'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
352
-						'id'      => $prefix . 'show_register_form',
350
+						'name'    => esc_html__('Register / Login Form', 'give'),
351
+						'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
352
+						'id'      => $prefix.'show_register_form',
353 353
 						'type'    => 'select',
354 354
 						'options' => array(
355
-							'both'         => esc_html__( 'Registration and Login Forms', 'give' ),
356
-							'registration' => esc_html__( 'Registration Form Only', 'give' ),
357
-							'login'        => esc_html__( 'Login Form Only', 'give' ),
358
-							'none'         => esc_html__( 'None', 'give' ),
355
+							'both'         => esc_html__('Registration and Login Forms', 'give'),
356
+							'registration' => esc_html__('Registration Form Only', 'give'),
357
+							'login'        => esc_html__('Login Form Only', 'give'),
358
+							'none'         => esc_html__('None', 'give'),
359 359
 						),
360 360
 						'default' => 'none',
361 361
 					),
362 362
 					array(
363
-						'name'    => esc_html__( 'Floating Labels', 'give' ),
363
+						'name'    => esc_html__('Floating Labels', 'give'),
364 364
 						/* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
365
-						'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
366
-						'id'      => $prefix . 'form_floating_labels',
365
+						'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
366
+						'id'      => $prefix.'form_floating_labels',
367 367
 						'type'    => 'select',
368 368
 						'options' => array(
369
-							''         => esc_html__( 'Use the global setting', 'give' ),
370
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
371
-							'disabled' => esc_html__( 'Disabled', 'give' ),
369
+							''         => esc_html__('Use the global setting', 'give'),
370
+							'enabled'  => esc_html__('Enabled', 'give'),
371
+							'disabled' => esc_html__('Disabled', 'give'),
372 372
 						),
373 373
 						'default' => 'none',
374 374
 					)
@@ -380,47 +380,47 @@  discard block
 block discarded – undo
380 380
 	/**
381 381
 	 * Terms & Conditions
382 382
 	 */
383
-	$meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array(
383
+	$meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
384 384
 		'id'           => 'form_terms_options',
385
-		'title'        => esc_html__( 'Terms and Conditions', 'give' ),
386
-		'object_types' => array( 'give_forms' ),
385
+		'title'        => esc_html__('Terms and Conditions', 'give'),
386
+		'object_types' => array('give_forms'),
387 387
 		'context'      => 'normal',
388 388
 		'priority'     => 'high', //Show above Content WYSIWYG
389
-		'fields'       => apply_filters( 'give_forms_terms_options_metabox_fields', array(
389
+		'fields'       => apply_filters('give_forms_terms_options_metabox_fields', array(
390 390
 				//Donation Option
391 391
 				array(
392
-					'name'        => esc_html__( 'Terms and Conditions', 'give' ),
393
-					'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ),
394
-					'id'          => $prefix . 'terms_option',
392
+					'name'        => esc_html__('Terms and Conditions', 'give'),
393
+					'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
394
+					'id'          => $prefix.'terms_option',
395 395
 					'type'        => 'select',
396
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
397
-							'none' => esc_html__( 'No', 'give' ),
398
-							'yes'  => esc_html__( 'Yes', 'give' ),
396
+					'options'     => apply_filters('give_forms_content_options_select', array(
397
+							'none' => esc_html__('No', 'give'),
398
+							'yes'  => esc_html__('Yes', 'give'),
399 399
 						)
400 400
 					),
401 401
 					'default'     => 'none',
402 402
 				),
403 403
 				array(
404
-					'id'          => $prefix . 'agree_label',
405
-					'name'        => esc_html__( 'Agree to Terms Label', 'give' ),
406
-					'desc'        => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
404
+					'id'          => $prefix.'agree_label',
405
+					'name'        => esc_html__('Agree to Terms Label', 'give'),
406
+					'desc'        => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
407 407
 					'type'        => 'text',
408 408
 					'row_classes' => 'give-subfield',
409 409
 					'size'        => 'regular',
410 410
 					'attributes'  => array(
411
-						'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
411
+						'placeholder' => esc_attr__('Agree to Terms?', 'give'),
412 412
 					),
413 413
 				),
414 414
 				array(
415
-					'id'          => $prefix . 'agree_text',
415
+					'id'          => $prefix.'agree_text',
416 416
 					'row_classes' => 'give-subfield',
417
-					'name'        => esc_html__( 'Agreement Text', 'give' ),
418
-					'desc'        => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
417
+					'name'        => esc_html__('Agreement Text', 'give'),
418
+					'desc'        => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
419 419
 					'type'        => 'wysiwyg'
420 420
 				),
421 421
 			)
422 422
 		)
423
-	) );
423
+	));
424 424
 
425 425
 	return $meta_boxes;
426 426
 
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
 
435 435
 	<div class="table-container">
436 436
 		<div class="table-row">
437
-			<div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div>
438
-			<div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div>
439
-			<div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div>
437
+			<div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div>
438
+			<div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div>
439
+			<div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div>
440 440
 			<?php
441 441
 			/**
442 442
 			 * Fires in repeatable donation levels table head.
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
 			 *
449 449
 			 * @since 1.0
450 450
 			 */
451
-			do_action( 'give_donation_levels_table_head' );
451
+			do_action('give_donation_levels_table_head');
452 452
 			?>
453
-			<div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div>
453
+			<div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div>
454 454
 
455 455
 		</div>
456 456
 	</div>
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	<?php
459 459
 }
460 460
 
461
-add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 );
461
+add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
462 462
 
463 463
 
464 464
 /**
@@ -475,25 +475,25 @@  discard block
 block discarded – undo
475 475
  * @param $object_type
476 476
  * @param $field_type_object
477 477
  */
478
-function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
478
+function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
479 479
 
480
-	$escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' );
480
+	$escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : '');
481 481
 
482 482
 	$field_options_array = array(
483 483
 		'class' => 'give-hidden give-level-id-input',
484
-		'name'  => $field_type_object->_name( '[level_id]' ),
485
-		'id'    => $field_type_object->_id( '_level_id' ),
484
+		'name'  => $field_type_object->_name('[level_id]'),
485
+		'id'    => $field_type_object->_id('_level_id'),
486 486
 		'value' => $escaped_value,
487 487
 		'type'  => 'number',
488 488
 		'desc'  => '',
489 489
 	);
490 490
 
491
-	echo '<p class="give-level-id">' . $escaped_value . '</p>';
492
-	echo $field_type_object->input( $field_options_array );
491
+	echo '<p class="give-level-id">'.$escaped_value.'</p>';
492
+	echo $field_type_object->input($field_options_array);
493 493
 
494 494
 }
495 495
 
496
-add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 );
496
+add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
497 497
 
498 498
 
499 499
 /**
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
  * @param $object_type
506 506
  * @param $field_type_object
507 507
  */
508
-function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
509
-	echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>';
510
-	echo '<label for="' . $field_object->args['id'] . '">' . esc_html__( 'Default', 'give' ) . '</label>';
508
+function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
509
+	echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
510
+	echo '<label for="'.$field_object->args['id'].'">'.esc_html__('Default', 'give').'</label>';
511 511
 
512 512
 }
513 513
 
514
-add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 );
514
+add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
515 515
 
516 516
 
517 517
 /**
@@ -521,20 +521,20 @@  discard block
 block discarded – undo
521 521
  */
522 522
 function give_add_shortcode_to_publish_metabox() {
523 523
 
524
-	if ( 'give_forms' !== get_post_type() ) {
524
+	if ('give_forms' !== get_post_type()) {
525 525
 		return false;
526 526
 	}
527 527
 
528 528
 	global $post;
529 529
 
530 530
 	//Only enqueue scripts for CPT on post type screen
531
-	if ( 'give_forms' === $post->post_type ) {
531
+	if ('give_forms' === $post->post_type) {
532 532
 		//Shortcode column with select all input
533
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
534
-		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
533
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
534
+		echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
535 535
 
536 536
 	}
537 537
 
538 538
 }
539 539
 
540
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
540
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
includes/class-give-db.php 1 patch
Spacing   +39 added lines, -39 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
 
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return object
100 100
 	 */
101
-	public function get( $row_id ) {
101
+	public function get($row_id) {
102 102
 		/* @var WPDB $wpdb */
103 103
 		global $wpdb;
104 104
 
105
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
105
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
106 106
 	}
107 107
 
108 108
 	/**
@@ -116,12 +116,12 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @return object
118 118
 	 */
119
-	public function get_by( $column, $row_id ) {
119
+	public function get_by($column, $row_id) {
120 120
         /* @var WPDB $wpdb */
121 121
         global $wpdb;
122 122
 
123
-		$column = esc_sql( $column );
124
-		return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id ) );
123
+		$column = esc_sql($column);
124
+		return $wpdb->get_row($wpdb->prepare("SELECT * FROM $this->table_name WHERE $column = %s LIMIT 1;", $row_id));
125 125
 	}
126 126
 
127 127
 	/**
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
      *
136 136
 	 * @return string      Column value.
137 137
 	 */
138
-	public function get_column( $column, $row_id ) {
138
+	public function get_column($column, $row_id) {
139 139
         /* @var WPDB $wpdb */
140 140
         global $wpdb;
141 141
 
142
-		$column = esc_sql( $column );
143
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id ) );
142
+		$column = esc_sql($column);
143
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $this->primary_key = %s LIMIT 1;", $row_id));
144 144
 	}
145 145
 
146 146
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
      *
156 156
 	 * @return string
157 157
 	 */
158
-	public function get_column_by( $column, $column_where, $column_value ) {
158
+	public function get_column_by($column, $column_where, $column_value) {
159 159
         /* @var WPDB $wpdb */
160 160
         global $wpdb;
161 161
 
162
-		$column_where = esc_sql( $column_where );
163
-		$column       = esc_sql( $column );
164
-		return $wpdb->get_var( $wpdb->prepare( "SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value ) );
162
+		$column_where = esc_sql($column_where);
163
+		$column       = esc_sql($column);
164
+		return $wpdb->get_var($wpdb->prepare("SELECT $column FROM $this->table_name WHERE $column_where = %s LIMIT 1;", $column_value));
165 165
 	}
166 166
 
167 167
 	/**
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
      *
176 176
 	 * @return int
177 177
 	 */
178
-	public function insert( $data, $type = '' ) {
178
+	public function insert($data, $type = '') {
179 179
         /* @var WPDB $wpdb */
180 180
         global $wpdb;
181 181
 
182 182
 		// Set default values.
183
-		$data = wp_parse_args( $data, $this->get_column_defaults() );
183
+		$data = wp_parse_args($data, $this->get_column_defaults());
184 184
 
185 185
 		/**
186 186
 		 * Fires before inserting data to the database.
@@ -189,22 +189,22 @@  discard block
 block discarded – undo
189 189
 		 *
190 190
 		 * @param array $data
191 191
 		 */
192
-		do_action( "give_pre_insert_{$type}", $data );
192
+		do_action("give_pre_insert_{$type}", $data);
193 193
 
194 194
 		// Initialise column format array
195 195
 		$column_formats = $this->get_columns();
196 196
 
197 197
 		// Force fields to lower case
198
-		$data = array_change_key_case( $data );
198
+		$data = array_change_key_case($data);
199 199
 
200 200
 		// White list columns
201
-		$data = array_intersect_key( $data, $column_formats );
201
+		$data = array_intersect_key($data, $column_formats);
202 202
 
203 203
 		// Reorder $column_formats to match the order of columns given in $data
204
-		$data_keys      = array_keys( $data );
205
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
204
+		$data_keys      = array_keys($data);
205
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
206 206
 
207
-		$wpdb->insert( $this->table_name, $data, $column_formats );
207
+		$wpdb->insert($this->table_name, $data, $column_formats);
208 208
 
209 209
 		/**
210 210
 		 * Fires after inserting data to the database.
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		 * @param int   $insert_id
215 215
 		 * @param array $data
216 216
 		 */
217
-		do_action( "give_post_insert_{$type}", $wpdb->insert_id, $data );
217
+		do_action("give_post_insert_{$type}", $wpdb->insert_id, $data);
218 218
 
219 219
 		return $wpdb->insert_id;
220 220
 	}
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
      *
232 232
 	 * @return bool
233 233
 	 */
234
-	public function update( $row_id, $data = array(), $where = '' ) {
234
+	public function update($row_id, $data = array(), $where = '') {
235 235
         /* @var WPDB $wpdb */
236 236
         global $wpdb;
237 237
 
238 238
 		// Row ID must be positive integer
239
-		$row_id = absint( $row_id );
239
+		$row_id = absint($row_id);
240 240
 
241
-		if ( empty( $row_id ) ) {
241
+		if (empty($row_id)) {
242 242
 			return false;
243 243
 		}
244 244
 
245
-		if ( empty( $where ) ) {
245
+		if (empty($where)) {
246 246
 			$where = $this->primary_key;
247 247
 		}
248 248
 
@@ -250,16 +250,16 @@  discard block
 block discarded – undo
250 250
 		$column_formats = $this->get_columns();
251 251
 
252 252
 		// Force fields to lower case
253
-		$data = array_change_key_case( $data );
253
+		$data = array_change_key_case($data);
254 254
 
255 255
 		// White list columns
256
-		$data = array_intersect_key( $data, $column_formats );
256
+		$data = array_intersect_key($data, $column_formats);
257 257
 
258 258
 		// Reorder $column_formats to match the order of columns given in $data
259
-		$data_keys      = array_keys( $data );
260
-		$column_formats = array_merge( array_flip( $data_keys ), $column_formats );
259
+		$data_keys      = array_keys($data);
260
+		$column_formats = array_merge(array_flip($data_keys), $column_formats);
261 261
 
262
-		if ( false === $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats ) ) {
262
+		if (false === $wpdb->update($this->table_name, $data, array($where => $row_id), $column_formats)) {
263 263
 			return false;
264 264
 		}
265 265
 
@@ -276,18 +276,18 @@  discard block
 block discarded – undo
276 276
      *
277 277
 	 * @return bool
278 278
 	 */
279
-	public function delete( $row_id = 0 ) {
279
+	public function delete($row_id = 0) {
280 280
         /* @var WPDB $wpdb */
281 281
         global $wpdb;
282 282
 
283 283
 		// Row ID must be positive integer
284
-		$row_id = absint( $row_id );
284
+		$row_id = absint($row_id);
285 285
 
286
-		if ( empty( $row_id ) ) {
286
+		if (empty($row_id)) {
287 287
 			return false;
288 288
 		}
289 289
 
290
-		if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) {
290
+		if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id))) {
291 291
 			return false;
292 292
 		}
293 293
 
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
      *
305 305
 	 * @return bool          If the table name exists.
306 306
 	 */
307
-	public function table_exists( $table ) {
307
+	public function table_exists($table) {
308 308
         /* @var WPDB $wpdb */
309 309
 		global $wpdb;
310 310
 
311
-		$table = sanitize_text_field( $table );
311
+		$table = sanitize_text_field($table);
312 312
 
313
-		return $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE '%s'", $table ) ) === $table;
313
+		return $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE '%s'", $table)) === $table;
314 314
 	}
315 315
 
316 316
 	/**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @return bool Returns if the customers table was installed and upgrade routine run.
323 323
 	 */
324 324
 	public function installed() {
325
-		return $this->table_exists( $this->table_name );
325
+		return $this->table_exists($this->table_name);
326 326
 	}
327 327
 
328 328
 }
Please login to merge, or discard this patch.
includes/emails/class-give-emails.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function __construct() {
81 81
 
82
-		if ( 'none' === $this->get_template() ) {
82
+		if ('none' === $this->get_template()) {
83 83
 			$this->html = false;
84 84
 		}
85 85
 
86
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
87
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
86
+		add_action('give_email_send_before', array($this, 'send_before'));
87
+		add_action('give_email_send_after', array($this, 'send_after'));
88 88
 
89 89
 	}
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @since 1.0
95 95
 	 */
96
-	public function __set( $key, $value ) {
96
+	public function __set($key, $value) {
97 97
 		$this->$key = $value;
98 98
 	}
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @since 1.0
104 104
 	 */
105 105
 	public function get_from_name() {
106
-		if ( ! $this->from_name ) {
107
-			$this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) );
106
+		if ( ! $this->from_name) {
107
+			$this->from_name = give_get_option('from_name', get_bloginfo('name'));
108 108
 		}
109 109
 
110
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
110
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
111 111
 	}
112 112
 
113 113
 	/**
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 	 * @since 1.0
117 117
 	 */
118 118
 	public function get_from_address() {
119
-		if ( ! $this->from_address ) {
120
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
119
+		if ( ! $this->from_address) {
120
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
121 121
 		}
122 122
 
123
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
123
+		return apply_filters('give_email_from_address', $this->from_address, $this);
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.0
130 130
 	 */
131 131
 	public function get_content_type() {
132
-		if ( ! $this->content_type && $this->html ) {
133
-			$this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this );
134
-		} else if ( ! $this->html ) {
132
+		if ( ! $this->content_type && $this->html) {
133
+			$this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this);
134
+		} else if ( ! $this->html) {
135 135
 			$this->content_type = 'text/plain';
136 136
 		}
137 137
 
138
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
138
+		return apply_filters('give_email_content_type', $this->content_type, $this);
139 139
 	}
140 140
 
141 141
 	/**
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 	 * @since 1.0
145 145
 	 */
146 146
 	public function get_headers() {
147
-		if ( ! $this->headers ) {
147
+		if ( ! $this->headers) {
148 148
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
149 149
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
150 150
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
151 151
 		}
152 152
 
153
-		return apply_filters( 'give_email_headers', $this->headers, $this );
153
+		return apply_filters('give_email_headers', $this->headers, $this);
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_templates() {
162 162
 		$templates = array(
163
-			'default' => esc_html__( 'Default Template', 'give' ),
164
-			'none'    => esc_html__( 'No template, plain text only', 'give' )
163
+			'default' => esc_html__('Default Template', 'give'),
164
+			'none'    => esc_html__('No template, plain text only', 'give')
165 165
 		);
166 166
 
167
-		return apply_filters( 'give_email_templates', $templates );
167
+		return apply_filters('give_email_templates', $templates);
168 168
 	}
169 169
 
170 170
 	/**
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 	 * @since 1.0
174 174
 	 */
175 175
 	public function get_template() {
176
-		if ( ! $this->template ) {
177
-			$this->template = give_get_option( 'email_template', 'default' );
176
+		if ( ! $this->template) {
177
+			$this->template = give_get_option('email_template', 'default');
178 178
 		}
179 179
 
180
-		return apply_filters( 'give_email_template', $this->template );
180
+		return apply_filters('give_email_template', $this->template);
181 181
 	}
182 182
 
183 183
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @since 1.0
187 187
 	 */
188 188
 	public function get_heading() {
189
-		return apply_filters( 'give_email_heading', $this->heading );
189
+		return apply_filters('give_email_heading', $this->heading);
190 190
 	}
191 191
 
192 192
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return mixed
198 198
 	 */
199
-	public function parse_tags( $content ) {
199
+	public function parse_tags($content) {
200 200
 		return $content;
201 201
 	}
202 202
 
@@ -205,19 +205,19 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @since 1.0
207 207
 	 */
208
-	public function build_email( $message ) {
208
+	public function build_email($message) {
209 209
 
210
-		if ( false === $this->html ) {
211
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
210
+		if (false === $this->html) {
211
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
212 212
 		}
213 213
 
214
-		$message = $this->text_to_html( $message );
214
+		$message = $this->text_to_html($message);
215 215
 
216 216
 		$template = $this->get_template();
217 217
 
218 218
 		ob_start();
219 219
 
220
-		give_get_template_part( 'emails/header', $template, true );
220
+		give_get_template_part('emails/header', $template, true);
221 221
 
222 222
 		/**
223 223
 		 * Fires in the email head.
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 		 *
227 227
 		 * @param Give_Emails $this The email object.
228 228
 		 */
229
-		do_action( 'give_email_header', $this );
229
+		do_action('give_email_header', $this);
230 230
 
231
-		if ( has_action( 'give_email_template_' . $template ) ) {
231
+		if (has_action('give_email_template_'.$template)) {
232 232
 			/**
233 233
 			 * Fires in a specific email template.
234 234
 			 *
235 235
 			 * @since 1.0
236 236
 			 */
237
-			do_action( "give_email_template_{$template}" );
237
+			do_action("give_email_template_{$template}");
238 238
 		} else {
239
-			give_get_template_part( 'emails/body', $template, true );
239
+			give_get_template_part('emails/body', $template, true);
240 240
 		}
241 241
 
242 242
 		/**
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
 		 *
247 247
 		 * @param Give_Emails $this The email object.
248 248
 		 */
249
-		do_action( 'give_email_body', $this );
249
+		do_action('give_email_body', $this);
250 250
 
251
-		give_get_template_part( 'emails/footer', $template, true );
251
+		give_get_template_part('emails/footer', $template, true);
252 252
 
253 253
 		/**
254 254
 		 * Fires in the email footer.
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
 		 *
258 258
 		 * @param Give_Emails $this The email object.
259 259
 		 */
260
-		do_action( 'give_email_footer', $this );
260
+		do_action('give_email_footer', $this);
261 261
 
262 262
 		$body    = ob_get_clean();
263
-		$message = str_replace( '{email}', $message, $body );
263
+		$message = str_replace('{email}', $message, $body);
264 264
 
265
-		return apply_filters( 'give_email_message', $message, $this );
265
+		return apply_filters('give_email_message', $message, $this);
266 266
 	}
267 267
 
268 268
 	/**
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @return bool
277 277
 	 */
278
-	public function send( $to, $subject, $message, $attachments = '' ) {
278
+	public function send($to, $subject, $message, $attachments = '') {
279 279
 
280
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
281
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null );
280
+		if ( ! did_action('init') && ! did_action('admin_init')) {
281
+			_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null);
282 282
 
283 283
 			return false;
284 284
 		}
@@ -290,16 +290,16 @@  discard block
 block discarded – undo
290 290
 		 *
291 291
 		 * @param Give_Emails $this The email object.
292 292
 		 */
293
-		do_action( 'give_email_send_before', $this );
293
+		do_action('give_email_send_before', $this);
294 294
 
295
-		$subject = $this->parse_tags( $subject );
296
-		$message = $this->parse_tags( $message );
295
+		$subject = $this->parse_tags($subject);
296
+		$message = $this->parse_tags($message);
297 297
 
298
-		$message = $this->build_email( $message );
298
+		$message = $this->build_email($message);
299 299
 
300
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
300
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
301 301
 
302
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
302
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
303 303
 
304 304
 		/**
305 305
 		 * Fires after sending an email.
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		 *
309 309
 		 * @param Give_Emails $this The email object.
310 310
 		 */
311
-		do_action( 'give_email_send_after', $this );
311
+		do_action('give_email_send_after', $this);
312 312
 
313 313
 		return $sent;
314 314
 
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
 	 * @since 1.0
321 321
 	 */
322 322
 	public function send_before() {
323
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
324
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
325
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
323
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
324
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
325
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
326 326
 	}
327 327
 
328 328
 	/**
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 	 * @since 1.0
332 332
 	 */
333 333
 	public function send_after() {
334
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
335
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
336
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
334
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
335
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
336
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
337 337
 
338 338
 		// Reset heading to an empty string
339 339
 		$this->heading = '';
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 	 *
345 345
 	 * @since 1.0
346 346
 	 */
347
-	public function text_to_html( $message ) {
347
+	public function text_to_html($message) {
348 348
 
349
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
350
-			$message = wpautop( $message );
349
+		if ('text/html' == $this->content_type || true === $this->html) {
350
+			$message = wpautop($message);
351 351
 		}
352 352
 
353 353
 		return $message;
Please login to merge, or discard this patch.