Test Failed
Pull Request — master (#1937)
by
unknown
05:41
created
includes/admin/upgrades/views/upgrades-complete.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 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
 <div class="wrap" id="poststuff">
18 18
 	<div id="give-updates">
19
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1>
19
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1>
20 20
 		<div class="give-update-panel-content">
21
-			<p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and it\'s add-ons.', 'give' ); ?></p>
21
+			<p><?php esc_html_e('Congratulations! You are running the latest versions of Give and it\'s add-ons.', 'give'); ?></p>
22 22
 		</div>
23 23
 
24 24
 	</div>
Please login to merge, or discard this patch.
includes/admin/upgrades/views/plugins-update-section.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /* @var Give_Updates $give_updates */
3
-$plugins = $give_updates->get_updates( 'plugin' );
4
-if ( empty( $plugins ) ) {
3
+$plugins = $give_updates->get_updates('plugin');
4
+if (empty($plugins)) {
5 5
 	return;
6 6
 }
7 7
 
8 8
 ob_start();
9
-foreach ( $plugins as $plugin_data ) {
10
-	if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) {
9
+foreach ($plugins as $plugin_data) {
10
+	if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) {
11 11
 		continue;
12 12
 	}
13 13
 
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 	$author_name = $plugin_data['Author'];
16 16
 
17 17
 	// Link the plugin name to the plugin URL if available.
18
-	if ( ! empty( $plugin_data['PluginURI'] ) ) {
18
+	if ( ! empty($plugin_data['PluginURI'])) {
19 19
 		$plugin_name = sprintf(
20 20
 			'<a href="%s" title="%s">%s</a> (%s)',
21
-			esc_url( $plugin_data['PluginURI'] ),
22
-			esc_attr__( 'Visit plugin homepage', 'give' ),
21
+			esc_url($plugin_data['PluginURI']),
22
+			esc_attr__('Visit plugin homepage', 'give'),
23 23
 			$plugin_name,
24
-			esc_html( $plugin_data['Version'] )
24
+			esc_html($plugin_data['Version'])
25 25
 		);
26 26
 	}
27 27
 
28 28
 	// Link the author name to the author URL if available.
29
-	if ( ! empty( $plugin_data['AuthorURI'] ) ) {
29
+	if ( ! empty($plugin_data['AuthorURI'])) {
30 30
 		$author_name = sprintf(
31 31
 			'<a href="%s" title="%s">%s</a>',
32
-			esc_url( $plugin_data['AuthorURI'] ),
33
-			esc_attr__( 'Visit author homepage', 'give' ),
32
+			esc_url($plugin_data['AuthorURI']),
33
+			esc_attr__('Visit author homepage', 'give'),
34 34
 			$author_name
35 35
 		);
36 36
 	}
37 37
 	?>
38
-	<tr <?php echo( true !== $plugin_data['License'] ? 'data-tooltip="' . __( 'Unlicensed add-ons cannot be updated. Please purchase or renew a valid license.', 'give' ) . '"' : '' ); ?>>
39
-		<td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td>
38
+	<tr <?php echo(true !== $plugin_data['License'] ? 'data-tooltip="'.__('Unlicensed add-ons cannot be updated. Please purchase or renew a valid license.', 'give').'"' : ''); ?>>
39
+		<td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td>
40 40
 		<td>
41 41
 			<?php
42
-			echo ( true === $plugin_data['License'] ) ? '<span class="dashicons dashicons-yes"></span>' . __( 'Licensed', 'give' ) : '<span class="dashicons dashicons-no-alt"></span>' . __( 'Unlicensed', 'give' );
42
+			echo (true === $plugin_data['License']) ? '<span class="dashicons dashicons-yes"></span>'.__('Licensed', 'give') : '<span class="dashicons dashicons-no-alt"></span>'.__('Unlicensed', 'give');
43 43
 
44 44
 			echo sprintf(
45 45
 				' &ndash; %s &ndash; %s',
46
-				sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ),
47
-				sprintf( __( '(Latest Version: %s)' ), $plugin_data['update']->new_version )
46
+				sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))),
47
+				sprintf(__('(Latest Version: %s)'), $plugin_data['update']->new_version)
48 48
 			);
49 49
 			?>
50 50
 		</td>
Please login to merge, or discard this patch.
includes/admin/upgrades/views/upgrades.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
 
@@ -18,29 +18,29 @@  discard block
 block discarded – undo
18 18
 ?>
19 19
 <div class="wrap" id="poststuff">
20 20
 	<div id="give-updates">
21
-		<h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1>
21
+		<h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1>
22 22
 		<div class="give-update-panel-content">
23
-			<p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p>
23
+			<p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons.  Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p>
24 24
 		</div>
25 25
 
26 26
 		<?php $update_counter = 1; ?>
27 27
 
28 28
 		<?php $db_updates = $give_updates->get_db_update_count(); ?>
29
-		<?php if ( ! empty( $db_updates ) ) : ?>
30
-			<?php $db_update_url = add_query_arg( array(
29
+		<?php if ( ! empty($db_updates)) : ?>
30
+			<?php $db_update_url = add_query_arg(array(
31 31
 				'type' => 'database',
32
-			) ); ?>
32
+			)); ?>
33 33
 			<div id="give-db-updates">
34 34
 				<div class="postbox-container">
35 35
 					<div class="postbox">
36
-						<h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2>
36
+						<h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2>
37 37
 						<div class="inside">
38 38
 							<div class="panel-content">
39
-								<p><?php echo sprintf( __( 'Give needs to update the database. <a href="%s">Update now ></a>', 'give' ), $db_update_url ); ?></p>
39
+								<p><?php echo sprintf(__('Give needs to update the database. <a href="%s">Update now ></a>', 'give'), $db_update_url); ?></p>
40 40
 							</div>
41 41
 							<div class="progress-container give-hidden">
42 42
 								<strong class="update-message" data-update-count="<?php echo $db_updates; ?>"
43
-								        data-resume-update="<?php echo $give_updates->resume_updates(); ?>"><?php echo sprintf( __( 'Update 1 of %s', 'give' ), $db_updates ); ?></strong>
43
+								        data-resume-update="<?php echo $give_updates->resume_updates(); ?>"><?php echo sprintf(__('Update 1 of %s', 'give'), $db_updates); ?></strong>
44 44
 								<div class="progress-content"></div>
45 45
 							</div>
46 46
 						</div>
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
 		<?php endif; ?>
52 52
 
53 53
 		<?php $plugin_updates = $give_updates->get_plugin_update_count(); ?>
54
-		<?php if ( ! empty( $plugin_updates ) ) : ?>
55
-			<?php $plugin_update_url = add_query_arg( array(
54
+		<?php if ( ! empty($plugin_updates)) : ?>
55
+			<?php $plugin_update_url = add_query_arg(array(
56 56
 				's' => 'Give',
57
-			), admin_url( '/plugins.php' ) ); ?>
57
+			), admin_url('/plugins.php')); ?>
58 58
 			<div id="give-plugin-updates">
59 59
 				<div class="postbox-container">
60 60
 					<div class="postbox">
61
-						<h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2>
61
+						<h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2>
62 62
 						<div class="inside">
63 63
 							<div class="panel-content">
64
-								<p><?php echo sprintf( __( 'There are %1$s Give %2$s that need to be updated. <a href="%3$s">Update now ></a>', 'give' ), $plugin_updates, _n( 'add-on', 'add-ons', $plugin_updates, 'give' ), $plugin_update_url ); ?></p>
64
+								<p><?php echo sprintf(__('There are %1$s Give %2$s that need to be updated. <a href="%3$s">Update now ></a>', 'give'), $plugin_updates, _n('add-on', 'add-ons', $plugin_updates, 'give'), $plugin_update_url); ?></p>
65 65
 								<?php include_once 'plugins-update-section.php'; ?>
66 66
 							</div>
67 67
 						</div>
Please login to merge, or discard this patch.
includes/admin/donors/class-donor-table.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  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
 
19 19
 // Load WP_List_Table if not loaded
20
-if ( ! class_exists( 'WP_List_Table' ) ) {
21
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
20
+if ( ! class_exists('WP_List_Table')) {
21
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
22 22
 }
23 23
 
24 24
 /**
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
 	public function __construct() {
62 62
 
63 63
 		// Set parent defaults
64
-		parent::__construct( array(
65
-			'singular' => __( 'Donor', 'give' ),     // Singular name of the listed records.
66
-			'plural'   => __( 'Donors', 'give' ),    // Plural name of the listed records.
67
-			'ajax'     => false,// Does this table support ajax?.
68
-		) );
64
+		parent::__construct(array(
65
+			'singular' => __('Donor', 'give'), // Singular name of the listed records.
66
+			'plural'   => __('Donors', 'give'), // Plural name of the listed records.
67
+			'ajax'     => false, // Does this table support ajax?.
68
+		));
69 69
 
70 70
 	}
71 71
 
@@ -80,22 +80,22 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @return void
82 82
 	 */
83
-	public function search_box( $text, $input_id ) {
84
-		$input_id = $input_id . '-search-input';
83
+	public function search_box($text, $input_id) {
84
+		$input_id = $input_id.'-search-input';
85 85
 
86
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
87
-			echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
86
+		if ( ! empty($_REQUEST['orderby'])) {
87
+			echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />';
88 88
 		}
89
-		if ( ! empty( $_REQUEST['order'] ) ) {
90
-			echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
89
+		if ( ! empty($_REQUEST['order'])) {
90
+			echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />';
91 91
 		}
92 92
 		?>
93 93
 		<p class="search-box" role="search">
94 94
 			<label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label>
95 95
 			<input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/>
96
-			<?php submit_button( $text, 'button', false, false, array(
96
+			<?php submit_button($text, 'button', false, false, array(
97 97
 				'ID' => 'search-submit',
98
-			) ); ?>
98
+			)); ?>
99 99
 		</p>
100 100
 		<?php
101 101
 	}
@@ -111,27 +111,27 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @return string Column Name.
113 113
 	 */
114
-	public function column_default( $donor, $column_name ) {
115
-		switch ( $column_name ) {
114
+	public function column_default($donor, $column_name) {
115
+		switch ($column_name) {
116 116
 
117 117
 			case 'num_donations' :
118
-				$value = '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . urlencode( $donor['id'] ) ) . '&status=publish' . ' ">' . esc_html( $donor['num_donations'] ) . '</a>';
118
+				$value = '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.urlencode($donor['id'])).'&status=publish'.' ">'.esc_html($donor['num_donations']).'</a>';
119 119
 				break;
120 120
 
121 121
 			case 'amount_spent' :
122
-				$value = give_currency_filter( give_format_amount( $donor[ $column_name ], array( 'sanitize' => false ) ) );
122
+				$value = give_currency_filter(give_format_amount($donor[$column_name], array('sanitize' => false)));
123 123
 				break;
124 124
 
125 125
 			case 'date_created' :
126
-				$value = date_i18n( give_date_format(), strtotime( $donor['date_created'] ) );
126
+				$value = date_i18n(give_date_format(), strtotime($donor['date_created']));
127 127
 				break;
128 128
 
129 129
 			default:
130
-				$value = isset( $donor[ $column_name ] ) ? $donor[ $column_name ] : null;
130
+				$value = isset($donor[$column_name]) ? $donor[$column_name] : null;
131 131
 				break;
132 132
 		}
133 133
 
134
-		return apply_filters( "give_report_column_{$column_name}", $value, $donor['id'] );
134
+		return apply_filters("give_report_column_{$column_name}", $value, $donor['id']);
135 135
 
136 136
 	}
137 137
 
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
 	 *
143 143
 	 * @return string
144 144
 	 */
145
-	public function column_name( $donor ) {
146
-		$name     = '#' . $donor['id'] . ' ';
147
-		$name     .= ! empty( $donor['name'] ) ? $donor['name'] : '<em>' . esc_html__( 'Unnamed Donor', 'give' ) . '</em>';
148
-		$view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] );
149
-		$actions  = $this->get_row_actions( $donor );
145
+	public function column_name($donor) {
146
+		$name     = '#'.$donor['id'].' ';
147
+		$name .= ! empty($donor['name']) ? $donor['name'] : '<em>'.esc_html__('Unnamed Donor', 'give').'</em>';
148
+		$view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']);
149
+		$actions  = $this->get_row_actions($donor);
150 150
 
151
-		return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions );
151
+		return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions);
152 152
 	}
153 153
 
154 154
 	/**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_columns() {
162 162
 		$columns = array(
163
-			'name'          => __( 'Name', 'give' ),
164
-			'email'         => __( 'Email', 'give' ),
165
-			'num_donations' => __( 'Donations', 'give' ),
166
-			'amount_spent'  => __( 'Total Donated', 'give' ),
167
-			'date_created'  => __( 'Date Created', 'give' ),
163
+			'name'          => __('Name', 'give'),
164
+			'email'         => __('Email', 'give'),
165
+			'num_donations' => __('Donations', 'give'),
166
+			'amount_spent'  => __('Total Donated', 'give'),
167
+			'date_created'  => __('Date Created', 'give'),
168 168
 		);
169 169
 
170
-		return apply_filters( 'give_list_donors_columns', $columns );
170
+		return apply_filters('give_list_donors_columns', $columns);
171 171
 
172 172
 	}
173 173
 
@@ -181,13 +181,13 @@  discard block
 block discarded – undo
181 181
 	public function get_sortable_columns() {
182 182
 
183 183
 		$columns = array(
184
-			'date_created'  => array( 'date_created', true ),
185
-			'name'          => array( 'name', true ),
186
-			'num_donations' => array( 'purchase_count', false ),
187
-			'amount_spent'  => array( 'purchase_value', false ),
184
+			'date_created'  => array('date_created', true),
185
+			'name'          => array('name', true),
186
+			'num_donations' => array('purchase_count', false),
187
+			'amount_spent'  => array('purchase_value', false),
188 188
 		);
189 189
 
190
-		return apply_filters( 'give_list_donors_sortable_columns', $columns );
190
+		return apply_filters('give_list_donors_sortable_columns', $columns);
191 191
 	}
192 192
 
193 193
 	/**
@@ -200,19 +200,19 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return array An array of action links.
202 202
 	 */
203
-	public function get_row_actions( $donor ) {
203
+	public function get_row_actions($donor) {
204 204
 
205 205
 		$actions = array(
206 206
 
207
-			'view' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor['id'] ), sprintf( esc_attr__( 'View "%s"', 'give' ), $donor['name'] ), __( 'View Donor', 'give' ) ),
207
+			'view' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor['id']), sprintf(esc_attr__('View "%s"', 'give'), $donor['name']), __('View Donor', 'give')),
208 208
 
209
-			'notes' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor['id'] ), sprintf( esc_attr__( 'Notes for "%s"', 'give' ), $donor['name'] ), __( 'Notes', 'give' ) ),
209
+			'notes' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor['id']), sprintf(esc_attr__('Notes for "%s"', 'give'), $donor['name']), __('Notes', 'give')),
210 210
 
211
-			'delete' => sprintf( '<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor['id'] ), sprintf( esc_attr__( 'Delete "%s"', 'give' ), $donor['name'] ), __( 'Delete', 'give' ) ),
211
+			'delete' => sprintf('<a href="%1$s" aria-label="%2$s">%3$s</a>', admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor['id']), sprintf(esc_attr__('Delete "%s"', 'give'), $donor['name']), __('Delete', 'give')),
212 212
 
213 213
 		);
214 214
 
215
-		return apply_filters( 'give_donor_row_actions', $actions, $donor );
215
+		return apply_filters('give_donor_row_actions', $actions, $donor);
216 216
 
217 217
 	}
218 218
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @since  1.0
227 227
 	 * @return void
228 228
 	 */
229
-	public function bulk_actions( $which = '' ) {
229
+	public function bulk_actions($which = '') {
230 230
 		// These aren't really bulk actions but this outputs the markup in the right place.
231 231
 	}
232 232
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @return int Current page number.
239 239
 	 */
240 240
 	public function get_paged() {
241
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
241
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
242 242
 	}
243 243
 
244 244
 	/**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	 * @return mixed string If search is present, false otherwise.
250 250
 	 */
251 251
 	public function get_search() {
252
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
252
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
253 253
 	}
254 254
 
255 255
 	/**
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
 
267 267
 		// Get donor query.
268 268
 		$args   = $this->get_donor_query();
269
-		$donors = Give()->donors->get_donors( $args );
269
+		$donors = Give()->donors->get_donors($args);
270 270
 
271
-		if ( $donors ) {
271
+		if ($donors) {
272 272
 
273
-			foreach ( $donors as $donor ) {
273
+			foreach ($donors as $donor) {
274 274
 
275
-				$user_id = ! empty( $donor->user_id ) ? intval( $donor->user_id ) : 0;
275
+				$user_id = ! empty($donor->user_id) ? intval($donor->user_id) : 0;
276 276
 
277 277
 				$data[] = array(
278 278
 					'id'            => $donor->id,
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			}
287 287
 		}
288 288
 
289
-		return apply_filters( 'give_donors_column_query_data', $data );
289
+		return apply_filters('give_donors_column_query_data', $data);
290 290
 	}
291 291
 
292 292
 	/**
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
 
302 302
 		$_donor_query['number'] = - 1;
303 303
 		$_donor_query['offset'] = 0;
304
-		$donors                 = Give()->donors->get_donors( $_donor_query );
304
+		$donors                 = Give()->donors->get_donors($_donor_query);
305 305
 
306
-		return count( $donors );
306
+		return count($donors);
307 307
 	}
308 308
 
309 309
 	/**
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	public function get_donor_query() {
317 317
 		$paged   = $this->get_paged();
318
-		$offset  = $this->per_page * ( $paged - 1 );
318
+		$offset  = $this->per_page * ($paged - 1);
319 319
 		$search  = $this->get_search();
320
-		$order   = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
321
-		$orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id';
320
+		$order   = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC';
321
+		$orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id';
322 322
 
323 323
 		$args = array(
324 324
 			'number'  => $this->per_page,
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 			'orderby' => $orderby,
328 328
 		);
329 329
 
330
-		if ( $search ) {
331
-			if ( is_email( $search ) ) {
330
+		if ($search) {
331
+			if (is_email($search)) {
332 332
 				$args['email'] = $search;
333
-			} elseif ( is_numeric( $search ) ) {
333
+			} elseif (is_numeric($search)) {
334 334
 				$args['id'] = $search;
335 335
 			} else {
336 336
 				$args['name'] = $search;
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
 		$hidden   = array(); // No hidden columns.
354 354
 		$sortable = $this->get_sortable_columns();
355 355
 
356
-		$this->_column_headers = array( $columns, $hidden, $sortable );
356
+		$this->_column_headers = array($columns, $hidden, $sortable);
357 357
 
358 358
 		$this->items = $this->donor_data();
359 359
 
360 360
 		$this->total = $this->get_donor_count();
361 361
 
362
-		$this->set_pagination_args( array(
362
+		$this->set_pagination_args(array(
363 363
 			'total_items' => $this->total,
364 364
 			'per_page'    => $this->per_page,
365
-			'total_pages' => ceil( $this->total / $this->per_page ),
366
-		) );
365
+			'total_pages' => ceil($this->total / $this->per_page),
366
+		));
367 367
 	}
368 368
 }
Please login to merge, or discard this patch.
includes/admin/donors/donors.php 1 patch
Spacing   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
  */
25 25
 function give_donors_page() {
26 26
 	$default_views  = give_donor_views();
27
-	$requested_view = isset( $_GET['view'] ) ? sanitize_text_field( $_GET['view'] ) : 'donors';
28
-	if ( array_key_exists( $requested_view, $default_views ) && function_exists( $default_views[ $requested_view ] ) ) {
29
-		give_render_donor_view( $requested_view, $default_views );
27
+	$requested_view = isset($_GET['view']) ? sanitize_text_field($_GET['view']) : 'donors';
28
+	if (array_key_exists($requested_view, $default_views) && function_exists($default_views[$requested_view])) {
29
+		give_render_donor_view($requested_view, $default_views);
30 30
 	} else {
31 31
 		give_donors_list();
32 32
 	}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 	$views = array();
44 44
 
45
-	return apply_filters( 'give_donor_views', $views );
45
+	return apply_filters('give_donor_views', $views);
46 46
 
47 47
 }
48 48
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
 	$tabs = array();
58 58
 
59
-	return apply_filters( 'give_donor_tabs', $tabs );
59
+	return apply_filters('give_donor_tabs', $tabs);
60 60
 
61 61
 }
62 62
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  * @return void
68 68
  */
69 69
 function give_donors_list() {
70
-	include dirname( __FILE__ ) . '/class-donor-table.php';
70
+	include dirname(__FILE__).'/class-donor-table.php';
71 71
 
72 72
 	$donors_table = new Give_Donor_List_Table();
73 73
 	$donors_table->prepare_items();
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 		 *
81 81
 		 * @since 1.0
82 82
 		 */
83
-		do_action( 'give_donors_table_top' );
83
+		do_action('give_donors_table_top');
84 84
 		?>
85
-		<form id="give-donors-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); ?>">
85
+		<form id="give-donors-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors'); ?>">
86 86
 			<?php
87
-			$donors_table->search_box( esc_html__( 'Search Donors', 'give' ), 'give-donors' );
87
+			$donors_table->search_box(esc_html__('Search Donors', 'give'), 'give-donors');
88 88
 			$donors_table->display();
89 89
 			?>
90 90
 			<input type="hidden" name="post_type" value="give_forms" />
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		 *
98 98
 		 * @since 1.0
99 99
 		 */
100
-		do_action( 'give_donors_table_bottom' );
100
+		do_action('give_donors_table_bottom');
101 101
 		?>
102 102
 	</div>
103 103
 	<?php
@@ -113,27 +113,27 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return void
115 115
  */
116
-function give_render_donor_view( $view, $callbacks ) {
116
+function give_render_donor_view($view, $callbacks) {
117 117
 
118 118
 	$render = true;
119 119
 
120
-	$donor_view_role = apply_filters( 'give_view_donors_role', 'view_give_reports' );
120
+	$donor_view_role = apply_filters('give_view_donors_role', 'view_give_reports');
121 121
 
122
-	if ( ! current_user_can( $donor_view_role ) ) {
123
-		give_set_error( 'give-no-access', __( 'You are not permitted to view this data.', 'give' ) );
122
+	if ( ! current_user_can($donor_view_role)) {
123
+		give_set_error('give-no-access', __('You are not permitted to view this data.', 'give'));
124 124
 		$render = false;
125 125
 	}
126 126
 
127
-	if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
128
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
127
+	if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) {
128
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
129 129
 		$render = false;
130 130
 	}
131 131
 
132 132
 	$donor_id = (int) $_GET['id'];
133
-	$donor    = new Give_Donor( $donor_id );
133
+	$donor    = new Give_Donor($donor_id);
134 134
 
135
-	if ( empty( $donor->id ) ) {
136
-		give_set_error( 'give-invalid_donor', __( 'Invalid Donor ID.', 'give' ) );
135
+	if (empty($donor->id)) {
136
+		give_set_error('give-invalid_donor', __('Invalid Donor ID.', 'give'));
137 137
 		$render = false;
138 138
 	}
139 139
 
@@ -142,34 +142,34 @@  discard block
 block discarded – undo
142 142
 
143 143
 	<div class='wrap'>
144 144
 
145
-		<?php if ( give_get_errors() ) : ?>
145
+		<?php if (give_get_errors()) : ?>
146 146
 			<div class="error settings-error">
147
-				<?php Give()->notices->render_frontend_notices( 0 ); ?>
147
+				<?php Give()->notices->render_frontend_notices(0); ?>
148 148
 			</div>
149 149
 		<?php endif; ?>
150 150
 
151
-		<h1 class="screen-reader-text"><?php esc_html_e( 'Donor', 'give' ); ?></h1>
151
+		<h1 class="screen-reader-text"><?php esc_html_e('Donor', 'give'); ?></h1>
152 152
 
153
-		<?php if ( $donor && $render ) : ?>
153
+		<?php if ($donor && $render) : ?>
154 154
 
155 155
 			<h2 class="nav-tab-wrapper">
156 156
 			<?php
157
-			foreach ( $donor_tabs as $key => $tab ) :
157
+			foreach ($donor_tabs as $key => $tab) :
158 158
 				$active = $key === $view ? true : false;
159 159
 				$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
160 160
 				printf(
161
-					'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>' . "\n",
162
-					esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=' . $key . '&id=' . $donor->id ) ),
163
-					esc_attr( $class ),
164
-					sanitize_html_class( $tab['dashicon'] ),
165
-					esc_html( $tab['title'] )
161
+					'<a href="%1$s" class="%2$s"><span class="dashicons %3$s"></span>%4$s</a>'."\n",
162
+					esc_url(admin_url('edit.php?post_type=give_forms&page=give-donors&view='.$key.'&id='.$donor->id)),
163
+					esc_attr($class),
164
+					sanitize_html_class($tab['dashicon']),
165
+					esc_html($tab['title'])
166 166
 				);
167 167
 			endforeach;
168 168
 			?>
169 169
 			</h2>
170 170
 
171 171
 			<div id="give-donor-card-wrapper">
172
-				<?php $callbacks[ $view ]( $donor ) ?>
172
+				<?php $callbacks[$view]($donor) ?>
173 173
 			</div>
174 174
 
175 175
 		<?php endif; ?>
@@ -189,9 +189,9 @@  discard block
 block discarded – undo
189 189
  *
190 190
  * @return void
191 191
  */
192
-function give_donor_view( $donor ) {
192
+function give_donor_view($donor) {
193 193
 
194
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
194
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
195 195
 
196 196
 	/**
197 197
 	 * Fires in donor profile screen, above the donor card.
@@ -200,32 +200,32 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @param object $donor The donor object being displayed.
202 202
 	 */
203
-	do_action( 'give_donor_card_top', $donor );
203
+	do_action('give_donor_card_top', $donor);
204 204
 	?>
205 205
 
206 206
 	<div id="donor-summary" class="info-wrapper donor-section postbox">
207 207
 
208
-		<form id="edit-donor-info" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>">
208
+		<form id="edit-donor-info" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>">
209 209
 
210 210
 			<div class="donor-info">
211 211
 
212 212
 				<div class="donor-bio-header clearfix">
213 213
 
214 214
 					<div class="avatar-wrap left" id="donor-avatar">
215
-						<?php echo get_avatar( $donor->email ); ?>
215
+						<?php echo get_avatar($donor->email); ?>
216 216
 					</div>
217 217
 
218 218
 					<div id="donor-name-wrap" class="left">
219 219
 						<span class="donor-id">#<?php echo $donor->id; ?></span>
220
-						<span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr( $donor->name ); ?>" placeholder="<?php esc_attr_e( 'Donor Name', 'give' ); ?>" /></span>
220
+						<span class="donor-name info-item edit-item"><input size="15" data-key="name" name="customerinfo[name]" type="text" value="<?php echo esc_attr($donor->name); ?>" placeholder="<?php esc_attr_e('Donor Name', 'give'); ?>" /></span>
221 221
 						<span class="donor-name info-item editable"><span data-key="name"><?php echo $donor->name; ?></span></span>
222 222
 					</div>
223 223
 					<p class="donor-since info-item">
224
-						<?php esc_html_e( 'Donor since', 'give' ); ?>
225
-						<?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?>
224
+						<?php esc_html_e('Donor since', 'give'); ?>
225
+						<?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?>
226 226
 					</p>
227
-					<?php if ( current_user_can( $donor_edit_role ) ) : ?>
228
-						<a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php esc_html_e( 'Edit Donor', 'give' ); ?></a>
227
+					<?php if (current_user_can($donor_edit_role)) : ?>
228
+						<a href="#" id="edit-donor" class="button info-item editable donor-edit-link"><?php esc_html_e('Edit Donor', 'give'); ?></a>
229 229
 					<?php endif; ?>
230 230
 				</div>
231 231
 				<!-- /donor-bio-header -->
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 					<table class="widefat">
236 236
 						<tbody>
237 237
 						<tr class="alternate">
238
-							<th scope="col"><label for="tablecell"><?php esc_html_e( 'User:', 'give' ); ?></label></th>
238
+							<th scope="col"><label for="tablecell"><?php esc_html_e('User:', 'give'); ?></label></th>
239 239
 							<td>
240 240
 								<span class="donor-user-id info-item edit-item">
241 241
 									<?php
@@ -252,37 +252,37 @@  discard block
 block discarded – undo
252 252
 										'data'  => $data_atts,
253 253
 									);
254 254
 
255
-									if ( ! empty( $user_id ) ) {
256
-										$userdata           = get_userdata( $user_id );
255
+									if ( ! empty($user_id)) {
256
+										$userdata = get_userdata($user_id);
257 257
 										$user_args['selected'] = $user_id;
258 258
 									}
259 259
 
260
-									echo Give()->html->ajax_user_search( $user_args );
260
+									echo Give()->html->ajax_user_search($user_args);
261 261
 									?>
262 262
 								</span>
263 263
 
264 264
 								<span class="donor-user-id info-item editable">
265
-									<?php if ( ! empty( $userdata ) ) { ?>
266
-										<span data-key="user_id">#<?php echo $donor->user_id . ' - ' . $userdata->display_name; ?></span>
265
+									<?php if ( ! empty($userdata)) { ?>
266
+										<span data-key="user_id">#<?php echo $donor->user_id.' - '.$userdata->display_name; ?></span>
267 267
 									<?php } else { ?>
268
-										<span data-key="user_id"><?php esc_html_e( 'None', 'give' ); ?></span>
268
+										<span data-key="user_id"><?php esc_html_e('None', 'give'); ?></span>
269 269
 									<?php } ?>
270
-									<?php if ( current_user_can( $donor_edit_role ) && intval( $donor->user_id ) > 0 ) { ?>
271
-										<span class="disconnect-user"> - <a id="disconnect-donor" href="#disconnect" aria-label="<?php esc_attr_e( 'Disconnects the current user ID from this donor record.', 'give' ); ?>"><?php esc_html_e( 'Disconnect User', 'give' ); ?></a></span>
270
+									<?php if (current_user_can($donor_edit_role) && intval($donor->user_id) > 0) { ?>
271
+										<span class="disconnect-user"> - <a id="disconnect-donor" href="#disconnect" aria-label="<?php esc_attr_e('Disconnects the current user ID from this donor record.', 'give'); ?>"><?php esc_html_e('Disconnect User', 'give'); ?></a></span>
272 272
 									<?php } ?>
273 273
 								</span>
274 274
 							</td>
275 275
 						</tr>
276
-						<?php if ( isset( $donor->user_id ) && $donor->user_id > 0 ) : ?>
276
+						<?php if (isset($donor->user_id) && $donor->user_id > 0) : ?>
277 277
 
278 278
 							<tr>
279
-								<th scope="col"><?php esc_html_e( 'Address:', 'give' ); ?></th>
279
+								<th scope="col"><?php esc_html_e('Address:', 'give'); ?></th>
280 280
 								<td class="row-title">
281 281
 
282 282
 									<div class="donor-address-wrapper">
283 283
 
284 284
 										<?php
285
-										$address  = get_user_meta( $donor->user_id, '_give_user_address', true );
285
+										$address  = get_user_meta($donor->user_id, '_give_user_address', true);
286 286
 										$defaults = array(
287 287
 											'line1'   => '',
288 288
 											'line2'   => '',
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 											'zip'     => '',
293 293
 										);
294 294
 
295
-										$address = wp_parse_args( $address, $defaults );
295
+										$address = wp_parse_args($address, $defaults);
296 296
 										?>
297 297
 
298
-										<?php if ( ! empty( $address ) ) { ?>
298
+										<?php if ( ! empty($address)) { ?>
299 299
 											<span class="donor-address info-item editable">
300 300
 												<span class="info-item" data-key="line1"><?php echo $address['line1']; ?></span>
301 301
 												<span class="info-item" data-key="line2"><?php echo $address['line2']; ?></span>
@@ -306,43 +306,43 @@  discard block
 block discarded – undo
306 306
 											</span>
307 307
 										<?php } ?>
308 308
 										<span class="donor-address info-item edit-item">
309
-											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e( 'Address 1', 'give' ); ?>" value="<?php echo $address['line1']; ?>" />
310
-											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e( 'Address 2', 'give' ); ?>" value="<?php echo $address['line2']; ?>" />
311
-											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" value="<?php echo $address['city']; ?>" />
309
+											<input class="info-item" type="text" data-key="line1" name="customerinfo[line1]" placeholder="<?php esc_attr_e('Address 1', 'give'); ?>" value="<?php echo $address['line1']; ?>" />
310
+											<input class="info-item" type="text" data-key="line2" name="customerinfo[line2]" placeholder="<?php esc_attr_e('Address 2', 'give'); ?>" value="<?php echo $address['line2']; ?>" />
311
+											<input class="info-item" type="text" data-key="city" name="customerinfo[city]" placeholder="<?php esc_attr_e('City', 'give'); ?>" value="<?php echo $address['city']; ?>" />
312 312
 											<select data-key="country" name="customerinfo[country]" id="billing_country" class="billing_country give-select edit-item">
313 313
 												<?php
314 314
 
315 315
 												$selected_country = $address['country'];
316 316
 
317 317
 												$countries = give_get_country_list();
318
-												foreach ( $countries as $country_code => $country ) {
319
-													echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>';
318
+												foreach ($countries as $country_code => $country) {
319
+													echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>';
320 320
 												}
321 321
 												?>
322 322
 											</select>
323 323
 											<?php
324 324
 											$selected_state = give_get_state();
325
-											$states         = give_get_states( $selected_country );
325
+											$states         = give_get_states($selected_country);
326 326
 
327
-											$selected_state = isset( $address['state'] ) ? $address['state'] : $selected_state;
327
+											$selected_state = isset($address['state']) ? $address['state'] : $selected_state;
328 328
 
329
-											if ( ! empty( $states ) ) {
329
+											if ( ! empty($states)) {
330 330
 												?>
331 331
 												<select data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-select info-item">
332 332
 													<?php
333
-													foreach ( $states as $state_code => $state ) {
334
-														echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>';
333
+													foreach ($states as $state_code => $state) {
334
+														echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>';
335 335
 													}
336 336
 													?>
337 337
 												</select>
338 338
 												<?php
339 339
 											} else {
340 340
 												?>
341
-												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e( 'State / Province / County', 'give' ); ?>" />
341
+												<input type="text" size="6" data-key="state" name="customerinfo[state]" id="card_state" class="card_state give-input info-item" placeholder="<?php esc_attr_e('State / Province / County', 'give'); ?>" />
342 342
 												<?php
343 343
 											}
344 344
 											?>
345
-											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" value="<?php echo $address['zip']; ?>" />
345
+											<input class="info-item" type="text" data-key="zip" name="customerinfo[zip]" placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" value="<?php echo $address['zip']; ?>" />
346 346
 										</span>
347 347
 
348 348
 									</div>
@@ -358,10 +358,10 @@  discard block
 block discarded – undo
358 358
 
359 359
 			<span id="donor-edit-actions" class="edit-item">
360 360
 				<input type="hidden" data-key="id" name="customerinfo[id]" value="<?php echo $donor->id; ?>" />
361
-				<?php wp_nonce_field( 'edit-donor', '_wpnonce', false, true ); ?>
361
+				<?php wp_nonce_field('edit-donor', '_wpnonce', false, true); ?>
362 362
 				<input type="hidden" name="give_action" value="edit-donor" />
363
-				<input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php esc_attr_e( 'Update Donor', 'give' ); ?>" />
364
-				<a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
363
+				<input type="submit" id="give-edit-donor-save" class="button-secondary" value="<?php esc_attr_e('Update Donor', 'give'); ?>" />
364
+				<a id="give-edit-donor-cancel" href="" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
365 365
 			</span>
366 366
 
367 367
 		</form>
@@ -376,24 +376,24 @@  discard block
 block discarded – undo
376 376
 	 *
377 377
 	 * @param object $donor The donor object being displayed.
378 378
 	 */
379
-	do_action( 'give_donor_before_stats', $donor );
379
+	do_action('give_donor_before_stats', $donor);
380 380
 	?>
381 381
 
382 382
 	<div id="donor-stats-wrapper" class="donor-section postbox clear">
383 383
 		<ul>
384 384
 			<li>
385
-				<a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $donor->email ) ); ?>">
385
+				<a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($donor->email)); ?>">
386 386
 					<span class="dashicons dashicons-heart"></span>
387 387
 					<?php
388 388
 					// Completed Donations
389
-					$completed_donations_text = sprintf( _n( '%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give' ), $donor->purchase_count );
390
-					echo apply_filters( 'give_donor_completed_donations', $completed_donations_text, $donor );
389
+					$completed_donations_text = sprintf(_n('%d Completed Donation', '%d Completed Donations', $donor->purchase_count, 'give'), $donor->purchase_count);
390
+					echo apply_filters('give_donor_completed_donations', $completed_donations_text, $donor);
391 391
 					?>
392 392
 				</a>
393 393
 			</li>
394 394
 			<li>
395 395
 				<span class="dashicons dashicons-chart-area"></span>
396
-				<?php echo give_currency_filter( give_format_amount( $donor->purchase_value, array( 'sanitize' => false ) ) ); ?> <?php esc_html_e( 'Lifetime Donations', 'give' ); ?>
396
+				<?php echo give_currency_filter(give_format_amount($donor->purchase_value, array('sanitize' => false))); ?> <?php esc_html_e('Lifetime Donations', 'give'); ?>
397 397
 			</li>
398 398
 			<?php
399 399
 			/**
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 			 *
406 406
 			 * @param object $donor The donor object being displayed.
407 407
 			 */
408
-			do_action( 'give_donor_stats_list', $donor );
408
+			do_action('give_donor_stats_list', $donor);
409 409
 			?>
410 410
 		</ul>
411 411
 	</div>
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @param object $donor The donor object being displayed.
420 420
 	 */
421
-	do_action( 'give_donor_before_tables_wrapper', $donor );
421
+	do_action('give_donor_before_tables_wrapper', $donor);
422 422
 	?>
423 423
 
424 424
 	<div id="donor-tables-wrapper" class="donor-section">
@@ -431,46 +431,46 @@  discard block
 block discarded – undo
431 431
 		 *
432 432
 		 * @param object $donor The donor object being displayed.
433 433
 		 */
434
-		do_action( 'give_donor_before_tables', $donor );
434
+		do_action('give_donor_before_tables', $donor);
435 435
 		?>
436 436
 
437
-		<h3><?php _e( 'Donor Emails', 'give' ); ?></h3>
437
+		<h3><?php _e('Donor Emails', 'give'); ?></h3>
438 438
 
439 439
 		<table class="wp-list-table widefat striped emails">
440 440
 			<thead>
441 441
 				<tr>
442
-					<th><?php _e( 'Email', 'give' ); ?></th>
443
-					<th><?php _e( 'Actions', 'give' ); ?></th>
442
+					<th><?php _e('Email', 'give'); ?></th>
443
+					<th><?php _e('Actions', 'give'); ?></th>
444 444
 				</tr>
445 445
 			</thead>
446 446
 
447 447
 			<tbody>
448
-				<?php if ( ! empty( $donor->emails ) ) { ?>
448
+				<?php if ( ! empty($donor->emails)) { ?>
449 449
 
450
-					<?php foreach ( $donor->emails as $key => $email ) : ?>
450
+					<?php foreach ($donor->emails as $key => $email) : ?>
451 451
 						<tr data-key="<?php echo $key; ?>">
452 452
 							<td>
453 453
 								<?php echo $email; ?>
454
-								<?php if ( 'primary' === $key ) : ?>
454
+								<?php if ('primary' === $key) : ?>
455 455
 									<span class="dashicons dashicons-star-filled primary-email-icon"></span>
456 456
 								<?php endif; ?>
457 457
 							</td>
458 458
 							<td>
459
-								<?php if ( 'primary' !== $key ) : ?>
459
+								<?php if ('primary' !== $key) : ?>
460 460
 									<?php
461
-									$base_url    = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id );
462
-									$promote_url = wp_nonce_url( add_query_arg( array(
463
-										'email' => rawurlencode( $email ),
461
+									$base_url    = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id);
462
+									$promote_url = wp_nonce_url(add_query_arg(array(
463
+										'email' => rawurlencode($email),
464 464
 										'give_action' => 'set_donor_primary_email',
465
-									), $base_url ), 'give-set-donor-primary-email' );
466
-									$remove_url  = wp_nonce_url( add_query_arg( array(
467
-										'email' => rawurlencode( $email ),
465
+									), $base_url), 'give-set-donor-primary-email');
466
+									$remove_url = wp_nonce_url(add_query_arg(array(
467
+										'email' => rawurlencode($email),
468 468
 										'give_action' => 'remove_donor_email',
469
-									), $base_url ), 'give-remove-donor-email' );
469
+									), $base_url), 'give-remove-donor-email');
470 470
 									?>
471
-									<a href="<?php echo $promote_url; ?>"><?php _e( 'Make Primary', 'give' ); ?></a>
471
+									<a href="<?php echo $promote_url; ?>"><?php _e('Make Primary', 'give'); ?></a>
472 472
 									&nbsp;|&nbsp;
473
-									<a href="<?php echo $remove_url; ?>" class="delete"><?php _e( 'Remove', 'give' ); ?></a>
473
+									<a href="<?php echo $remove_url; ?>" class="delete"><?php _e('Remove', 'give'); ?></a>
474 474
 								<?php endif; ?>
475 475
 							</td>
476 476
 						</tr>
@@ -480,59 +480,59 @@  discard block
 block discarded – undo
480 480
 						<td colspan="2" class="add-donor-email-td">
481 481
 							<div class="add-donor-email-wrapper">
482 482
 								<input type="hidden" name="donor-id" value="<?php echo $donor->id; ?>" />
483
-								<?php wp_nonce_field( 'give_add_donor_email', 'add_email_nonce', false, true ); ?>
484
-								<input type="email" name="additional-email" value="" placeholder="<?php _e( 'Email Address', 'give' ); ?>" />&nbsp;
485
-								<input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" />&nbsp;<label for="make-additional-primary"><?php _e( 'Make Primary', 'give' ); ?></label>
486
-								<button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e( 'Add Email', 'give' ); ?></button>
483
+								<?php wp_nonce_field('give_add_donor_email', 'add_email_nonce', false, true); ?>
484
+								<input type="email" name="additional-email" value="" placeholder="<?php _e('Email Address', 'give'); ?>" />&nbsp;
485
+								<input type="checkbox" name="make-additional-primary" value="1" id="make-additional-primary" />&nbsp;<label for="make-additional-primary"><?php _e('Make Primary', 'give'); ?></label>
486
+								<button class="button-secondary give-add-donor-email" id="add-donor-email"><?php _e('Add Email', 'give'); ?></button>
487 487
 								<span class="spinner"></span>
488 488
 							</div>
489 489
 							<div class="notice-wrap"></div>
490 490
 						</td>
491 491
 					</tr>
492 492
 				<?php } else { ?>
493
-					<tr><td colspan="2"><?php _e( 'No Emails Found', 'give' ); ?></td></tr>
493
+					<tr><td colspan="2"><?php _e('No Emails Found', 'give'); ?></td></tr>
494 494
 				<?php }// End if().
495 495
 	?>
496 496
 			</tbody>
497 497
 		</table>
498 498
 
499
-		<h3><?php esc_html_e( 'Recent Donations', 'give' ); ?></h3>
499
+		<h3><?php esc_html_e('Recent Donations', 'give'); ?></h3>
500 500
 		<?php
501
-		$payment_ids = explode( ',', $donor->payment_ids );
502
-		$payments    = give_get_payments( array(
501
+		$payment_ids = explode(',', $donor->payment_ids);
502
+		$payments    = give_get_payments(array(
503 503
 			'post__in' => $payment_ids,
504
-		) );
505
-		$payments    = array_slice( $payments, 0, 10 );
504
+		));
505
+		$payments    = array_slice($payments, 0, 10);
506 506
 		?>
507 507
 		<table class="wp-list-table widefat striped payments">
508 508
 			<thead>
509 509
 			<tr>
510
-				<th scope="col"><?php esc_html_e( 'ID', 'give' ); ?></th>
511
-				<th scope="col"><?php esc_html_e( 'Amount', 'give' ); ?></th>
512
-				<th scope="col"><?php esc_html_e( 'Date', 'give' ); ?></th>
513
-				<th scope="col"><?php esc_html_e( 'Status', 'give' ); ?></th>
514
-				<th scope="col"><?php esc_html_e( 'Actions', 'give' ); ?></th>
510
+				<th scope="col"><?php esc_html_e('ID', 'give'); ?></th>
511
+				<th scope="col"><?php esc_html_e('Amount', 'give'); ?></th>
512
+				<th scope="col"><?php esc_html_e('Date', 'give'); ?></th>
513
+				<th scope="col"><?php esc_html_e('Status', 'give'); ?></th>
514
+				<th scope="col"><?php esc_html_e('Actions', 'give'); ?></th>
515 515
 			</tr>
516 516
 			</thead>
517 517
 			<tbody>
518
-			<?php if ( ! empty( $payments ) ) { ?>
519
-				<?php foreach ( $payments as $payment ) : ?>
518
+			<?php if ( ! empty($payments)) { ?>
519
+				<?php foreach ($payments as $payment) : ?>
520 520
 					<tr>
521 521
 						<td><?php echo $payment->ID; ?></td>
522
-						<td><?php echo give_payment_amount( $payment->ID ); ?></td>
523
-						<td><?php echo date_i18n( give_date_format(), strtotime( $payment->post_date ) ); ?></td>
524
-						<td><?php echo give_get_payment_status( $payment, true ); ?></td>
522
+						<td><?php echo give_payment_amount($payment->ID); ?></td>
523
+						<td><?php echo date_i18n(give_date_format(), strtotime($payment->post_date)); ?></td>
524
+						<td><?php echo give_get_payment_status($payment, true); ?></td>
525 525
 						<td>
526 526
 							<?php
527 527
 							printf(
528 528
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
529
-								admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment->ID ),
529
+								admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment->ID),
530 530
 								sprintf(
531 531
 									/* translators: %s: Donation ID */
532
-									esc_attr__( 'View Donation %s.', 'give' ),
532
+									esc_attr__('View Donation %s.', 'give'),
533 533
 									$payment->ID
534 534
 								),
535
-								esc_html__( 'View Donation', 'give' )
535
+								esc_html__('View Donation', 'give')
536 536
 							);
537 537
 							?>
538 538
 
@@ -547,47 +547,47 @@  discard block
 block discarded – undo
547 547
 							 * @param object $donor The donor object being displayed.
548 548
 							 * @param object $payment  The payment object being displayed.
549 549
 							 */
550
-							do_action( 'give_donor_recent_purchases_actions', $donor, $payment );
550
+							do_action('give_donor_recent_purchases_actions', $donor, $payment);
551 551
 							?>
552 552
 						</td>
553 553
 					</tr>
554 554
 				<?php endforeach; ?>
555 555
 			<?php } else { ?>
556 556
 				<tr>
557
-					<td colspan="5"><?php esc_html_e( 'No donations found.', 'give' ); ?></td>
557
+					<td colspan="5"><?php esc_html_e('No donations found.', 'give'); ?></td>
558 558
 				</tr>
559 559
 			<?php }// End if().
560 560
 	?>
561 561
 			</tbody>
562 562
 		</table>
563 563
 
564
-		<h3><?php esc_html_e( 'Completed Forms', 'give' ); ?></h3>
564
+		<h3><?php esc_html_e('Completed Forms', 'give'); ?></h3>
565 565
 		<?php
566
-		$donations = give_get_users_completed_donations( $donor->email );
566
+		$donations = give_get_users_completed_donations($donor->email);
567 567
 		?>
568 568
 		<table class="wp-list-table widefat striped donations">
569 569
 			<thead>
570 570
 			<tr>
571
-				<th scope="col"><?php esc_html_e( 'Form', 'give' ); ?></th>
572
-				<th scope="col" width="120px"><?php esc_html_e( 'Actions', 'give' ); ?></th>
571
+				<th scope="col"><?php esc_html_e('Form', 'give'); ?></th>
572
+				<th scope="col" width="120px"><?php esc_html_e('Actions', 'give'); ?></th>
573 573
 			</tr>
574 574
 			</thead>
575 575
 			<tbody>
576
-			<?php if ( ! empty( $donations ) ) { ?>
577
-				<?php foreach ( $donations as $donation ) : ?>
576
+			<?php if ( ! empty($donations)) { ?>
577
+				<?php foreach ($donations as $donation) : ?>
578 578
 					<tr>
579 579
 						<td><?php echo $donation->post_title; ?></td>
580 580
 						<td>
581 581
 							<?php
582 582
 							printf(
583 583
 								'<a href="%1$s" aria-label="%2$s">%3$s</a>',
584
-								esc_url( admin_url( 'post.php?action=edit&post=' . $donation->ID ) ),
584
+								esc_url(admin_url('post.php?action=edit&post='.$donation->ID)),
585 585
 								sprintf(
586 586
 									/* translators: %s: form name */
587
-									esc_attr__( 'View Form %s.', 'give' ),
587
+									esc_attr__('View Form %s.', 'give'),
588 588
 									$donation->post_title
589 589
 								),
590
-								esc_html__( 'View Form', 'give' )
590
+								esc_html__('View Form', 'give')
591 591
 							);
592 592
 							?>
593 593
 						</td>
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 				<?php endforeach; ?>
596 596
 			<?php } else { ?>
597 597
 				<tr>
598
-					<td colspan="2"><?php esc_html_e( 'No completed donations found.', 'give' ); ?></td>
598
+					<td colspan="2"><?php esc_html_e('No completed donations found.', 'give'); ?></td>
599 599
 				</tr>
600 600
 			<?php } ?>
601 601
 			</tbody>
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 		 *
610 610
 		 * @param object $donor The donor object being displayed.
611 611
 		 */
612
-		do_action( 'give_donor_after_tables', $donor );
612
+		do_action('give_donor_after_tables', $donor);
613 613
 		?>
614 614
 
615 615
 	</div>
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	 *
623 623
 	 * @param object $donor The donor object being displayed.
624 624
 	 */
625
-	do_action( 'give_donor_card_bottom', $donor );
625
+	do_action('give_donor_card_bottom', $donor);
626 626
 
627 627
 }
628 628
 
@@ -635,30 +635,30 @@  discard block
 block discarded – undo
635 635
  *
636 636
  * @return void
637 637
  */
638
-function give_donor_notes_view( $donor ) {
638
+function give_donor_notes_view($donor) {
639 639
 
640
-	$paged          = isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) ? $_GET['paged'] : 1;
641
-	$paged          = absint( $paged );
640
+	$paged          = isset($_GET['paged']) && is_numeric($_GET['paged']) ? $_GET['paged'] : 1;
641
+	$paged          = absint($paged);
642 642
 	$note_count     = $donor->get_notes_count();
643
-	$per_page       = apply_filters( 'give_donor_notes_per_page', 20 );
644
-	$total_pages    = ceil( $note_count / $per_page );
645
-	$donor_notes = $donor->get_notes( $per_page, $paged );
643
+	$per_page       = apply_filters('give_donor_notes_per_page', 20);
644
+	$total_pages    = ceil($note_count / $per_page);
645
+	$donor_notes = $donor->get_notes($per_page, $paged);
646 646
 	?>
647 647
 
648 648
 	<div id="donor-notes-wrapper">
649 649
 		<div class="donor-notes-header">
650
-			<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
650
+			<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
651 651
 		</div>
652
-		<h3><?php esc_html_e( 'Notes', 'give' ); ?></h3>
652
+		<h3><?php esc_html_e('Notes', 'give'); ?></h3>
653 653
 
654
-		<?php if ( 1 == $paged ) : ?>
654
+		<?php if (1 == $paged) : ?>
655 655
 			<div style="display: block; margin-bottom: 55px;">
656
-				<form id="give-add-donor-note" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=notes&id=' . $donor->id ); ?>">
656
+				<form id="give-add-donor-note" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=notes&id='.$donor->id); ?>">
657 657
 					<textarea id="donor-note" name="donor_note" class="donor-note-input" rows="10"></textarea>
658 658
 					<br />
659 659
 					<input type="hidden" id="donor-id" name="customer_id" value="<?php echo $donor->id; ?>" />
660 660
 					<input type="hidden" name="give_action" value="add-donor-note" />
661
-					<?php wp_nonce_field( 'add-donor-note', 'add_donor_note_nonce', true, true ); ?>
661
+					<?php wp_nonce_field('add-donor-note', 'add_donor_note_nonce', true, true); ?>
662 662
 					<input id="add-donor-note" class="right button-primary" type="submit" value="Add Note" />
663 663
 				</form>
664 664
 			</div>
@@ -673,26 +673,26 @@  discard block
 block discarded – undo
673 673
 			'show_all' => true,
674 674
 		);
675 675
 
676
-		echo paginate_links( $pagination_args );
676
+		echo paginate_links($pagination_args);
677 677
 		?>
678 678
 
679 679
 		<div id="give-donor-notes" class="postbox">
680
-			<?php if ( count( $donor_notes ) > 0 ) { ?>
681
-				<?php foreach ( $donor_notes as $key => $note ) : ?>
680
+			<?php if (count($donor_notes) > 0) { ?>
681
+				<?php foreach ($donor_notes as $key => $note) : ?>
682 682
 					<div class="donor-note-wrapper dashboard-comment-wrap comment-item">
683 683
 					<span class="note-content-wrap">
684
-						<?php echo stripslashes( $note ); ?>
684
+						<?php echo stripslashes($note); ?>
685 685
 					</span>
686 686
 					</div>
687 687
 				<?php endforeach; ?>
688 688
 			<?php } else { ?>
689 689
 				<div class="give-no-donor-notes">
690
-					<?php esc_html_e( 'No donor notes found.', 'give' ); ?>
690
+					<?php esc_html_e('No donor notes found.', 'give'); ?>
691 691
 				</div>
692 692
 			<?php } ?>
693 693
 		</div>
694 694
 
695
-		<?php echo paginate_links( $pagination_args ); ?>
695
+		<?php echo paginate_links($pagination_args); ?>
696 696
 
697 697
 	</div>
698 698
 
@@ -708,9 +708,9 @@  discard block
 block discarded – undo
708 708
  *
709 709
  * @return void
710 710
  */
711
-function give_donor_delete_view( $donor ) {
711
+function give_donor_delete_view($donor) {
712 712
 
713
-	$donor_edit_role = apply_filters( 'give_edit_donors_role', 'edit_give_payments' );
713
+	$donor_edit_role = apply_filters('give_edit_donors_role', 'edit_give_payments');
714 714
 
715 715
 	/**
716 716
 	 * Fires in donor delete screen, above the content.
@@ -719,15 +719,15 @@  discard block
 block discarded – undo
719 719
 	 *
720 720
 	 * @param object $donor The donor object being displayed.
721 721
 	 */
722
-	do_action( 'give_donor_delete_top', $donor );
722
+	do_action('give_donor_delete_top', $donor);
723 723
 	?>
724 724
 
725 725
 	<div class="info-wrapper donor-section">
726 726
 
727
-		<form id="delete-donor" method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $donor->id ); ?>">
727
+		<form id="delete-donor" method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$donor->id); ?>">
728 728
 
729 729
 			<div class="donor-notes-header">
730
-				<?php echo get_avatar( $donor->email, 30 ); ?> <span><?php echo $donor->name; ?></span>
730
+				<?php echo get_avatar($donor->email, 30); ?> <span><?php echo $donor->name; ?></span>
731 731
 			</div>
732 732
 
733 733
 
@@ -735,20 +735,20 @@  discard block
 block discarded – undo
735 735
 
736 736
 				<span class="delete-donor-options">
737 737
 					<p>
738
-						<?php echo Give()->html->checkbox( array(
738
+						<?php echo Give()->html->checkbox(array(
739 739
 							'name' => 'give-donor-delete-confirm',
740
-						) ); ?>
741
-						<label for="give-donor-delete-confirm"><?php esc_html_e( 'Are you sure you want to delete this donor?', 'give' ); ?></label>
740
+						)); ?>
741
+						<label for="give-donor-delete-confirm"><?php esc_html_e('Are you sure you want to delete this donor?', 'give'); ?></label>
742 742
 					</p>
743 743
 
744 744
 					<p>
745
-						<?php echo Give()->html->checkbox( array(
745
+						<?php echo Give()->html->checkbox(array(
746 746
 							'name'    => 'give-donor-delete-records',
747 747
 							'options' => array(
748 748
 								'disabled' => true,
749 749
 							),
750
-						) ); ?>
751
-						<label for="give-donor-delete-records"><?php esc_html_e( 'Delete all associated donations and records?', 'give' ); ?></label>
750
+						)); ?>
751
+						<label for="give-donor-delete-records"><?php esc_html_e('Delete all associated donations and records?', 'give'); ?></label>
752 752
 					</p>
753 753
 
754 754
 					<?php
@@ -761,16 +761,16 @@  discard block
 block discarded – undo
761 761
 					 *
762 762
 					 * @param object $donor The donor object being displayed.
763 763
 					 */
764
-					do_action( 'give_donor_delete_inputs', $donor );
764
+					do_action('give_donor_delete_inputs', $donor);
765 765
 					?>
766 766
 				</span>
767 767
 
768 768
 				<span id="donor-edit-actions">
769 769
 					<input type="hidden" name="customer_id" value="<?php echo $donor->id; ?>" />
770
-					<?php wp_nonce_field( 'delete-donor', '_wpnonce', false, true ); ?>
770
+					<?php wp_nonce_field('delete-donor', '_wpnonce', false, true); ?>
771 771
 					<input type="hidden" name="give_action" value="delete-donor" />
772
-					<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php esc_attr_e( 'Delete Donor', 'give' ); ?>" />
773
-					<a id="give-delete-donor-cancel" href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>" class="delete"><?php esc_html_e( 'Cancel', 'give' ); ?></a>
772
+					<input type="submit" disabled="disabled" id="give-delete-donor" class="button-primary" value="<?php esc_attr_e('Delete Donor', 'give'); ?>" />
773
+					<a id="give-delete-donor-cancel" href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>" class="delete"><?php esc_html_e('Cancel', 'give'); ?></a>
774 774
 				</span>
775 775
 
776 776
 			</div>
@@ -786,5 +786,5 @@  discard block
 block discarded – undo
786 786
 	 *
787 787
 	 * @param object $donor The donor object being displayed.
788 788
 	 */
789
-	do_action( 'give_donor_delete_bottom', $donor );
789
+	do_action('give_donor_delete_bottom', $donor);
790 790
 }
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 1 patch
Spacing   +296 added lines, -296 removed lines patch added patch discarded remove patch
@@ -46,21 +46,21 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = __( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = __('Donation Form Options', 'give');
50 50
 
51 51
 		// Setup.
52
-		add_action( 'admin_init', array( $this, 'setup' ) );
52
+		add_action('admin_init', array($this, 'setup'));
53 53
 
54 54
 		// Add metabox.
55
-		add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 10 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 10);
56 56
 
57 57
 		// Save form meta.
58
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
58
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
59 59
 
60 60
 		// cmb2 old setting loaders.
61 61
 		// add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
62 62
 		// Add offline donations options.
63
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
63
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
64 64
 	}
65 65
 
66 66
 
@@ -83,24 +83,24 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	function get_settings() {
85 85
 		$post_id               = give_get_admin_post_id();
86
-		$price                 = give_get_form_price( $post_id );
87
-		$custom_amount_minimum = give_get_form_minimum_price( $post_id );
88
-		$goal                  = give_format_amount( give_get_form_goal( $post_id ), array( 'sanitize' => false ) );
89
-		$price_placeholder     = give_format_decimal( '1.00', false, false );
86
+		$price                 = give_get_form_price($post_id);
87
+		$custom_amount_minimum = give_get_form_minimum_price($post_id);
88
+		$goal                  = give_format_amount(give_get_form_goal($post_id), array('sanitize' => false));
89
+		$price_placeholder     = give_format_decimal('1.00', false, false);
90 90
 
91 91
 		// No empty prices - min. 1.00 for new forms
92
-		if ( empty( $price ) && is_null( $post_id ) ) {
92
+		if (empty($price) && is_null($post_id)) {
93 93
 			$price = '1.00';
94 94
 		}
95 95
 
96 96
 		// Min. $1.00 for new forms
97
-		if ( empty( $custom_amount_minimum ) ) {
97
+		if (empty($custom_amount_minimum)) {
98 98
 			$custom_amount_minimum = '1.00';
99 99
 		}
100 100
 
101 101
 		// Format amounts.
102
-		$price = give_format_amount( $price, array( 'sanitize' => false ) );
103
-		$custom_amount_minimum = give_format_amount( $custom_amount_minimum, array( 'sanitize' => false ) );
102
+		$price = give_format_amount($price, array('sanitize' => false));
103
+		$custom_amount_minimum = give_format_amount($custom_amount_minimum, array('sanitize' => false));
104 104
 
105 105
 		// Start with an underscore to hide fields from custom fields list
106 106
 		$prefix = '_give_';
@@ -109,27 +109,27 @@  discard block
 block discarded – undo
109 109
 			/**
110 110
 			 * Repeatable Field Groups
111 111
 			 */
112
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
112
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
113 113
 				'id'        => 'form_field_options',
114
-				'title'     => __( 'Donation Options', 'give' ),
114
+				'title'     => __('Donation Options', 'give'),
115 115
 				'icon-html' => '<span class="give-icon give-icon-heart"></span>',
116
-				'fields'    => apply_filters( 'give_forms_donation_form_metabox_fields', array(
116
+				'fields'    => apply_filters('give_forms_donation_form_metabox_fields', array(
117 117
 					// Donation Option
118 118
 					array(
119
-						'name'        => __( 'Donation Option', 'give' ),
120
-						'description' => __( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
121
-						'id'          => $prefix . 'price_option',
119
+						'name'        => __('Donation Option', 'give'),
120
+						'description' => __('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
121
+						'id'          => $prefix.'price_option',
122 122
 						'type'        => 'radio_inline',
123 123
 						'default'     => 'set',
124
-						'options'     => apply_filters( 'give_forms_price_options', array(
125
-							'set'   => __( 'Set Donation', 'give' ),
126
-							'multi' => __( 'Multi-level Donation', 'give' ),
127
-						) ),
124
+						'options'     => apply_filters('give_forms_price_options', array(
125
+							'set'   => __('Set Donation', 'give'),
126
+							'multi' => __('Multi-level Donation', 'give'),
127
+						)),
128 128
 					),
129 129
 					array(
130
-						'name'        => __( 'Set Donation', 'give' ),
131
-						'description' => __( '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' ),
132
-						'id'          => $prefix . 'set_price',
130
+						'name'        => __('Set Donation', 'give'),
131
+						'description' => __('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'),
132
+						'id'          => $prefix.'set_price',
133 133
 						'type'        => 'text_small',
134 134
 						'data_type'   => 'price',
135 135
 						'attributes'  => array(
@@ -140,33 +140,33 @@  discard block
 block discarded – undo
140 140
 					),
141 141
 					// Display Style
142 142
 					array(
143
-						'name'        => __( 'Display Style', 'give' ),
144
-						'description' => __( 'Set how the donations levels will display on the form.', 'give' ),
145
-						'id'          => $prefix . 'display_style',
143
+						'name'        => __('Display Style', 'give'),
144
+						'description' => __('Set how the donations levels will display on the form.', 'give'),
145
+						'id'          => $prefix.'display_style',
146 146
 						'type'        => 'radio_inline',
147 147
 						'default'     => 'buttons',
148 148
 						'options'     => array(
149
-							'buttons'  => __( 'Buttons', 'give' ),
150
-							'radios'   => __( 'Radios', 'give' ),
151
-							'dropdown' => __( 'Dropdown', 'give' ),
149
+							'buttons'  => __('Buttons', 'give'),
150
+							'radios'   => __('Radios', 'give'),
151
+							'dropdown' => __('Dropdown', 'give'),
152 152
 						),
153 153
 					),
154 154
 					// Custom Amount
155 155
 					array(
156
-						'name'        => __( 'Custom Amount', 'give' ),
157
-						'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ),
158
-						'id'          => $prefix . 'custom_amount',
156
+						'name'        => __('Custom Amount', 'give'),
157
+						'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
158
+						'id'          => $prefix.'custom_amount',
159 159
 						'type'        => 'radio_inline',
160 160
 						'default'     => 'disabled',
161 161
 						'options'     => array(
162
-							'enabled'  => __( 'Enabled', 'give' ),
163
-							'disabled' => __( 'Disabled', 'give' ),
162
+							'enabled'  => __('Enabled', 'give'),
163
+							'disabled' => __('Disabled', 'give'),
164 164
 						),
165 165
 					),
166 166
 					array(
167
-						'name'        => __( 'Minimum Amount', 'give' ),
168
-						'description' => __( 'Enter the minimum custom donation amount.', 'give' ),
169
-						'id'          => $prefix . 'custom_amount_minimum',
167
+						'name'        => __('Minimum Amount', 'give'),
168
+						'description' => __('Enter the minimum custom donation amount.', 'give'),
169
+						'id'          => $prefix.'custom_amount_minimum',
170 170
 						'type'        => 'text_small',
171 171
 						'data_type'   => 'price',
172 172
 						'attributes'  => array(
@@ -176,35 +176,35 @@  discard block
 block discarded – undo
176 176
 						),
177 177
 					),
178 178
 					array(
179
-						'name'        => __( 'Custom Amount Text', 'give' ),
180
-						'description' => __( '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' ),
181
-						'id'          => $prefix . 'custom_amount_text',
179
+						'name'        => __('Custom Amount Text', 'give'),
180
+						'description' => __('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'),
181
+						'id'          => $prefix.'custom_amount_text',
182 182
 						'type'        => 'text_medium',
183 183
 						'attributes'  => array(
184 184
 							'rows'        => 3,
185
-							'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
185
+							'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
186 186
 						),
187 187
 					),
188 188
 					// Donation Levels: Repeatable CMB2 Group
189 189
 					array(
190
-						'id'      => $prefix . 'donation_levels',
190
+						'id'      => $prefix.'donation_levels',
191 191
 						'type'    => 'group',
192 192
 						'options' => array(
193
-							'add_button'    => __( 'Add Level', 'give' ),
194
-							'header_title'  => __( 'Donation Level', 'give' ),
193
+							'add_button'    => __('Add Level', 'give'),
194
+							'header_title'  => __('Donation Level', 'give'),
195 195
 							'remove_button' => '<span class="dashicons dashicons-no"></span>',
196 196
 						),
197 197
 						// Fields array works the same, except id's only need to be unique for this group.
198 198
 						// Prefix is not needed.
199
-						'fields'  => apply_filters( 'give_donation_levels_table_row', array(
199
+						'fields'  => apply_filters('give_donation_levels_table_row', array(
200 200
 							array(
201
-								'name' => __( 'ID', 'give' ),
202
-								'id'   => $prefix . 'id',
201
+								'name' => __('ID', 'give'),
202
+								'id'   => $prefix.'id',
203 203
 								'type' => 'levels_id',
204 204
 							),
205 205
 							array(
206
-								'name'       => __( 'Amount', 'give' ),
207
-								'id'         => $prefix . 'amount',
206
+								'name'       => __('Amount', 'give'),
207
+								'id'         => $prefix.'amount',
208 208
 								'type'       => 'text_small',
209 209
 								'data_type'  => 'price',
210 210
 								'attributes' => array(
@@ -213,111 +213,111 @@  discard block
 block discarded – undo
213 213
 								),
214 214
 							),
215 215
 							array(
216
-								'name'       => __( 'Text', 'give' ),
217
-								'id'         => $prefix . 'text',
216
+								'name'       => __('Text', 'give'),
217
+								'id'         => $prefix.'text',
218 218
 								'type'       => 'text',
219 219
 								'attributes' => array(
220
-									'placeholder' => __( 'Donation Level', 'give' ),
220
+									'placeholder' => __('Donation Level', 'give'),
221 221
 									'class'       => 'give-multilevel-text-field',
222 222
 								),
223 223
 							),
224 224
 							array(
225
-								'name' => __( 'Default', 'give' ),
226
-								'id'   => $prefix . 'default',
225
+								'name' => __('Default', 'give'),
226
+								'id'   => $prefix.'default',
227 227
 								'type' => 'give_default_radio_inline',
228 228
 							),
229
-						) ),
229
+						)),
230 230
 					),
231 231
 					array(
232 232
 						'name'  => 'donation_options_docs',
233 233
 						'type'  => 'docs_link',
234 234
 						'url'   => 'http://docs.givewp.com/form-donation-options',
235
-						'title' => __( 'Donation Options', 'give' ),
235
+						'title' => __('Donation Options', 'give'),
236 236
 					),
237 237
 				),
238 238
 					$post_id
239 239
 				),
240
-			) ),
240
+			)),
241 241
 
242 242
 			/**
243 243
 			 * Display Options
244 244
 			 */
245
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
245
+			'form_display_options'  => apply_filters('give_form_display_options', array(
246 246
 					'id'        => 'form_display_options',
247
-					'title'     => __( 'Form Display', 'give' ),
247
+					'title'     => __('Form Display', 'give'),
248 248
 					'icon-html' => '<span class="give-icon give-icon-display"></span>',
249
-					'fields'    => apply_filters( 'give_forms_display_options_metabox_fields', array(
249
+					'fields'    => apply_filters('give_forms_display_options_metabox_fields', array(
250 250
 						array(
251
-							'name'    => __( 'Display Options', 'give' ),
252
-							'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
253
-							'id'      => $prefix . 'payment_display',
251
+							'name'    => __('Display Options', 'give'),
252
+							'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
253
+							'id'      => $prefix.'payment_display',
254 254
 							'type'    => 'radio_inline',
255 255
 							'options' => array(
256
-								'onpage' => __( 'All Fields', 'give' ),
257
-								'modal'  => __( 'Modal', 'give' ),
258
-								'reveal' => __( 'Reveal', 'give' ),
259
-								'button' => __( 'Button', 'give' ),
256
+								'onpage' => __('All Fields', 'give'),
257
+								'modal'  => __('Modal', 'give'),
258
+								'reveal' => __('Reveal', 'give'),
259
+								'button' => __('Button', 'give'),
260 260
 							),
261 261
 							'default' => 'onpage',
262 262
 						),
263 263
 						array(
264
-							'id'         => $prefix . 'reveal_label',
265
-							'name'       => __( 'Continue Button', 'give' ),
266
-							'desc'       => __( 'The button label for displaying the additional payment fields.', 'give' ),
264
+							'id'         => $prefix.'reveal_label',
265
+							'name'       => __('Continue Button', 'give'),
266
+							'desc'       => __('The button label for displaying the additional payment fields.', 'give'),
267 267
 							'type'       => 'text_small',
268 268
 							'attributes' => array(
269
-								'placeholder' => esc_attr__( 'Donate Now', 'give' ),
269
+								'placeholder' => esc_attr__('Donate Now', 'give'),
270 270
 							),
271 271
 						),
272 272
 						array(
273
-							'id'         => $prefix . 'checkout_label',
274
-							'name'       => __( 'Submit Button', 'give' ),
275
-							'desc'       => __( 'The button label for completing a donation.', 'give' ),
273
+							'id'         => $prefix.'checkout_label',
274
+							'name'       => __('Submit Button', 'give'),
275
+							'desc'       => __('The button label for completing a donation.', 'give'),
276 276
 							'type'       => 'text_small',
277 277
 							'attributes' => array(
278
-								'placeholder' => __( 'Donate Now', 'give' ),
278
+								'placeholder' => __('Donate Now', 'give'),
279 279
 							),
280 280
 						),
281 281
 						array(
282
-							'name' => __( 'Default Gateway', 'give' ),
283
-							'desc' => __( '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' ),
284
-							'id'   => $prefix . 'default_gateway',
282
+							'name' => __('Default Gateway', 'give'),
283
+							'desc' => __('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'),
284
+							'id'   => $prefix.'default_gateway',
285 285
 							'type' => 'default_gateway',
286 286
 						),
287 287
 						array(
288
-							'name'    => __( 'Guest Donations', 'give' ),
289
-							'desc'    => __( 'Do you want to allow non-logged-in users to make donations?', 'give' ),
290
-							'id'      => $prefix . 'logged_in_only',
288
+							'name'    => __('Guest Donations', 'give'),
289
+							'desc'    => __('Do you want to allow non-logged-in users to make donations?', 'give'),
290
+							'id'      => $prefix.'logged_in_only',
291 291
 							'type'    => 'radio_inline',
292 292
 							'default' => 'enabled',
293 293
 							'options' => array(
294
-								'enabled'  => __( 'Enabled', 'give' ),
295
-								'disabled' => __( 'Disabled', 'give' ),
294
+								'enabled'  => __('Enabled', 'give'),
295
+								'disabled' => __('Disabled', 'give'),
296 296
 							),
297 297
 						),
298 298
 						array(
299
-							'name'    => __( 'Registration', 'give' ),
300
-							'desc'    => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
301
-							'id'      => $prefix . 'show_register_form',
299
+							'name'    => __('Registration', 'give'),
300
+							'desc'    => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
301
+							'id'      => $prefix.'show_register_form',
302 302
 							'type'    => 'radio',
303 303
 							'options' => array(
304
-								'none'         => __( 'None', 'give' ),
305
-								'registration' => __( 'Registration', 'give' ),
306
-								'login'        => __( 'Login', 'give' ),
307
-								'both'         => __( 'Registration + Login', 'give' ),
304
+								'none'         => __('None', 'give'),
305
+								'registration' => __('Registration', 'give'),
306
+								'login'        => __('Login', 'give'),
307
+								'both'         => __('Registration + Login', 'give'),
308 308
 							),
309 309
 							'default' => 'none',
310 310
 						),
311 311
 						array(
312
-							'name'    => __( 'Floating Labels', 'give' ),
312
+							'name'    => __('Floating Labels', 'give'),
313 313
 							/* translators: %s: forms http://docs.givewp.com/form-floating-labels */
314
-							'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ),
315
-							'id'      => $prefix . 'form_floating_labels',
314
+							'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')),
315
+							'id'      => $prefix.'form_floating_labels',
316 316
 							'type'    => 'radio_inline',
317 317
 							'options' => array(
318
-								'global'   => __( 'Global Option', 'give' ),
319
-								'enabled'  => __( 'Enabled', 'give' ),
320
-								'disabled' => __( 'Disabled', 'give' ),
318
+								'global'   => __('Global Option', 'give'),
319
+								'enabled'  => __('Enabled', 'give'),
320
+								'disabled' => __('Disabled', 'give'),
321 321
 							),
322 322
 							'default' => 'global',
323 323
 						),
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 							'name'  => 'form_display_docs',
326 326
 							'type'  => 'docs_link',
327 327
 							'url'   => 'http://docs.givewp.com/form-display-options',
328
-							'title' => __( 'Form Display', 'give' ),
328
+							'title' => __('Form Display', 'give'),
329 329
 						),
330 330
 					),
331 331
 						$post_id
@@ -336,172 +336,172 @@  discard block
 block discarded – undo
336 336
 			/**
337 337
 			 * Donation Goals
338 338
 			 */
339
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
339
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
340 340
 				'id'        => 'donation_goal_options',
341
-				'title'     => __( 'Donation Goal', 'give' ),
341
+				'title'     => __('Donation Goal', 'give'),
342 342
 				'icon-html' => '<span class="give-icon give-icon-target"></span>',
343
-				'fields'    => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
343
+				'fields'    => apply_filters('give_forms_donation_goal_metabox_fields', array(
344 344
 					// Goals
345 345
 					array(
346
-						'name'        => __( 'Donation Goal', 'give' ),
347
-						'description' => __( 'Do you want to set a donation goal for this form?', 'give' ),
348
-						'id'          => $prefix . 'goal_option',
346
+						'name'        => __('Donation Goal', 'give'),
347
+						'description' => __('Do you want to set a donation goal for this form?', 'give'),
348
+						'id'          => $prefix.'goal_option',
349 349
 						'type'        => 'radio_inline',
350 350
 						'default'     => 'disabled',
351 351
 						'options'     => array(
352
-							'enabled'  => __( 'Enabled', 'give' ),
353
-							'disabled' => __( 'Disabled', 'give' ),
352
+							'enabled'  => __('Enabled', 'give'),
353
+							'disabled' => __('Disabled', 'give'),
354 354
 						),
355 355
 					),
356 356
 					array(
357
-						'name'        => __( 'Goal Amount', 'give' ),
358
-						'description' => __( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
359
-						'id'          => $prefix . 'set_goal',
357
+						'name'        => __('Goal Amount', 'give'),
358
+						'description' => __('This is the monetary goal amount you want to reach for this form.', 'give'),
359
+						'id'          => $prefix.'set_goal',
360 360
 						'type'        => 'text_small',
361 361
 						'data_type'   => 'price',
362 362
 						'attributes'  => array(
363
-							'placeholder' => give_format_decimal( '0.00', false, false ),
363
+							'placeholder' => give_format_decimal('0.00', false, false),
364 364
 							'value'       => $goal,
365 365
 							'class'       => 'give-money-field',
366 366
 						),
367 367
 					),
368 368
 
369 369
 					array(
370
-						'name'        => __( 'Goal Format', 'give' ),
371
-						'description' => __( 'Do you want 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' ),
372
-						'id'          => $prefix . 'goal_format',
370
+						'name'        => __('Goal Format', 'give'),
371
+						'description' => __('Do you want 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'),
372
+						'id'          => $prefix.'goal_format',
373 373
 						'type'        => 'radio_inline',
374 374
 						'default'     => 'amount',
375 375
 						'options'     => array(
376
-							'amount'     => __( 'Amount', 'give' ),
377
-							'percentage' => __( 'Percentage', 'give' ),
376
+							'amount'     => __('Amount', 'give'),
377
+							'percentage' => __('Percentage', 'give'),
378 378
 						),
379 379
 					),
380 380
 					array(
381
-						'name'    => __( 'Progress Bar Color', 'give' ),
382
-						'desc'    => __( 'Customize the color of the goal progress bar.', 'give' ),
383
-						'id'      => $prefix . 'goal_color',
381
+						'name'    => __('Progress Bar Color', 'give'),
382
+						'desc'    => __('Customize the color of the goal progress bar.', 'give'),
383
+						'id'      => $prefix.'goal_color',
384 384
 						'type'    => 'colorpicker',
385 385
 						'default' => '#2bc253',
386 386
 					),
387 387
 
388 388
 					array(
389
-						'name'    => __( 'Close Form', 'give' ),
390
-						'desc'    => __( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
391
-						'id'      => $prefix . 'close_form_when_goal_achieved',
389
+						'name'    => __('Close Form', 'give'),
390
+						'desc'    => __('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
391
+						'id'      => $prefix.'close_form_when_goal_achieved',
392 392
 						'type'    => 'radio_inline',
393 393
 						'default' => 'disabled',
394 394
 						'options' => array(
395
-							'enabled'  => __( 'Enabled', 'give' ),
396
-							'disabled' => __( 'Disabled', 'give' ),
395
+							'enabled'  => __('Enabled', 'give'),
396
+							'disabled' => __('Disabled', 'give'),
397 397
 						),
398 398
 					),
399 399
 					array(
400
-						'name'       => __( 'Goal Achieved Message', 'give' ),
401
-						'desc'       => __( 'Do you want to display a custom message when the goal is closed?', 'give' ),
402
-						'id'         => $prefix . 'form_goal_achieved_message',
400
+						'name'       => __('Goal Achieved Message', 'give'),
401
+						'desc'       => __('Do you want to display a custom message when the goal is closed?', 'give'),
402
+						'id'         => $prefix.'form_goal_achieved_message',
403 403
 						'type'       => 'wysiwyg',
404
-                        'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
404
+                        'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
405 405
 					),
406 406
 					array(
407 407
 						'name'  => 'donation_goal_docs',
408 408
 						'type'  => 'docs_link',
409 409
 						'url'   => 'http://docs.givewp.com/form-donation-goal',
410
-						'title' => __( 'Donation Goal', 'give' ),
410
+						'title' => __('Donation Goal', 'give'),
411 411
 					),
412 412
 				),
413 413
 					$post_id
414 414
 				),
415
-			) ),
415
+			)),
416 416
 
417 417
 			/**
418 418
 			 * Content Field
419 419
 			 */
420
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
420
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
421 421
 				'id'        => 'form_content_options',
422
-				'title'     => __( 'Form Content', 'give' ),
422
+				'title'     => __('Form Content', 'give'),
423 423
 				'icon-html' => '<span class="give-icon give-icon-edit"></span>',
424
-				'fields'    => apply_filters( 'give_forms_content_options_metabox_fields', array(
424
+				'fields'    => apply_filters('give_forms_content_options_metabox_fields', array(
425 425
 
426 426
 					// Donation content.
427 427
 					array(
428
-						'name'        => __( 'Display Content', 'give' ),
429
-						'description' => __( 'Do you want to add custom content to this form?', 'give' ),
430
-						'id'          => $prefix . 'display_content',
428
+						'name'        => __('Display Content', 'give'),
429
+						'description' => __('Do you want to add custom content to this form?', 'give'),
430
+						'id'          => $prefix.'display_content',
431 431
 						'type'        => 'radio_inline',
432 432
 						'options'     => array(
433
-							'enabled'  => __( 'Enabled', 'give' ),
434
-							'disabled' => __( 'Disabled', 'give' ),
433
+							'enabled'  => __('Enabled', 'give'),
434
+							'disabled' => __('Disabled', 'give'),
435 435
 						),
436 436
 						'default'     => 'disabled',
437 437
 					),
438 438
 
439 439
 					// Content placement.
440 440
 					array(
441
-						'name'        => __( 'Content Placement', 'give' ),
442
-						'description' => __( 'This option controls where the content appears within the donation form.', 'give' ),
443
-						'id'          => $prefix . 'content_placement',
441
+						'name'        => __('Content Placement', 'give'),
442
+						'description' => __('This option controls where the content appears within the donation form.', 'give'),
443
+						'id'          => $prefix.'content_placement',
444 444
 						'type'        => 'radio_inline',
445
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
446
-								'give_pre_form'  => __( 'Above fields', 'give' ),
447
-								'give_post_form' => __( 'Below fields', 'give' ),
445
+						'options'     => apply_filters('give_forms_content_options_select', array(
446
+								'give_pre_form'  => __('Above fields', 'give'),
447
+								'give_post_form' => __('Below fields', 'give'),
448 448
 							)
449 449
 						),
450 450
 						'default'     => 'give_pre_form',
451 451
 					),
452 452
 					array(
453
-						'name'        => __( 'Content', 'give' ),
454
-						'description' => __( 'This content will display on the single give form page.', 'give' ),
455
-						'id'          => $prefix . 'form_content',
453
+						'name'        => __('Content', 'give'),
454
+						'description' => __('This content will display on the single give form page.', 'give'),
455
+						'id'          => $prefix.'form_content',
456 456
 						'type'        => 'wysiwyg',
457 457
 					),
458 458
 					array(
459 459
 						'name'  => 'form_content_docs',
460 460
 						'type'  => 'docs_link',
461 461
 						'url'   => 'http://docs.givewp.com/form-content',
462
-						'title' => __( 'Form Content', 'give' ),
462
+						'title' => __('Form Content', 'give'),
463 463
 					),
464 464
 				),
465 465
 					$post_id
466 466
 				),
467
-			) ),
467
+			)),
468 468
 
469 469
 			/**
470 470
 			 * Terms & Conditions
471 471
 			 */
472
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
472
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
473 473
 				'id'        => 'form_terms_options',
474
-				'title'     => __( 'Terms & Conditions', 'give' ),
474
+				'title'     => __('Terms & Conditions', 'give'),
475 475
 				'icon-html' => '<span class="give-icon give-icon-checklist"></span>',
476
-				'fields'    => apply_filters( 'give_forms_terms_options_metabox_fields', array(
476
+				'fields'    => apply_filters('give_forms_terms_options_metabox_fields', array(
477 477
 					// Donation Option
478 478
 					array(
479
-						'name'        => __( 'Terms and Conditions', 'give' ),
480
-						'description' => __( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
481
-						'id'          => $prefix . 'terms_option',
479
+						'name'        => __('Terms and Conditions', 'give'),
480
+						'description' => __('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
481
+						'id'          => $prefix.'terms_option',
482 482
 						'type'        => 'radio_inline',
483
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
484
-								'global'   => __( 'Global Option', 'give' ),
485
-								'enabled'  => __( 'Customize', 'give' ),
486
-								'disabled' => __( 'Disable', 'give' ),
483
+						'options'     => apply_filters('give_forms_content_options_select', array(
484
+								'global'   => __('Global Option', 'give'),
485
+								'enabled'  => __('Customize', 'give'),
486
+								'disabled' => __('Disable', 'give'),
487 487
 							)
488 488
 						),
489 489
 						'default'     => 'global',
490 490
 					),
491 491
 					array(
492
-						'id'         => $prefix . 'agree_label',
493
-						'name'       => __( 'Agreement Label', 'give' ),
494
-						'desc'       => __( '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' ),
492
+						'id'         => $prefix.'agree_label',
493
+						'name'       => __('Agreement Label', 'give'),
494
+						'desc'       => __('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'),
495 495
 						'type'       => 'text',
496 496
 						'size'       => 'regular',
497 497
 						'attributes' => array(
498
-							'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
498
+							'placeholder' => esc_attr__('Agree to Terms?', 'give'),
499 499
 						),
500 500
 					),
501 501
 					array(
502
-						'id'   => $prefix . 'agree_text',
503
-						'name' => __( 'Agreement Text', 'give' ),
504
-						'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
502
+						'id'   => $prefix.'agree_text',
503
+						'name' => __('Agreement Text', 'give'),
504
+						'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
505 505
 						'default' => give_get_option('agreement_text'),
506 506
 						'type' => 'wysiwyg',
507 507
 					),
@@ -509,19 +509,19 @@  discard block
 block discarded – undo
509 509
 						'name'  => 'terms_docs',
510 510
 						'type'  => 'docs_link',
511 511
 						'url'   => 'http://docs.givewp.com/form-terms',
512
-						'title' => __( 'Terms and Conditions', 'give' ),
512
+						'title' => __('Terms and Conditions', 'give'),
513 513
 					),
514 514
 				),
515 515
 					$post_id
516 516
 				),
517
-			) ),
517
+			)),
518 518
 		);
519 519
 
520 520
 
521 521
 		/**
522 522
 		 * Filter the metabox tabbed panel settings.
523 523
 		 */
524
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id );
524
+		$settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id);
525 525
 
526 526
 		// Output.
527 527
 		return $settings;
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
 		add_meta_box(
538 538
 			$this->get_metabox_ID(),
539 539
 			$this->get_metabox_label(),
540
-			array( $this, 'output' ),
541
-			array( 'give_forms' ),
540
+			array($this, 'output'),
541
+			array('give_forms'),
542 542
 			'normal',
543 543
 			'high'
544 544
 		);
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 	function enqueue_script() {
555 555
 		global $post;
556 556
 
557
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
557
+		if (is_object($post) && 'give_forms' === $post->post_type) {
558 558
 
559 559
 		}
560 560
 	}
@@ -589,32 +589,32 @@  discard block
 block discarded – undo
589 589
 	public function get_tabs() {
590 590
 		$tabs = array();
591 591
 
592
-		if ( ! empty( $this->settings ) ) {
593
-			foreach ( $this->settings as $setting ) {
594
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
592
+		if ( ! empty($this->settings)) {
593
+			foreach ($this->settings as $setting) {
594
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
595 595
 					continue;
596 596
 				}
597 597
 				$tab = array(
598 598
 					'id'        => $setting['id'],
599 599
 					'label'     => $setting['title'],
600
-					'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ),
600
+					'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''),
601 601
 				);
602 602
 
603
-				if ( $this->has_sub_tab( $setting ) ) {
604
-					if ( empty( $setting['sub-fields'] ) ) {
603
+				if ($this->has_sub_tab($setting)) {
604
+					if (empty($setting['sub-fields'])) {
605 605
 						$tab = array();
606 606
 					} else {
607
-						foreach ( $setting['sub-fields'] as $sub_fields ) {
607
+						foreach ($setting['sub-fields'] as $sub_fields) {
608 608
 							$tab['sub-fields'][] = array(
609 609
 								'id'        => $sub_fields['id'],
610 610
 								'label'     => $sub_fields['title'],
611
-								'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ),
611
+								'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''),
612 612
 							);
613 613
 						}
614 614
 					}
615 615
 				}
616 616
 
617
-				if ( ! empty( $tab ) ) {
617
+				if ( ! empty($tab)) {
618 618
 					$tabs[] = $tab;
619 619
 				}
620 620
 			}
@@ -631,27 +631,27 @@  discard block
 block discarded – undo
631 631
 	 */
632 632
 	public function output() {
633 633
 		// Bailout.
634
-		if ( $form_data_tabs = $this->get_tabs() ) {
635
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
634
+		if ($form_data_tabs = $this->get_tabs()) {
635
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
636 636
 			?>
637 637
 			<div class="give-metabox-panel-wrap">
638 638
 				<ul class="give-form-data-tabs give-metabox-tabs">
639
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
640
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>">
639
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
640
+						<li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>">
641 641
 							<a href="#<?php echo $form_data_tab['id']; ?>">
642
-								<?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?>
642
+								<?php if ( ! empty($form_data_tab['icon-html'])) : ?>
643 643
 									<?php echo $form_data_tab['icon-html']; ?>
644 644
 								<?php else : ?>
645 645
 									<span class="give-icon give-icon-default"></span>
646 646
 								<?php endif; ?>
647 647
 								<span class="give-label"><?php echo $form_data_tab['label']; ?></span>
648 648
 							</a>
649
-							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
649
+							<?php if ($this->has_sub_tab($form_data_tab)) : ?>
650 650
 								<ul class="give-metabox-sub-tabs give-hidden">
651
-									<?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?>
651
+									<?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?>
652 652
 										<li class="<?php echo "{$sub_tab['id']}_tab"; ?>">
653 653
 											<a href="#<?php echo $sub_tab['id']; ?>">
654
-												<?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?>
654
+												<?php if ( ! empty($sub_tab['icon-html'])) : ?>
655 655
 													<?php echo $sub_tab['icon-html']; ?>
656 656
 												<?php else : ?>
657 657
 													<span class="give-icon give-icon-default"></span>
@@ -667,30 +667,30 @@  discard block
 block discarded – undo
667 667
 				</ul>
668 668
 
669 669
 				<?php $show_first_tab_content = true; ?>
670
-				<?php foreach ( $this->settings as $setting ) : ?>
671
-					<?php if ( ! $this->has_sub_tab( $setting ) ) : ?>
672
-						<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
670
+				<?php foreach ($this->settings as $setting) : ?>
671
+					<?php if ( ! $this->has_sub_tab($setting)) : ?>
672
+						<?php do_action("give_before_{$setting['id']}_settings"); ?>
673 673
 
674 674
 						<div id="<?php echo $setting['id']; ?>"
675
-							 class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' );
675
+							 class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden');
676 676
 						     $show_first_tab_content = false; ?>">
677
-							<?php if ( ! empty( $setting['fields'] ) ) : ?>
678
-								<?php foreach ( $setting['fields'] as $field ) : ?>
679
-									<?php give_render_field( $field ); ?>
677
+							<?php if ( ! empty($setting['fields'])) : ?>
678
+								<?php foreach ($setting['fields'] as $field) : ?>
679
+									<?php give_render_field($field); ?>
680 680
 								<?php endforeach; ?>
681 681
 							<?php endif; ?>
682 682
 						</div>
683 683
 
684
-						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
684
+						<?php do_action("give_after_{$setting['id']}_settings"); ?>
685 685
 					<?php else: ?>
686
-						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
687
-							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
688
-								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
686
+						<?php if ($this->has_sub_tab($setting)) : ?>
687
+							<?php if ( ! empty($setting['sub-fields'])) : ?>
688
+								<?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?>
689 689
 									<div id="<?php echo $sub_fields['id']; ?>"
690 690
 										 class="panel give_options_panel give-hidden">
691
-										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
692
-											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
693
-												<?php give_render_field( $sub_field ); ?>
691
+										<?php if ( ! empty($sub_fields['fields'])) : ?>
692
+											<?php foreach ($sub_fields['fields'] as $sub_field) : ?>
693
+												<?php give_render_field($sub_field); ?>
694 694
 											<?php endforeach; ?>
695 695
 										<?php endif; ?>
696 696
 									</div>
@@ -714,9 +714,9 @@  discard block
 block discarded – undo
714 714
 	 *
715 715
 	 * @return bool
716 716
 	 */
717
-	private function has_sub_tab( $field_setting ) {
717
+	private function has_sub_tab($field_setting) {
718 718
 		$has_sub_tab = false;
719
-		if ( array_key_exists( 'sub-fields', $field_setting ) ) {
719
+		if (array_key_exists('sub-fields', $field_setting)) {
720 720
 			$has_sub_tab = true;
721 721
 		}
722 722
 
@@ -730,13 +730,13 @@  discard block
 block discarded – undo
730 730
 	 * @return array
731 731
 	 */
732 732
 	function cmb2_metabox_settings() {
733
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
733
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
734 734
 		$give_forms_settings = $all_cmb2_settings;
735 735
 
736 736
 		// Filter settings: Use only give forms related settings.
737
-		foreach ( $all_cmb2_settings as $index => $setting ) {
738
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
739
-				unset( $give_forms_settings[ $index ] );
737
+		foreach ($all_cmb2_settings as $index => $setting) {
738
+			if ( ! in_array('give_forms', $setting['object_types'])) {
739
+				unset($give_forms_settings[$index]);
740 740
 			}
741 741
 		}
742 742
 
@@ -754,97 +754,97 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @return void
756 756
 	 */
757
-	public function save( $post_id, $post ) {
757
+	public function save($post_id, $post) {
758 758
 
759 759
 		// $post_id and $post are required.
760
-		if ( empty( $post_id ) || empty( $post ) ) {
760
+		if (empty($post_id) || empty($post)) {
761 761
 			return;
762 762
 		}
763 763
 
764 764
 		// Don't save meta boxes for revisions or autosaves.
765
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
765
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
766 766
 			return;
767 767
 		}
768 768
 
769 769
 		// Check the nonce.
770
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
770
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
771 771
 			return;
772 772
 		}
773 773
 
774 774
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
775
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
775
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
776 776
 			return;
777 777
 		}
778 778
 
779 779
 		// Check user has permission to edit.
780
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
780
+		if ( ! current_user_can('edit_post', $post_id)) {
781 781
 			return;
782 782
 		}
783 783
 
784 784
 		// Fire action before saving form meta.
785
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
785
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
786 786
 
787 787
 		/**
788 788
 		 * Filter the meta key to save.
789 789
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
790 790
 		 */
791
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
791
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
792 792
 
793 793
 		// Save form meta data.
794
-		if ( ! empty( $form_meta_keys ) ) {
795
-			foreach ( $form_meta_keys as $form_meta_key ) {
794
+		if ( ! empty($form_meta_keys)) {
795
+			foreach ($form_meta_keys as $form_meta_key) {
796 796
 
797 797
 				// Set default value for checkbox fields.
798 798
 				if (
799
-					! isset( $_POST[ $form_meta_key ] )
800
-					&& ( 'checkbox' === $this->get_field_type( $form_meta_key ) )
799
+					! isset($_POST[$form_meta_key])
800
+					&& ('checkbox' === $this->get_field_type($form_meta_key))
801 801
 				) {
802
-					$_POST[ $form_meta_key ] = '';
802
+					$_POST[$form_meta_key] = '';
803 803
 				}
804 804
 
805
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
806
-					$setting_field = $this->get_setting_field( $form_meta_key );
807
-					if ( ! empty( $setting_field['type'] ) ) {
808
-						switch ( $setting_field['type'] ) {
805
+				if (isset($_POST[$form_meta_key])) {
806
+					$setting_field = $this->get_setting_field($form_meta_key);
807
+					if ( ! empty($setting_field['type'])) {
808
+						switch ($setting_field['type']) {
809 809
 							case 'textarea':
810 810
 							case 'wysiwyg':
811
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
811
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
812 812
 								break;
813 813
 
814 814
 							case 'group':
815 815
 								$form_meta_value = array();
816 816
 
817
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
817
+								foreach ($_POST[$form_meta_key] as $index => $group) {
818 818
 
819 819
 									// Do not save template input field values.
820
-									if ( '{{row-count-placeholder}}' === $index ) {
820
+									if ('{{row-count-placeholder}}' === $index) {
821 821
 										continue;
822 822
 									}
823 823
 
824 824
 									$group_meta_value = array();
825
-									foreach ( $group as $field_id => $field_value ) {
826
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
825
+									foreach ($group as $field_id => $field_value) {
826
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
827 827
 											case 'wysiwyg':
828
-												$group_meta_value[ $field_id ] = wp_kses_post( $field_value );
828
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
829 829
 												break;
830 830
 
831 831
 											default:
832
-												$group_meta_value[ $field_id ] = give_clean( $field_value );
832
+												$group_meta_value[$field_id] = give_clean($field_value);
833 833
 										}
834 834
 									}
835 835
 
836
-									if ( ! empty( $group_meta_value ) ) {
837
-										$form_meta_value[ $index ] = $group_meta_value;
836
+									if ( ! empty($group_meta_value)) {
837
+										$form_meta_value[$index] = $group_meta_value;
838 838
 									}
839 839
 								}
840 840
 
841 841
 
842 842
 								// Arrange repeater field keys in order.
843
-								$form_meta_value = array_values( $form_meta_value );
843
+								$form_meta_value = array_values($form_meta_value);
844 844
 								break;
845 845
 
846 846
 							default:
847
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
847
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
848 848
 						}
849 849
 
850 850
 
@@ -855,24 +855,24 @@  discard block
 block discarded – undo
855 855
 						 */
856 856
 						$form_meta_value = apply_filters(
857 857
 								'give_pre_save_form_meta_value',
858
-								$this->sanitize_form_meta( $form_meta_value, $setting_field ),
858
+								$this->sanitize_form_meta($form_meta_value, $setting_field),
859 859
 								$form_meta_key,
860 860
 								$this,
861 861
 								$post_id
862 862
 						);
863 863
 
864 864
 						// Save data.
865
-						give_update_meta( $post_id, $form_meta_key, $form_meta_value );
865
+						give_update_meta($post_id, $form_meta_key, $form_meta_value);
866 866
 
867 867
 						// Fire after saving form meta key.
868
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
868
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
869 869
 					}
870 870
 				}
871 871
 			}
872 872
 		}
873 873
 
874 874
 		// Fire action after saving form meta.
875
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
875
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
876 876
 	}
877 877
 
878 878
 
@@ -885,10 +885,10 @@  discard block
 block discarded – undo
885 885
 	 *
886 886
 	 * @return string
887 887
 	 */
888
-	private function get_field_id( $field ) {
888
+	private function get_field_id($field) {
889 889
 		$field_id = '';
890 890
 
891
-		if ( array_key_exists( 'id', $field ) ) {
891
+		if (array_key_exists('id', $field)) {
892 892
 			$field_id = $field['id'];
893 893
 
894 894
 		}
@@ -905,12 +905,12 @@  discard block
 block discarded – undo
905 905
 	 *
906 906
 	 * @return array
907 907
 	 */
908
-	private function get_fields_id( $setting ) {
908
+	private function get_fields_id($setting) {
909 909
 		$meta_keys = array();
910 910
 
911
-		if ( ! empty( $setting ) ) {
912
-			foreach ( $setting['fields'] as $field ) {
913
-				if ( $field_id = $this->get_field_id( $field ) ) {
911
+		if ( ! empty($setting)) {
912
+			foreach ($setting['fields'] as $field) {
913
+				if ($field_id = $this->get_field_id($field)) {
914 914
 					$meta_keys[] = $field_id;
915 915
 				}
916 916
 			}
@@ -928,14 +928,14 @@  discard block
 block discarded – undo
928 928
 	 *
929 929
 	 * @return array
930 930
 	 */
931
-	private function get_sub_fields_id( $setting ) {
931
+	private function get_sub_fields_id($setting) {
932 932
 		$meta_keys = array();
933 933
 
934
-		if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) {
935
-			foreach ( $setting['sub-fields'] as $fields ) {
936
-				if ( ! empty( $fields['fields'] ) ) {
937
-					foreach ( $fields['fields'] as $field ) {
938
-						if ( $field_id = $this->get_field_id( $field ) ) {
934
+		if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) {
935
+			foreach ($setting['sub-fields'] as $fields) {
936
+				if ( ! empty($fields['fields'])) {
937
+					foreach ($fields['fields'] as $field) {
938
+						if ($field_id = $this->get_field_id($field)) {
939 939
 							$meta_keys[] = $field_id;
940 940
 						}
941 941
 					}
@@ -956,14 +956,14 @@  discard block
 block discarded – undo
956 956
 	private function get_meta_keys_from_settings() {
957 957
 		$meta_keys = array();
958 958
 
959
-		foreach ( $this->settings as $setting ) {
960
-			if ( $this->has_sub_tab( $setting ) ) {
961
-				$meta_key = $this->get_sub_fields_id( $setting );
959
+		foreach ($this->settings as $setting) {
960
+			if ($this->has_sub_tab($setting)) {
961
+				$meta_key = $this->get_sub_fields_id($setting);
962 962
 			} else {
963
-				$meta_key = $this->get_fields_id( $setting );
963
+				$meta_key = $this->get_fields_id($setting);
964 964
 			}
965 965
 
966
-			$meta_keys = array_merge( $meta_keys, $meta_key );
966
+			$meta_keys = array_merge($meta_keys, $meta_key);
967 967
 		}
968 968
 
969 969
 		return $meta_keys;
@@ -980,10 +980,10 @@  discard block
 block discarded – undo
980 980
 	 *
981 981
 	 * @return string
982 982
 	 */
983
-	function get_field_type( $field_id, $group_id = '' ) {
984
-		$field = $this->get_setting_field( $field_id, $group_id );
983
+	function get_field_type($field_id, $group_id = '') {
984
+		$field = $this->get_setting_field($field_id, $group_id);
985 985
 
986
-		$type = array_key_exists( 'type', $field )
986
+		$type = array_key_exists('type', $field)
987 987
 			? $field['type']
988 988
 			: '';
989 989
 
@@ -1001,12 +1001,12 @@  discard block
 block discarded – undo
1001 1001
 	 *
1002 1002
 	 * @return array
1003 1003
 	 */
1004
-	private function get_field( $setting, $field_id ) {
1004
+	private function get_field($setting, $field_id) {
1005 1005
 		$setting_field = array();
1006 1006
 
1007
-		if ( ! empty( $setting['fields'] ) ) {
1008
-			foreach ( $setting['fields'] as $field ) {
1009
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) {
1007
+		if ( ! empty($setting['fields'])) {
1008
+			foreach ($setting['fields'] as $field) {
1009
+				if (array_key_exists('id', $field) && $field['id'] === $field_id) {
1010 1010
 					$setting_field = $field;
1011 1011
 					break;
1012 1012
 				}
@@ -1026,12 +1026,12 @@  discard block
 block discarded – undo
1026 1026
 	 *
1027 1027
 	 * @return array
1028 1028
 	 */
1029
-	private function get_sub_field( $setting, $field_id ) {
1029
+	private function get_sub_field($setting, $field_id) {
1030 1030
 		$setting_field = array();
1031 1031
 
1032
-		if ( ! empty( $setting['sub-fields'] ) ) {
1033
-			foreach ( $setting['sub-fields'] as $fields ) {
1034
-				if ( $field = $this->get_field( $fields, $field_id ) ) {
1032
+		if ( ! empty($setting['sub-fields'])) {
1033
+			foreach ($setting['sub-fields'] as $fields) {
1034
+				if ($field = $this->get_field($fields, $field_id)) {
1035 1035
 					$setting_field = $field;
1036 1036
 					break;
1037 1037
 				}
@@ -1051,17 +1051,17 @@  discard block
 block discarded – undo
1051 1051
 	 *
1052 1052
 	 * @return array
1053 1053
 	 */
1054
-	function get_setting_field( $field_id, $group_id = '' ) {
1054
+	function get_setting_field($field_id, $group_id = '') {
1055 1055
 		$setting_field = array();
1056 1056
 
1057 1057
 		$_field_id = $field_id;
1058
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
1058
+		$field_id  = empty($group_id) ? $field_id : $group_id;
1059 1059
 
1060
-		if ( ! empty( $this->settings ) ) {
1061
-			foreach ( $this->settings as $setting ) {
1060
+		if ( ! empty($this->settings)) {
1061
+			foreach ($this->settings as $setting) {
1062 1062
 				if (
1063
-					( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) )
1064
-					|| ( $setting_field = $this->get_field( $setting, $field_id ) )
1063
+					($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id)))
1064
+					|| ($setting_field = $this->get_field($setting, $field_id))
1065 1065
 				) {
1066 1066
 					break;
1067 1067
 				}
@@ -1070,9 +1070,9 @@  discard block
 block discarded – undo
1070 1070
 
1071 1071
 
1072 1072
 		// Get field from group.
1073
-		if ( ! empty( $group_id ) ) {
1074
-			foreach ( $setting_field['fields'] as $field ) {
1075
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) {
1073
+		if ( ! empty($group_id)) {
1074
+			foreach ($setting_field['fields'] as $field) {
1075
+				if (array_key_exists('id', $field) && $field['id'] === $_field_id) {
1076 1076
 					$setting_field = $field;
1077 1077
 				}
1078 1078
 			}
@@ -1091,14 +1091,14 @@  discard block
 block discarded – undo
1091 1091
 	 *
1092 1092
 	 * @return mixed
1093 1093
 	 */
1094
-	function add_offline_donations_setting_tab( $settings ) {
1095
-		if ( give_is_gateway_active( 'offline' ) ) {
1096
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
1094
+	function add_offline_donations_setting_tab($settings) {
1095
+		if (give_is_gateway_active('offline')) {
1096
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
1097 1097
 				'id'        => 'offline_donations_options',
1098
-				'title'     => __( 'Offline Donations', 'give' ),
1098
+				'title'     => __('Offline Donations', 'give'),
1099 1099
 				'icon-html' => '<span class="give-icon give-icon-purse"></span>',
1100
-				'fields'    => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
1101
-			) );
1100
+				'fields'    => apply_filters('give_forms_offline_donations_metabox_fields', array()),
1101
+			));
1102 1102
 		}
1103 1103
 
1104 1104
 		return $settings;
@@ -1116,22 +1116,22 @@  discard block
 block discarded – undo
1116 1116
 	 *
1117 1117
 	 * @return mixed
1118 1118
 	 */
1119
-	function sanitize_form_meta( $meta_value, $setting_field ) {
1120
-		switch ( $setting_field['type'] ) {
1119
+	function sanitize_form_meta($meta_value, $setting_field) {
1120
+		switch ($setting_field['type']) {
1121 1121
 			case 'group':
1122
-				if ( ! empty( $setting_field['fields'] ) ) {
1123
-					foreach ( $setting_field['fields'] as $field ) {
1124
-						if ( empty( $field['data_type'] ) || 'price' !== $field['data_type'] ) {
1122
+				if ( ! empty($setting_field['fields'])) {
1123
+					foreach ($setting_field['fields'] as $field) {
1124
+						if (empty($field['data_type']) || 'price' !== $field['data_type']) {
1125 1125
 							continue;
1126 1126
 						}
1127 1127
 
1128
-						foreach ( $meta_value as $index => $meta_data ) {
1129
-							if( ! isset( $meta_value[ $index ][ $field['id'] ] ) ) {
1128
+						foreach ($meta_value as $index => $meta_data) {
1129
+							if ( ! isset($meta_value[$index][$field['id']])) {
1130 1130
 								continue;
1131 1131
 							}
1132 1132
 
1133
-							$meta_value[ $index ][ $field['id'] ] = ! empty( $meta_value[ $index ][ $field['id'] ] )
1134
-								? give_sanitize_amount_for_db( $meta_value[ $index ][ $field['id'] ] )
1133
+							$meta_value[$index][$field['id']] = ! empty($meta_value[$index][$field['id']])
1134
+								? give_sanitize_amount_for_db($meta_value[$index][$field['id']])
1135 1135
 								: 0;
1136 1136
 						}
1137 1137
 					}
@@ -1139,8 +1139,8 @@  discard block
 block discarded – undo
1139 1139
 				break;
1140 1140
 
1141 1141
 			default:
1142
-				if ( ! empty( $setting_field['data_type'] ) && 'price' === $setting_field['data_type'] ) {
1143
-					$meta_value = $meta_value ? give_sanitize_amount_for_db( $meta_value ) : 0;
1142
+				if ( ! empty($setting_field['data_type']) && 'price' === $setting_field['data_type']) {
1143
+					$meta_value = $meta_value ? give_sanitize_amount_for_db($meta_value) : 0;
1144 1144
 				}
1145 1145
 		}
1146 1146
 
Please login to merge, or discard this patch.
includes/admin/forms/dashboard-columns.php 1 patch
Spacing   +71 added lines, -71 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
 
@@ -27,34 +27,34 @@  discard block
 block discarded – undo
27 27
  * @return array $form_columns Updated array of forms columns
28 28
  *  Post Type List Table
29 29
  */
30
-function give_form_columns( $give_form_columns ) {
30
+function give_form_columns($give_form_columns) {
31 31
 
32 32
 	// Standard columns
33 33
 	$give_form_columns = array(
34 34
 		'cb'            => '<input type="checkbox"/>',
35
-		'title'         => __( 'Name', 'give' ),
36
-		'form_category' => __( 'Categories', 'give' ),
37
-		'form_tag'      => __( 'Tags', 'give' ),
38
-		'price'         => __( 'Amount', 'give' ),
39
-		'goal'          => __( 'Goal', 'give' ),
40
-		'donations'     => __( 'Donations', 'give' ),
41
-		'earnings'      => __( 'Income', 'give' ),
42
-		'shortcode'     => __( 'Shortcode', 'give' ),
43
-		'date'          => __( 'Date', 'give' ),
35
+		'title'         => __('Name', 'give'),
36
+		'form_category' => __('Categories', 'give'),
37
+		'form_tag'      => __('Tags', 'give'),
38
+		'price'         => __('Amount', 'give'),
39
+		'goal'          => __('Goal', 'give'),
40
+		'donations'     => __('Donations', 'give'),
41
+		'earnings'      => __('Income', 'give'),
42
+		'shortcode'     => __('Shortcode', 'give'),
43
+		'date'          => __('Date', 'give'),
44 44
 	);
45 45
 
46 46
 	// Does the user want categories / tags?
47
-	if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) {
48
-		unset( $give_form_columns['form_category'] );
47
+	if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) {
48
+		unset($give_form_columns['form_category']);
49 49
 	}
50
-	if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) {
51
-		unset( $give_form_columns['form_tag'] );
50
+	if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) {
51
+		unset($give_form_columns['form_tag']);
52 52
 	}
53 53
 
54
-	return apply_filters( 'give_forms_columns', $give_form_columns );
54
+	return apply_filters('give_forms_columns', $give_form_columns);
55 55
 }
56 56
 
57
-add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' );
57
+add_filter('manage_edit-give_forms_columns', 'give_form_columns');
58 58
 
59 59
 /**
60 60
  * Render Give Form Columns
@@ -66,59 +66,59 @@  discard block
 block discarded – undo
66 66
  *
67 67
  * @return void
68 68
  */
69
-function give_render_form_columns( $column_name, $post_id ) {
70
-	if ( get_post_type( $post_id ) == 'give_forms' ) {
69
+function give_render_form_columns($column_name, $post_id) {
70
+	if (get_post_type($post_id) == 'give_forms') {
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form_category':
74
-				echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' );
74
+				echo get_the_term_list($post_id, 'give_forms_category', '', ', ', '');
75 75
 				break;
76 76
 			case 'form_tag':
77
-				echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' );
77
+				echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', '');
78 78
 				break;
79 79
 			case 'price':
80
-				if ( give_has_variable_prices( $post_id ) ) {
81
-					echo give_price_range( $post_id );
80
+				if (give_has_variable_prices($post_id)) {
81
+					echo give_price_range($post_id);
82 82
 				} else {
83
-					echo give_price( $post_id, false );
84
-					echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />';
83
+					echo give_price($post_id, false);
84
+					echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />';
85 85
 				}
86 86
 				break;
87 87
 			case 'goal':
88
-				if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) {
89
-					echo give_goal( $post_id, false );
88
+				if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) {
89
+					echo give_goal($post_id, false);
90 90
 				} else {
91
-					esc_html_e( 'No Goal Set', 'give' );
91
+					esc_html_e('No Goal Set', 'give');
92 92
 				}
93 93
 
94
-				echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />';
94
+				echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />';
95 95
 				break;
96 96
 			case 'donations':
97
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
98
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ) . '">';
99
-					echo give_get_form_sales_stats( $post_id );
97
+				if (current_user_can('view_give_form_stats', $post_id)) {
98
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)).'">';
99
+					echo give_get_form_sales_stats($post_id);
100 100
 					echo '</a>';
101 101
 				} else {
102 102
 					echo '-';
103 103
 				}
104 104
 				break;
105 105
 			case 'earnings':
106
-				if ( current_user_can( 'view_give_form_stats', $post_id ) ) {
107
-					echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ) . '">';
108
-					echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), array( 'sanitize' => false ) ) );
106
+				if (current_user_can('view_give_form_stats', $post_id)) {
107
+					echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)).'">';
108
+					echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id), array('sanitize' => false)));
109 109
 					echo '</a>';
110 110
 				} else {
111 111
 					echo '-';
112 112
 				}
113 113
 				break;
114 114
 			case 'shortcode':
115
-				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;' . absint( $post_id ) . '&#34;]">';
115
+				echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id=&#34;'.absint($post_id).'&#34;]">';
116 116
 				break;
117 117
 		}// End switch().
118 118
 	}// End if().
119 119
 }
120 120
 
121
-add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 );
121
+add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2);
122 122
 
123 123
 /**
124 124
  * Registers the sortable columns in the list table
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  *
130 130
  * @return array $columns Array of sortable columns
131 131
  */
132
-function give_sortable_form_columns( $columns ) {
132
+function give_sortable_form_columns($columns) {
133 133
 	$columns['price']     = 'amount';
134 134
 	$columns['sales']     = 'sales';
135 135
 	$columns['earnings']  = 'earnings';
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	return $columns;
140 140
 }
141 141
 
142
-add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' );
142
+add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns');
143 143
 
144 144
 /**
145 145
  * Sorts Columns in the Forms List Table
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
  *
151 151
  * @return array $vars Array of all the sort variables.
152 152
  */
153
-function give_sort_forms( $vars ) {
153
+function give_sort_forms($vars) {
154 154
 	// Check if we're viewing the "give_forms" post type.
155
-	if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) {
155
+	if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) {
156 156
 		return $vars;
157 157
 	}
158 158
 
159
-	switch ( $vars['orderby'] ) {
159
+	switch ($vars['orderby']) {
160 160
 		// Check if 'orderby' is set to "sales".
161 161
 		case 'sales':
162 162
 			$vars = array_merge(
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 		// Check if "orderby" is set to "price/amount".
183 183
 		case 'amount':
184
-			$multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
184
+			$multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount';
185 185
 
186 186
 			$vars['orderby']    = 'meta_value_num';
187 187
 			$vars['meta_query'] = array(
@@ -233,17 +233,17 @@  discard block
 block discarded – undo
233 233
  *
234 234
  * @return array       Array of all sort variables.
235 235
  */
236
-function give_filter_forms( $vars ) {
237
-	if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) {
236
+function give_filter_forms($vars) {
237
+	if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) {
238 238
 
239 239
 		// If an author ID was passed, use it
240
-		if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) {
240
+		if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) {
241 241
 
242 242
 			$author_id = $_REQUEST['author'];
243
-			if ( (int) $author_id !== get_current_user_id() ) {
244
-				wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array(
243
+			if ((int) $author_id !== get_current_user_id()) {
244
+				wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array(
245 245
 					'response' => 403,
246
-				) );
246
+				));
247 247
 			}
248 248
 			$vars = array_merge(
249 249
 				$vars,
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
  * @return void
268 268
  */
269 269
 function give_forms_load() {
270
-	add_filter( 'request', 'give_sort_forms' );
271
-	add_filter( 'request', 'give_filter_forms' );
270
+	add_filter('request', 'give_sort_forms');
271
+	add_filter('request', 'give_filter_forms');
272 272
 }
273 273
 
274
-add_action( 'load-edit.php', 'give_forms_load', 9999 );
274
+add_action('load-edit.php', 'give_forms_load', 9999);
275 275
 
276 276
 /**
277 277
  * Remove Forms Month Filter
@@ -285,17 +285,17 @@  discard block
 block discarded – undo
285 285
  * @global      $typenow The post type we are viewing.
286 286
  * @return array Empty array disables the dropdown.
287 287
  */
288
-function give_remove_month_filter( $dates ) {
288
+function give_remove_month_filter($dates) {
289 289
 	global $typenow;
290 290
 
291
-	if ( $typenow == 'give_forms' ) {
291
+	if ($typenow == 'give_forms') {
292 292
 		$dates = array();
293 293
 	}
294 294
 
295 295
 	return $dates;
296 296
 }
297 297
 
298
-add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 );
298
+add_filter('months_dropdown_results', 'give_remove_month_filter', 99);
299 299
 
300 300
 /**
301 301
  * Updates price when saving post
@@ -306,23 +306,23 @@  discard block
 block discarded – undo
306 306
  *
307 307
  * @return int|null
308 308
  */
309
-function give_price_save_quick_edit( $post_id ) {
310
-	if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) {
309
+function give_price_save_quick_edit($post_id) {
310
+	if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) {
311 311
 		return;
312 312
 	}
313
-	if ( ! current_user_can( 'edit_post', $post_id ) ) {
313
+	if ( ! current_user_can('edit_post', $post_id)) {
314 314
 		return $post_id;
315 315
 	}
316
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
316
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
317 317
 		return $post_id;
318 318
 	}
319 319
 
320
-	if ( isset( $_REQUEST['_give_regprice'] ) ) {
321
-		give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) );
320
+	if (isset($_REQUEST['_give_regprice'])) {
321
+		give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db(strip_tags(stripslashes($_REQUEST['_give_regprice']))));
322 322
 	}
323 323
 }
324 324
 
325
-add_action( 'save_post', 'give_price_save_quick_edit' );
325
+add_action('save_post', 'give_price_save_quick_edit');
326 326
 
327 327
 /**
328 328
  * Process bulk edit actions via AJAX
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
  */
333 333
 function give_save_bulk_edit() {
334 334
 
335
-	$post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array();
335
+	$post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array();
336 336
 
337
-	if ( ! empty( $post_ids ) && is_array( $post_ids ) ) {
338
-		$price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0;
339
-		foreach ( $post_ids as $post_id ) {
337
+	if ( ! empty($post_ids) && is_array($post_ids)) {
338
+		$price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0;
339
+		foreach ($post_ids as $post_id) {
340 340
 
341
-			if ( ! current_user_can( 'edit_post', $post_id ) ) {
341
+			if ( ! current_user_can('edit_post', $post_id)) {
342 342
 				continue;
343 343
 			}
344 344
 
345
-			if ( ! empty( $price ) ) {
346
-				give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( $price ) );
345
+			if ( ! empty($price)) {
346
+				give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db($price));
347 347
 			}
348 348
 		}
349 349
 	}
@@ -351,4 +351,4 @@  discard block
 block discarded – undo
351 351
 	die();
352 352
 }
353 353
 
354
-add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' );
354
+add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit');
Please login to merge, or discard this patch.
includes/admin/dashboard-widgets.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
  * @return void
22 22
  */
23 23
 function give_register_dashboard_widgets() {
24
-	if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
25
-		wp_add_dashboard_widget( 'give_dashboard_sales', esc_html__( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' );
24
+	if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
25
+		wp_add_dashboard_widget('give_dashboard_sales', esc_html__('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget');
26 26
 	}
27 27
 }
28 28
 
29
-add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 );
29
+add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10);
30 30
 
31 31
 /**
32 32
  * Sales Summary Dashboard Widget
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  */
39 39
 function give_dashboard_sales_widget() {
40 40
 
41
-	if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) {
41
+	if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) {
42 42
 		return;
43 43
 	}
44 44
 	$stats = new Give_Payment_Stats; ?>
@@ -46,27 +46,27 @@  discard block
 block discarded – undo
46 46
 	<div class="give-dashboard-widget">
47 47
 
48 48
 		<div class="give-dashboard-today give-clearfix">
49
-			<h3 class="give-dashboard-date-today"><?php echo date( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3>
49
+			<h3 class="give-dashboard-date-today"><?php echo date(_x('F j, Y', 'dashboard widget', 'give')); ?></h3>
50 50
 
51 51
 			<p class="give-dashboard-happy-day"><?php
52 52
 				printf(
53 53
 				/* translators: %s: day of the week */
54
-					esc_html__( 'Happy %s!', 'give' ),
55
-					date( 'l', current_time( 'timestamp' ) )
54
+					esc_html__('Happy %s!', 'give'),
55
+					date('l', current_time('timestamp'))
56 56
 				);
57 57
 			?></p>
58 58
 
59 59
 			<p class="give-dashboard-today-earnings"><?php
60
-				$earnings_today = $stats->get_earnings( 0, 'today', false );
61
-				echo give_currency_filter( give_format_amount( $earnings_today, array( 'sanitize' => false ) ) );
60
+				$earnings_today = $stats->get_earnings(0, 'today', false);
61
+				echo give_currency_filter(give_format_amount($earnings_today, array('sanitize' => false)));
62 62
 			?></p>
63 63
 
64 64
 			<p class="give-orders-today"><?php
65
-				$donations_today = $stats->get_sales( 0, 'today', false );
65
+				$donations_today = $stats->get_sales(0, 'today', false);
66 66
 				printf(
67 67
 					/* translators: %s: daily donation count */
68
-					esc_html__( '%s donations today', 'give' ),
69
-					give_format_amount( $donations_today, array( 'decimal' => false, 'sanitize' => false ) )
68
+					esc_html__('%s donations today', 'give'),
69
+					give_format_amount($donations_today, array('decimal' => false, 'sanitize' => false))
70 70
 				);
71 71
 			?></p>
72 72
 
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 		<table class="give-table-stats">
77 77
 			<thead style="display: none;">
78 78
 			<tr>
79
-				<th><?php esc_html_e( 'This Week', 'give' ); ?></th>
80
-				<th><?php esc_html_e( 'This Month', 'give' ); ?></th>
81
-				<th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th>
79
+				<th><?php esc_html_e('This Week', 'give'); ?></th>
80
+				<th><?php esc_html_e('This Month', 'give'); ?></th>
81
+				<th><?php esc_html_e('Past 30 Days', 'give'); ?></th>
82 82
 			</tr>
83 83
 			</thead>
84 84
 			<tbody>
85 85
 			<tr id="give-table-stats-tr-1">
86 86
 				<td>
87
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ), array( 'sanitize' => false ) ) ); ?></p>
87
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'), array('sanitize' => false))); ?></p>
88 88
 
89
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Week', 'give' ); ?></p>
89
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Week', 'give'); ?></p>
90 90
 				</td>
91 91
 				<td>
92
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ), array( 'sanitize' => false ) ) ); ?></p>
92
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'), array('sanitize' => false))); ?></p>
93 93
 
94
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Month', 'give' ); ?></p>
94
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Month', 'give'); ?></p>
95 95
 				</td>
96 96
 			</tr>
97 97
 			<tr id="give-table-stats-tr-2">
98 98
 				<td>
99
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ), array( 'sanitize' => false ) ) ) ?></p>
99
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'), array('sanitize' => false))) ?></p>
100 100
 
101
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'Last Month', 'give' ); ?></p>
101
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('Last Month', 'give'); ?></p>
102 102
 				</td>
103 103
 				<td>
104
-					<p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ), array( 'decimal' => false, 'sanitize' => false ) ) ) ?></p>
104
+					<p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false), array('decimal' => false, 'sanitize' => false))) ?></p>
105 105
 
106
-					<p class="give-dashboard-stat-total-label"><?php esc_html_e( 'This Year', 'give' ); ?></p>
106
+					<p class="give-dashboard-stat-total-label"><?php esc_html_e('This Year', 'give'); ?></p>
107 107
 				</td>
108 108
 			</tr>
109 109
 			</tbody>
@@ -123,23 +123,23 @@  discard block
 block discarded – undo
123 123
  *
124 124
  * @return array
125 125
  */
126
-function give_dashboard_at_a_glance_widget( $items ) {
127
-	$num_posts = wp_count_posts( 'give_forms' );
126
+function give_dashboard_at_a_glance_widget($items) {
127
+	$num_posts = wp_count_posts('give_forms');
128 128
 
129
-	if ( $num_posts && $num_posts->publish ) {
129
+	if ($num_posts && $num_posts->publish) {
130 130
 
131 131
 		$text = sprintf(
132 132
 			/* translators: %s: number of posts published */
133
-			_n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ),
133
+			_n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'),
134 134
 			$num_posts->publish
135 135
 		);
136 136
 
137
-		$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
137
+		$text = sprintf($text, number_format_i18n($num_posts->publish));
138 138
 
139
-		if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) {
139
+		if (current_user_can('edit_give_forms', get_current_user_id())) {
140 140
 			$text = sprintf(
141 141
 				'<a class="give-forms-count" href="%1$s">%2$s</a>',
142
-				admin_url( 'edit.php?post_type=give_forms' ),
142
+				admin_url('edit.php?post_type=give_forms'),
143 143
 				$text
144 144
 			);
145 145
 		} else {
@@ -155,4 +155,4 @@  discard block
 block discarded – undo
155 155
 	return $items;
156 156
 }
157 157
 
158
-add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 );
158
+add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1);
Please login to merge, or discard this patch.
includes/admin/payments/actions.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,52 +25,52 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return      void
27 27
  */
28
-function give_update_payment_details( $data ) {
28
+function give_update_payment_details($data) {
29 29
 
30
-	if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) {
31
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
30
+	if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) {
31
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
32 32
 	}
33 33
 
34
-	check_admin_referer( 'give_update_payment_details_nonce' );
34
+	check_admin_referer('give_update_payment_details_nonce');
35 35
 
36 36
 	// Retrieve the payment ID.
37
-	$payment_id = absint( $data['give_payment_id'] );
37
+	$payment_id = absint($data['give_payment_id']);
38 38
 
39 39
 	/* @var Give_Payment $payment */
40
-	$payment = new Give_Payment( $payment_id );
40
+	$payment = new Give_Payment($payment_id);
41 41
 
42 42
 	// Retrieve existing payment meta.
43 43
 	$meta      = $payment->get_meta();
44 44
 	$user_info = $payment->user_info;
45 45
 
46 46
 	$status = $data['give-payment-status'];
47
-	$date   = sanitize_text_field( $data['give-payment-date'] );
48
-	$hour   = sanitize_text_field( $data['give-payment-time-hour'] );
47
+	$date   = sanitize_text_field($data['give-payment-date']);
48
+	$hour   = sanitize_text_field($data['give-payment-time-hour']);
49 49
 
50 50
 	// Restrict to our high and low.
51
-	if ( $hour > 23 ) {
51
+	if ($hour > 23) {
52 52
 		$hour = 23;
53
-	} elseif ( $hour < 0 ) {
53
+	} elseif ($hour < 0) {
54 54
 		$hour = 00;
55 55
 	}
56 56
 
57
-	$minute = sanitize_text_field( $data['give-payment-time-min'] );
57
+	$minute = sanitize_text_field($data['give-payment-time-min']);
58 58
 
59 59
 	// Restrict to our high and low.
60
-	if ( $minute > 59 ) {
60
+	if ($minute > 59) {
61 61
 		$minute = 59;
62
-	} elseif ( $minute < 0 ) {
62
+	} elseif ($minute < 0) {
63 63
 		$minute = 00;
64 64
 	}
65 65
 
66
-	$address = array_map( 'trim', $data['give-payment-address'][0] );
66
+	$address = array_map('trim', $data['give-payment-address'][0]);
67 67
 
68 68
 	$curr_total = $payment->total;
69
-	$new_total  = give_maybe_sanitize_amount( $data['give-payment-total'] );
70
-	$date       = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00';
69
+	$new_total  = give_maybe_sanitize_amount($data['give-payment-total']);
70
+	$date       = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00';
71 71
 
72
-	$curr_donor_id = sanitize_text_field( $data['give-current-donor'] );
73
-	$new_donor_id  = sanitize_text_field( $data['donor-id'] );
72
+	$curr_donor_id = sanitize_text_field($data['give-current-donor']);
73
+	$new_donor_id  = sanitize_text_field($data['donor-id']);
74 74
 
75 75
 	/**
76 76
 	 * Fires before updating edited donation.
@@ -80,98 +80,98 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param int $payment_id The ID of the payment.
82 82
 	 */
83
-	do_action( 'give_update_edited_donation', $payment_id );
83
+	do_action('give_update_edited_donation', $payment_id);
84 84
 
85 85
 	$payment->date = $date;
86 86
 	$updated       = $payment->save();
87 87
 
88
-	if ( 0 === $updated ) {
89
-		wp_die( esc_html__( 'Error Updating Donation.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
88
+	if (0 === $updated) {
89
+		wp_die(esc_html__('Error Updating Donation.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
90 90
 	}
91 91
 
92 92
 	$donor_changed = false;
93 93
 
94
-	if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) {
94
+	if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') {
95 95
 
96
-		$email = isset( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : '';
97
-		$names = isset( $data['give-new-donor-name'] ) ? sanitize_text_field( $data['give-new-donor-name'] ) : '';
96
+		$email = isset($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : '';
97
+		$names = isset($data['give-new-donor-name']) ? sanitize_text_field($data['give-new-donor-name']) : '';
98 98
 
99
-		if ( empty( $email ) || empty( $names ) ) {
100
-			wp_die( esc_html__( 'New donors require a name and email address.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) );
99
+		if (empty($email) || empty($names)) {
100
+			wp_die(esc_html__('New donors require a name and email address.', 'give'), esc_html__('Error', 'give'), array('response' => 400));
101 101
 		}
102 102
 
103
-		$donor = new Give_Donor( $email );
104
-		if ( empty( $donor->id ) ) {
105
-			$donor_data = array( 'name' => $names, 'email' => $email );
106
-			$user_id       = email_exists( $email );
107
-			if ( false !== $user_id ) {
103
+		$donor = new Give_Donor($email);
104
+		if (empty($donor->id)) {
105
+			$donor_data = array('name' => $names, 'email' => $email);
106
+			$user_id = email_exists($email);
107
+			if (false !== $user_id) {
108 108
 				$donor_data['user_id'] = $user_id;
109 109
 			}
110 110
 
111
-			if ( ! $donor->create( $donor_data ) ) {
111
+			if ( ! $donor->create($donor_data)) {
112 112
 				// Failed to crete the new donor, assume the previous donor.
113 113
 				$donor_changed = false;
114
-				$donor         = new Give_Donor( $curr_donor_id );
115
-				give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) );
114
+				$donor         = new Give_Donor($curr_donor_id);
115
+				give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give'));
116 116
 			}
117 117
 		}
118 118
 
119 119
 		$new_donor_id = $donor->id;
120 120
 
121
-		$previous_donor = new Give_Donor( $curr_donor_id );
121
+		$previous_donor = new Give_Donor($curr_donor_id);
122 122
 
123 123
 		$donor_changed = true;
124 124
 
125
-	} elseif ( $curr_donor_id !== $new_donor_id ) {
125
+	} elseif ($curr_donor_id !== $new_donor_id) {
126 126
 
127
-		$donor = new Give_Donor( $new_donor_id );
127
+		$donor = new Give_Donor($new_donor_id);
128 128
 		$email    = $donor->email;
129 129
 		$names    = $donor->name;
130 130
 
131
-		$previous_donor = new Give_Donor( $curr_donor_id );
131
+		$previous_donor = new Give_Donor($curr_donor_id);
132 132
 
133 133
 		$donor_changed = true;
134 134
 
135 135
 	} else {
136 136
 
137
-		$donor = new Give_Donor( $curr_donor_id );
137
+		$donor = new Give_Donor($curr_donor_id);
138 138
 		$email    = $donor->email;
139 139
 		$names    = $donor->name;
140 140
 
141 141
 	}
142 142
 
143 143
 	// Setup first and last name from input values.
144
-	$names      = explode( ' ', $names );
145
-	$first_name = ! empty( $names[0] ) ? $names[0] : '';
144
+	$names      = explode(' ', $names);
145
+	$first_name = ! empty($names[0]) ? $names[0] : '';
146 146
 	$last_name  = '';
147
-	if ( ! empty( $names[1] ) ) {
148
-		unset( $names[0] );
149
-		$last_name = implode( ' ', $names );
147
+	if ( ! empty($names[1])) {
148
+		unset($names[0]);
149
+		$last_name = implode(' ', $names);
150 150
 	}
151 151
 
152
-	if ( $donor_changed ) {
152
+	if ($donor_changed) {
153 153
 
154 154
 		// Remove the stats and payment from the previous donor and attach it to the new donor.
155
-		$previous_donor->remove_payment( $payment_id, false );
156
-		$donor->attach_payment( $payment_id, false );
155
+		$previous_donor->remove_payment($payment_id, false);
156
+		$donor->attach_payment($payment_id, false);
157 157
 
158
-		if ( 'publish' == $status ) {
158
+		if ('publish' == $status) {
159 159
 
160 160
 			// Reduce previous user donation count and amount.
161 161
 			$previous_donor->decrease_donation_count();
162
-			$previous_donor->decrease_value( $curr_total );
162
+			$previous_donor->decrease_value($curr_total);
163 163
 
164 164
 			// If donation was completed adjust stats of new donors.
165 165
 			$donor->increase_purchase_count();
166
-			$donor->increase_value( $new_total );
166
+			$donor->increase_value($new_total);
167 167
 		}
168 168
 
169 169
 		$payment->customer_id = $donor->id;
170 170
 	} else {
171 171
 
172
-		if ( 'publish' === $status ) {
172
+		if ('publish' === $status) {
173 173
 			// Update user donation stat.
174
-			$donor->update_donation_value( $curr_total, $new_total );
174
+			$donor->update_donation_value($curr_total, $new_total);
175 175
 		}
176 176
 	}
177 177
 
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
 	$payment->total      = $new_total;
185 185
 
186 186
 	// Check for payment notes.
187
-	if ( ! empty( $data['give-payment-note'] ) ) {
187
+	if ( ! empty($data['give-payment-note'])) {
188 188
 
189
-		$note = wp_kses( $data['give-payment-note'], array() );
190
-		give_insert_payment_note( $payment_id, $note );
189
+		$note = wp_kses($data['give-payment-note'], array());
190
+		give_insert_payment_note($payment_id, $note);
191 191
 
192 192
 	}
193 193
 
@@ -195,17 +195,17 @@  discard block
 block discarded – undo
195 195
 	$payment->status = $status;
196 196
 
197 197
 	// Adjust total store earnings if the payment total has been changed.
198
-	if ( $new_total !== $curr_total && 'publish' == $status ) {
198
+	if ($new_total !== $curr_total && 'publish' == $status) {
199 199
 
200
-		if ( $new_total > $curr_total ) {
200
+		if ($new_total > $curr_total) {
201 201
 			// Increase if our new total is higher.
202 202
 			$difference = $new_total - $curr_total;
203
-			give_increase_total_earnings( $difference );
203
+			give_increase_total_earnings($difference);
204 204
 
205
-		} elseif ( $curr_total > $new_total ) {
205
+		} elseif ($curr_total > $new_total) {
206 206
 			// Decrease if our new total is lower.
207 207
 			$difference = $curr_total - $new_total;
208
-			give_decrease_total_earnings( $difference );
208
+			give_decrease_total_earnings($difference);
209 209
 
210 210
 		}
211 211
 	}
@@ -213,16 +213,16 @@  discard block
 block discarded – undo
213 213
 	$payment->save();
214 214
 
215 215
 	// Get new give form ID.
216
-	$new_form_id     = absint( $data['give-payment-form-select'] );
217
-	$current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) );
216
+	$new_form_id     = absint($data['give-payment-form-select']);
217
+	$current_form_id = absint($payment->get_meta('_give_payment_form_id'));
218 218
 
219 219
 	// We are adding payment transfer code in last to remove any conflict with above functionality.
220 220
 	// For example: above code will automatically handle form stat (increase/decrease) when payment status changes.
221 221
 	// Check if user want to transfer current payment to new give form id.
222
-	if ( $new_form_id != $current_form_id ) {
222
+	if ($new_form_id != $current_form_id) {
223 223
 
224 224
 		// Get new give form title.
225
-		$new_form_title = get_the_title( $new_form_id );
225
+		$new_form_title = get_the_title($new_form_id);
226 226
 
227 227
 		// Update new give form data in payment data.
228 228
 		$payment_meta               = $payment->get_meta();
@@ -230,56 +230,56 @@  discard block
 block discarded – undo
230 230
 		$payment_meta['form_id']    = $new_form_id;
231 231
 
232 232
 		// Update price id post meta data for set donation form.
233
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
233
+		if ( ! give_has_variable_prices($new_form_id)) {
234 234
 			$payment_meta['price_id'] = '';
235 235
 		}
236 236
 
237 237
 		// Update payment give form meta data.
238
-		$payment->update_meta( '_give_payment_form_id', $new_form_id );
239
-		$payment->update_meta( '_give_payment_form_title', $new_form_title );
240
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
238
+		$payment->update_meta('_give_payment_form_id', $new_form_id);
239
+		$payment->update_meta('_give_payment_form_title', $new_form_title);
240
+		$payment->update_meta('_give_payment_meta', $payment_meta);
241 241
 
242 242
 		// Update price id payment metadata.
243
-		if ( ! give_has_variable_prices( $new_form_id ) ) {
244
-			$payment->update_meta( '_give_payment_price_id', '' );
243
+		if ( ! give_has_variable_prices($new_form_id)) {
244
+			$payment->update_meta('_give_payment_price_id', '');
245 245
 		}
246 246
 
247 247
 		// If donation was completed, adjust stats of forms.
248
-		if ( 'publish' == $status ) {
248
+		if ('publish' == $status) {
249 249
 
250 250
 			// Decrease sale of old give form. For other payment status.
251
-			$current_form = new Give_Donate_Form( $current_form_id );
251
+			$current_form = new Give_Donate_Form($current_form_id);
252 252
 			$current_form->decrease_sales();
253
-			$current_form->decrease_earnings( $curr_total );
253
+			$current_form->decrease_earnings($curr_total);
254 254
 
255 255
 			// Increase sale of new give form.
256
-			$new_form = new Give_Donate_Form( $new_form_id );
256
+			$new_form = new Give_Donate_Form($new_form_id);
257 257
 			$new_form->increase_sales();
258
-			$new_form->increase_earnings( $new_total );
258
+			$new_form->increase_earnings($new_total);
259 259
 		}
260 260
 
261 261
 		// Re setup payment to update new meta value in object.
262
-		$payment->update_payment_setup( $payment->ID );
262
+		$payment->update_payment_setup($payment->ID);
263 263
 	}
264 264
 
265 265
 	// Update price id if current form is variable form.
266
-	if ( ! empty( $data['give-variable-price'] ) && give_has_variable_prices( $payment->form_id ) ) {
266
+	if ( ! empty($data['give-variable-price']) && give_has_variable_prices($payment->form_id)) {
267 267
 
268 268
 		// Get payment meta data.
269 269
 		$payment_meta = $payment->get_meta();
270 270
 
271 271
 		// Set payment id to empty string if variable price id is negative ( i.e. custom amount feature enabled ).
272
-		$data['give-variable-price'] = ( 'custom' === $data['give-variable-price'] ) ? 'custom' : ( 0 < $data['give-variable-price'] ) ? $data['give-variable-price'] : '';
272
+		$data['give-variable-price'] = ('custom' === $data['give-variable-price']) ? 'custom' : (0 < $data['give-variable-price']) ? $data['give-variable-price'] : '';
273 273
 
274 274
 		// Update payment meta data.
275 275
 		$payment_meta['price_id'] = $data['give-variable-price'];
276 276
 
277 277
 		// Update payment give form meta data.
278
-		$payment->update_meta( '_give_payment_price_id', $data['give-variable-price'] );
279
-		$payment->update_meta( '_give_payment_meta', $payment_meta );
278
+		$payment->update_meta('_give_payment_price_id', $data['give-variable-price']);
279
+		$payment->update_meta('_give_payment_meta', $payment_meta);
280 280
 
281 281
 		// Re setup payment to update new meta value in object.
282
-		$payment->update_payment_setup( $payment->ID );
282
+		$payment->update_payment_setup($payment->ID);
283 283
 	}
284 284
 
285 285
 	/**
@@ -290,13 +290,13 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @param int $payment_id The ID of the payment.
292 292
 	 */
293
-	do_action( 'give_updated_edited_donation', $payment_id );
293
+	do_action('give_updated_edited_donation', $payment_id);
294 294
 
295
-	wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) );
295
+	wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id));
296 296
 	exit;
297 297
 }
298 298
 
299
-add_action( 'give_update_payment_details', 'give_update_payment_details' );
299
+add_action('give_update_payment_details', 'give_update_payment_details');
300 300
 
301 301
 /**
302 302
  * Trigger a Donation Deletion.
@@ -307,48 +307,48 @@  discard block
 block discarded – undo
307 307
  *
308 308
  * @return void
309 309
  */
310
-function give_trigger_donation_delete( $data ) {
311
-	if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) {
310
+function give_trigger_donation_delete($data) {
311
+	if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) {
312 312
 
313
-		$payment_id = absint( $data['purchase_id'] );
313
+		$payment_id = absint($data['purchase_id']);
314 314
 
315
-		if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
316
-			wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
315
+		if ( ! current_user_can('edit_give_payments', $payment_id)) {
316
+			wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
317 317
 		}
318 318
 
319
-		give_delete_donation( $payment_id );
320
-		wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) );
319
+		give_delete_donation($payment_id);
320
+		wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted'));
321 321
 		give_die();
322 322
 	}
323 323
 }
324 324
 
325
-add_action( 'give_delete_payment', 'give_trigger_donation_delete' );
325
+add_action('give_delete_payment', 'give_trigger_donation_delete');
326 326
 
327 327
 /**
328 328
  * AJAX Store Donation Note
329 329
  */
330 330
 function give_ajax_store_payment_note() {
331 331
 
332
-	$payment_id = absint( $_POST['payment_id'] );
333
-	$note       = wp_kses( $_POST['note'], array() );
332
+	$payment_id = absint($_POST['payment_id']);
333
+	$note       = wp_kses($_POST['note'], array());
334 334
 
335
-	if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) {
336
-		wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
335
+	if ( ! current_user_can('edit_give_payments', $payment_id)) {
336
+		wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403));
337 337
 	}
338 338
 
339
-	if ( empty( $payment_id ) ) {
340
-		die( '-1' );
339
+	if (empty($payment_id)) {
340
+		die('-1');
341 341
 	}
342 342
 
343
-	if ( empty( $note ) ) {
344
-		die( '-1' );
343
+	if (empty($note)) {
344
+		die('-1');
345 345
 	}
346 346
 
347
-	$note_id = give_insert_payment_note( $payment_id, $note );
348
-	die( give_get_payment_note_html( $note_id ) );
347
+	$note_id = give_insert_payment_note($payment_id, $note);
348
+	die(give_get_payment_note_html($note_id));
349 349
 }
350 350
 
351
-add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' );
351
+add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note');
352 352
 
353 353
 /**
354 354
  * Triggers a donation note deletion without ajax
@@ -359,24 +359,24 @@  discard block
 block discarded – undo
359 359
  *
360 360
  * @return void
361 361
  */
362
-function give_trigger_payment_note_deletion( $data ) {
362
+function give_trigger_payment_note_deletion($data) {
363 363
 
364
-	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) {
364
+	if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) {
365 365
 		return;
366 366
 	}
367 367
 
368
-	if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) {
369
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
368
+	if ( ! current_user_can('edit_give_payments', $data['payment_id'])) {
369
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
370 370
 	}
371 371
 
372
-	$edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) );
372
+	$edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id']));
373 373
 
374
-	give_delete_payment_note( $data['note_id'], $data['payment_id'] );
374
+	give_delete_payment_note($data['note_id'], $data['payment_id']);
375 375
 
376
-	wp_redirect( $edit_order_url );
376
+	wp_redirect($edit_order_url);
377 377
 }
378 378
 
379
-add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' );
379
+add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion');
380 380
 
381 381
 /**
382 382
  * Delete a payment note deletion with ajax
@@ -387,16 +387,16 @@  discard block
 block discarded – undo
387 387
  */
388 388
 function give_ajax_delete_payment_note() {
389 389
 
390
-	if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) {
391
-		wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
390
+	if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) {
391
+		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
392 392
 	}
393 393
 
394
-	if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) {
395
-		die( '1' );
394
+	if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) {
395
+		die('1');
396 396
 	} else {
397
-		die( '-1' );
397
+		die('-1');
398 398
 	}
399 399
 
400 400
 }
401 401
 
402
-add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' );
402
+add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note');
Please login to merge, or discard this patch.