Completed
Push — master ( e69c66...699283 )
by Devin
16:32
created
includes/admin/reporting/class-settings-gateways.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'gateways';
46
-			$this->label = esc_html__( 'Donation Methods', 'give' );
46
+			$this->label = esc_html__('Donation Methods', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_gateways', array( $this, 'render_report_gateways_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_gateways', array($this, 'render_report_gateways_field'), 10, 2);
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_reports_gateways',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'gateways',
98
-						'name' => esc_html__( 'Gateways', 'give' ),
98
+						'name' => esc_html__('Gateways', 'give'),
99 99
 						'type' => 'report_gateways',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_gateways_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_gateways');
134
+		public function render_report_gateways_field($field, $option_value) {
135
+			do_action('give_reports_view_gateways');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-settings-donors.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Donors' ) ) :
16
+if ( ! class_exists('Give_Settings_Donors')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Donors.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'donors';
46
-			$this->label = esc_html__( 'Donors', 'give' );
46
+			$this->label = esc_html__('Donors', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_donors', array( $this, 'render_report_donors_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_donors', array($this, 'render_report_donors_field'), 10, 2);
51 51
 
52 52
 			// Do not use main donor for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_reports_donors',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'donors',
98
-						'name' => esc_html__( 'Donors', 'give' ),
98
+						'name' => esc_html__('Donors', 'give'),
99 99
 						'type' => 'report_donors',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_donors_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_donors');
134
+		public function render_report_donors_field($field, $option_value) {
135
+			do_action('give_reports_view_donors');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/admin/reporting/class-settings-forms.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Forms' ) ) :
16
+if ( ! class_exists('Give_Settings_Forms')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Forms.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'forms';
46
-			$this->label = esc_html__( 'Forms', 'give' );
46
+			$this->label = esc_html__('Forms', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_forms', array( $this, 'render_report_forms_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_forms', array($this, 'render_report_forms_field'), 10, 2);
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_reports_forms',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'forms',
98
-						'name' => esc_html__( 'Forms', 'give' ),
98
+						'name' => esc_html__('Forms', 'give'),
99 99
 						'type' => 'report_forms',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_forms_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_forms');
134
+		public function render_report_forms_field($field, $option_value) {
135
+			do_action('give_reports_view_forms');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 	 * @param $_step int The step to process
107 107
 	 * @since 1.5
108 108
 	 */
109
-	public function __construct( $_step = 1 ) {
109
+	public function __construct($_step = 1) {
110 110
 
111 111
 		$upload_dir       = wp_upload_dir();
112 112
 		$this->filetype   = '.csv';
113
-		$this->filename   = 'give-' . $this->export_type . $this->filetype;
114
-		$this->file       = trailingslashit( $upload_dir['basedir'] ) . $this->filename;
113
+		$this->filename   = 'give-'.$this->export_type.$this->filetype;
114
+		$this->file       = trailingslashit($upload_dir['basedir']).$this->filename;
115 115
 
116
-		if ( ! is_writeable( $upload_dir['basedir'] ) ) {
116
+		if ( ! is_writeable($upload_dir['basedir'])) {
117 117
 			$this->is_writable = false;
118 118
 		}
119 119
 
@@ -129,20 +129,20 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function process_step() {
131 131
 
132
-		if ( ! $this->can_export() ) {
133
-			wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
132
+		if ( ! $this->can_export()) {
133
+			wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
134 134
 		}
135 135
 
136
-		if( $this->step < 2 ) {
136
+		if ($this->step < 2) {
137 137
 
138 138
 			// Make sure we start with a fresh file on step 1
139
-			@unlink( $this->file );
139
+			@unlink($this->file);
140 140
 			$this->print_csv_cols();
141 141
 		}
142 142
 
143 143
 		$rows = $this->print_csv_rows();
144 144
 
145
-		if( $rows ) {
145
+		if ($rows) {
146 146
 			return true;
147 147
 		} else {
148 148
 			return false;
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		$col_data = '';
163 163
 		$cols = $this->get_csv_cols();
164 164
 		$i = 1;
165
-		foreach( $cols as $col_id => $column ) {
166
-			$col_data .= '"' . addslashes( $column ) . '"';
167
-			$col_data .= $i == count( $cols ) ? '' : ',';
165
+		foreach ($cols as $col_id => $column) {
166
+			$col_data .= '"'.addslashes($column).'"';
167
+			$col_data .= $i == count($cols) ? '' : ',';
168 168
 			$i++;
169 169
 		}
170 170
 		$col_data .= "\r\n";
171 171
 
172
-		$this->stash_step_data( $col_data );
172
+		$this->stash_step_data($col_data);
173 173
 
174 174
 		return $col_data;
175 175
 
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 		$data     = $this->get_data();
189 189
 		$cols     = $this->get_csv_cols();
190 190
 
191
-		if( $data ) {
191
+		if ($data) {
192 192
 
193 193
 			// Output each row
194
-			foreach ( $data as $row ) {
194
+			foreach ($data as $row) {
195 195
 				$i = 1;
196
-				foreach ( $row as $col_id => $column ) {
196
+				foreach ($row as $col_id => $column) {
197 197
 					// Make sure the column is valid
198
-					if ( array_key_exists( $col_id, $cols ) ) {
199
-						$row_data .= '"' . addslashes( preg_replace( "/\"/","'", $column ) ) . '"';
200
-						$row_data .= $i == count( $cols ) ? '' : ',';
198
+					if (array_key_exists($col_id, $cols)) {
199
+						$row_data .= '"'.addslashes(preg_replace("/\"/", "'", $column)).'"';
200
+						$row_data .= $i == count($cols) ? '' : ',';
201 201
 						$i++;
202 202
 					}
203 203
 				}
204 204
 				$row_data .= "\r\n";
205 205
 			}
206 206
 
207
-			$this->stash_step_data( $row_data );
207
+			$this->stash_step_data($row_data);
208 208
 
209 209
 			return $row_data;
210 210
 		}
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
 
233 233
 		$file = '';
234 234
 
235
-		if ( @file_exists( $this->file ) ) {
235
+		if (@file_exists($this->file)) {
236 236
 
237
-			if ( ! is_writeable( $this->file ) ) {
237
+			if ( ! is_writeable($this->file)) {
238 238
 				$this->is_writable = false;
239 239
 			}
240 240
 
241
-			$file = @file_get_contents( $this->file );
241
+			$file = @file_get_contents($this->file);
242 242
 
243 243
 		} else {
244 244
 
245
-			@file_put_contents( $this->file, '' );
246
-			@chmod( $this->file, 0664 );
245
+			@file_put_contents($this->file, '');
246
+			@chmod($this->file, 0664);
247 247
 
248 248
 		}
249 249
 
@@ -257,18 +257,18 @@  discard block
 block discarded – undo
257 257
 	 * @param $data string The data to add to the file
258 258
 	 * @return void
259 259
 	 */
260
-	protected function stash_step_data( $data = '' ) {
260
+	protected function stash_step_data($data = '') {
261 261
 
262 262
 		$file = $this->get_file();
263 263
 		$file .= $data;
264
-		@file_put_contents( $this->file, $file );
264
+		@file_put_contents($this->file, $file);
265 265
 
266 266
 		// If we have no rows after this step, mark it as an empty export
267
-		$file_rows    = file( $this->file, FILE_SKIP_EMPTY_LINES);
267
+		$file_rows    = file($this->file, FILE_SKIP_EMPTY_LINES);
268 268
 		$default_cols = $this->get_csv_cols();
269
-		$default_cols = empty( $default_cols ) ? 0 : 1;
269
+		$default_cols = empty($default_cols) ? 0 : 1;
270 270
 
271
-		$this->is_empty = count( $file_rows ) == $default_cols ? true : false;
271
+		$this->is_empty = count($file_rows) == $default_cols ? true : false;
272 272
 
273 273
 	}
274 274
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 		$file = $this->get_file();
288 288
 
289
-		@unlink( $this->file );
289
+		@unlink($this->file);
290 290
 
291 291
 		echo $file;
292 292
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		 *
296 296
 		 * @since 1.8
297 297
 		 */
298
-		do_action( 'give_file_export_complete', $_REQUEST );
298
+		do_action('give_file_export_complete', $_REQUEST);
299 299
 
300 300
 		give_die();
301 301
 	}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * @since 1.5
307 307
 	 * @param array $request The Form Data passed into the batch processing
308 308
 	 */
309
-	public function set_properties( $request ) {}
309
+	public function set_properties($request) {}
310 310
 
311 311
 	/**
312 312
 	 * Allow for prefetching of data for the remainder of the exporter
Please login to merge, or discard this patch.
includes/admin/reporting/export/class-batch-export-customers.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -62,26 +62,26 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @param array $request The Form Data passed into the batch processing
64 64
 	 */
65
-	public function set_properties( $request ) {
65
+	public function set_properties($request) {
66 66
 
67 67
 		// Set data from form submission
68
-		if ( isset( $_POST['form'] ) ) {
69
-			parse_str( $_POST['form'], $this->data );
68
+		if (isset($_POST['form'])) {
69
+			parse_str($_POST['form'], $this->data);
70 70
 		}
71 71
 
72 72
 		$this->form = $this->data['forms'];
73 73
 
74 74
 		// Setup donor ids cache.
75
-		if( ! empty( $this->form ) ) {
75
+		if ( ! empty($this->form)) {
76 76
 			// Cache donor ids to output unique list of donor.
77
-			$this->query_id = give_clean( $_REQUEST['give_export_option']['query_id'] );
78
-			if( ! ( $this->donor_ids = get_transient( $this->query_id ) ) ) {
77
+			$this->query_id = give_clean($_REQUEST['give_export_option']['query_id']);
78
+			if ( ! ($this->donor_ids = get_transient($this->query_id))) {
79 79
 				$this->donor_ids = array();
80
-				set_transient( $this->query_id, $this->donor_ids, HOUR_IN_SECONDS );
80
+				set_transient($this->query_id, $this->donor_ids, HOUR_IN_SECONDS);
81 81
 			}
82 82
 		}
83 83
 
84
-		$this->price_id = ! empty( $request['give_price_option'] ) && 0 !== $request['give_price_option'] ? absint( $request['give_price_option'] ) : null;
84
+		$this->price_id = ! empty($request['give_price_option']) && 0 !== $request['give_price_option'] ? absint($request['give_price_option']) : null;
85 85
 
86 86
 	}
87 87
 
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 
97 97
 		$cols = array();
98 98
 
99
-		$columns = isset( $this->data['give_export_option'] ) ? $this->data['give_export_option'] : array();
99
+		$columns = isset($this->data['give_export_option']) ? $this->data['give_export_option'] : array();
100 100
 
101 101
 		// We need columns.
102
-		if ( empty( $columns ) ) {
102
+		if (empty($columns)) {
103 103
 			return false;
104 104
 		}
105 105
 
106
-		$cols = $this->get_cols( $columns );
106
+		$cols = $this->get_cols($columns);
107 107
 
108 108
 		return $cols;
109 109
 	}
@@ -115,38 +115,38 @@  discard block
 block discarded – undo
115 115
 	 *
116 116
 	 * @return array
117 117
 	 */
118
-	private function get_cols( $columns ) {
118
+	private function get_cols($columns) {
119 119
 
120 120
 		$cols = array();
121 121
 
122
-		foreach ( $columns as $key => $value ) {
122
+		foreach ($columns as $key => $value) {
123 123
 
124
-			switch ( $key ) {
124
+			switch ($key) {
125 125
 				case 'full_name' :
126
-					$cols['full_name'] = esc_html__( 'Full Name', 'give' );
126
+					$cols['full_name'] = esc_html__('Full Name', 'give');
127 127
 					break;
128 128
 				case 'email' :
129
-					$cols['email'] = esc_html__( 'Email Address', 'give' );
129
+					$cols['email'] = esc_html__('Email Address', 'give');
130 130
 					break;
131 131
 				case 'address' :
132
-					$cols['address_line1']   = esc_html__( 'Address', 'give' );
133
-					$cols['address_line2']   = esc_html__( 'Address 2', 'give' );
134
-					$cols['address_city']    = esc_html__( 'City', 'give' );
135
-					$cols['address_state']   = esc_html__( 'State', 'give' );
136
-					$cols['address_zip']     = esc_html__( 'Zip', 'give' );
137
-					$cols['address_country'] = esc_html__( 'Country', 'give' );
132
+					$cols['address_line1']   = esc_html__('Address', 'give');
133
+					$cols['address_line2']   = esc_html__('Address 2', 'give');
134
+					$cols['address_city']    = esc_html__('City', 'give');
135
+					$cols['address_state']   = esc_html__('State', 'give');
136
+					$cols['address_zip']     = esc_html__('Zip', 'give');
137
+					$cols['address_country'] = esc_html__('Country', 'give');
138 138
 					break;
139 139
 				case 'userid' :
140
-					$cols['userid'] = esc_html__( 'User ID', 'give' );
140
+					$cols['userid'] = esc_html__('User ID', 'give');
141 141
 					break;
142 142
 				case 'date_first_donated' :
143
-					$cols['date_first_donated'] = esc_html__( 'First Donation Date', 'give' );
143
+					$cols['date_first_donated'] = esc_html__('First Donation Date', 'give');
144 144
 					break;
145 145
 				case 'donations' :
146
-					$cols['donations'] = esc_html__( 'Number of Donations', 'give' );
146
+					$cols['donations'] = esc_html__('Number of Donations', 'give');
147 147
 					break;
148 148
 				case 'donation_sum' :
149
-					$cols['donation_sum'] = esc_html__( 'Sum of Donations', 'give' );
149
+					$cols['donation_sum'] = esc_html__('Sum of Donations', 'give');
150 150
 					break;
151 151
 			}
152 152
 		}
@@ -169,20 +169,20 @@  discard block
 block discarded – undo
169 169
 
170 170
 		$i = 0;
171 171
 
172
-		if ( ! empty( $this->form ) ) {
172
+		if ( ! empty($this->form)) {
173 173
 
174 174
 			// Export donors of a specific product
175 175
 			global $give_logs;
176 176
 
177 177
 			$args = array(
178
-				'post_parent'    => absint( $this->form ),
178
+				'post_parent'    => absint($this->form),
179 179
 				'log_type'       => 'sale',
180 180
 				'posts_per_page' => 30,
181 181
 				'paged'          => $this->step,
182 182
 			);
183 183
 
184 184
 			// Check for price option
185
-			if ( null !== $this->price_id ) {
185
+			if (null !== $this->price_id) {
186 186
 				$args['meta_query'] = array(
187 187
 					array(
188 188
 						'key'   => '_give_log_price_id',
@@ -191,44 +191,44 @@  discard block
 block discarded – undo
191 191
 				);
192 192
 			}
193 193
 
194
-			$logs = $give_logs->get_connected_logs( $args );
194
+			$logs = $give_logs->get_connected_logs($args);
195 195
 
196
-			if ( $logs ) {
197
-				foreach ( $logs as $log ) {
198
-					$payment_id = get_post_meta( $log->ID, '_give_log_payment_id', true );
199
-					$payment    = new Give_Payment( $payment_id );
196
+			if ($logs) {
197
+				foreach ($logs as $log) {
198
+					$payment_id = get_post_meta($log->ID, '_give_log_payment_id', true);
199
+					$payment    = new Give_Payment($payment_id);
200 200
 
201 201
 					// Continue if donor already included.
202
-					if( in_array( $payment->customer_id , $this->donor_ids ) ) {
202
+					if (in_array($payment->customer_id, $this->donor_ids)) {
203 203
 						continue;
204 204
 					}
205 205
 
206 206
 					$this->donor_ids[] = $payment->customer_id;
207 207
 
208
-					$donor      = Give()->customers->get_customer_by( 'id', $payment->customer_id );
209
-					$data[]     = $this->set_donor_data( $i, $data, $donor );
210
-					$i ++;
208
+					$donor      = Give()->customers->get_customer_by('id', $payment->customer_id);
209
+					$data[]     = $this->set_donor_data($i, $data, $donor);
210
+					$i++;
211 211
 				}
212 212
 
213 213
 				// Cache donor ids only if admin export donor for specific form.
214
-				set_transient( $this->query_id, array_unique( $this->donor_ids ), HOUR_IN_SECONDS );
214
+				set_transient($this->query_id, array_unique($this->donor_ids), HOUR_IN_SECONDS);
215 215
 			}
216 216
 		} else {
217 217
 
218 218
 			// Export all customers
219
-			$offset = 30 * ( $this->step - 1 );
220
-			$donors = Give()->customers->get_customers( array( 'number' => 30, 'offset' => $offset ) );
219
+			$offset = 30 * ($this->step - 1);
220
+			$donors = Give()->customers->get_customers(array('number' => 30, 'offset' => $offset));
221 221
 
222
-			foreach ( $donors as $donor ) {
222
+			foreach ($donors as $donor) {
223 223
 
224
-				$data[] = $this->set_donor_data( $i, $data, $donor );
225
-				$i ++;
224
+				$data[] = $this->set_donor_data($i, $data, $donor);
225
+				$i++;
226 226
 			}
227 227
 		}
228 228
 
229 229
 
230
-		$data = apply_filters( 'give_export_get_data', $data );
231
-		$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
230
+		$data = apply_filters('give_export_get_data', $data);
231
+		$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
232 232
 
233 233
 		return $data;
234 234
 	}
@@ -244,18 +244,18 @@  discard block
 block discarded – undo
244 244
 		$percentage = 0;
245 245
 
246 246
 		// We can't count the number when getting them for a specific form
247
-		if ( empty( $this->form ) ) {
247
+		if (empty($this->form)) {
248 248
 
249 249
 			$total = Give()->customers->count();
250 250
 
251
-			if ( $total > 0 ) {
251
+			if ($total > 0) {
252 252
 
253
-				$percentage = ( ( 30 * $this->step ) / $total ) * 100;
253
+				$percentage = ((30 * $this->step) / $total) * 100;
254 254
 
255 255
 			}
256 256
 		}
257 257
 
258
-		if ( $percentage > 100 ) {
258
+		if ($percentage > 100) {
259 259
 			$percentage = 100;
260 260
 		}
261 261
 
@@ -271,46 +271,46 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @return mixed
273 273
 	 */
274
-	private function set_donor_data( $i, $data, $donor ) {
274
+	private function set_donor_data($i, $data, $donor) {
275 275
 
276 276
 		$columns = $this->csv_cols();
277 277
 
278 278
 		// Set address variable
279 279
 		$address = '';
280
-		if ( isset( $donor->user_id ) && $donor->user_id > 0 ) {
281
-			$address = give_get_donor_address( $donor->user_id );
280
+		if (isset($donor->user_id) && $donor->user_id > 0) {
281
+			$address = give_get_donor_address($donor->user_id);
282 282
 		}
283 283
 
284 284
 		// Set columns
285
-		if ( ! empty( $columns['full_name'] ) ) {
286
-			$data[ $i ]['full_name'] = $donor->name;
285
+		if ( ! empty($columns['full_name'])) {
286
+			$data[$i]['full_name'] = $donor->name;
287 287
 		}
288
-		if ( ! empty( $columns['email'] ) ) {
289
-			$data[ $i ]['email'] = $donor->email;
288
+		if ( ! empty($columns['email'])) {
289
+			$data[$i]['email'] = $donor->email;
290 290
 		}
291
-		if ( ! empty( $columns['address_line1'] ) ) {
292
-
293
-			$data[ $i ]['address_line1']   = isset( $address['line1'] ) ? $address['line1'] : '';
294
-			$data[ $i ]['address_line2']   = isset( $address['line2'] ) ? $address['line2'] : '';
295
-			$data[ $i ]['address_city']    = isset( $address['city'] ) ? $address['city'] : '';
296
-			$data[ $i ]['address_state']   = isset( $address['state'] ) ? $address['state'] : '';
297
-			$data[ $i ]['address_zip']     = isset( $address['zip'] ) ? $address['zip'] : '';
298
-			$data[ $i ]['address_country'] = isset( $address['country'] ) ? $address['country'] : '';
291
+		if ( ! empty($columns['address_line1'])) {
292
+
293
+			$data[$i]['address_line1']   = isset($address['line1']) ? $address['line1'] : '';
294
+			$data[$i]['address_line2']   = isset($address['line2']) ? $address['line2'] : '';
295
+			$data[$i]['address_city']    = isset($address['city']) ? $address['city'] : '';
296
+			$data[$i]['address_state']   = isset($address['state']) ? $address['state'] : '';
297
+			$data[$i]['address_zip']     = isset($address['zip']) ? $address['zip'] : '';
298
+			$data[$i]['address_country'] = isset($address['country']) ? $address['country'] : '';
299 299
 		}
300
-		if ( ! empty( $columns['userid'] ) ) {
301
-			$data[ $i ]['userid'] = ! empty( $donor->user_id ) ? $donor->user_id : '';
300
+		if ( ! empty($columns['userid'])) {
301
+			$data[$i]['userid'] = ! empty($donor->user_id) ? $donor->user_id : '';
302 302
 		}
303
-		if ( ! empty( $columns['date_first_donated'] ) ) {
304
-			$data[ $i ]['date_first_donated'] = date_i18n( give_date_format(), strtotime( $donor->date_created ) );
303
+		if ( ! empty($columns['date_first_donated'])) {
304
+			$data[$i]['date_first_donated'] = date_i18n(give_date_format(), strtotime($donor->date_created));
305 305
 		}
306
-		if ( ! empty( $columns['donations'] ) ) {
307
-			$data[ $i ]['donations'] = $donor->purchase_count;
306
+		if ( ! empty($columns['donations'])) {
307
+			$data[$i]['donations'] = $donor->purchase_count;
308 308
 		}
309
-		if ( ! empty( $columns['donation_sum'] ) ) {
310
-			$data[ $i ]['donation_sum'] = give_format_amount( $donor->purchase_value );
309
+		if ( ! empty($columns['donation_sum'])) {
310
+			$data[$i]['donation_sum'] = give_format_amount($donor->purchase_value);
311 311
 		}
312 312
 
313
-		return $data[ $i ];
313
+		return $data[$i];
314 314
 
315 315
 	}
316 316
 
Please login to merge, or discard this patch.
includes/admin/reporting/export/export-actions.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @license     https://opensource.org/licenses/gpl-license GNU Public License
11 11
  */
12 12
 
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function give_process_batch_export_form() {
24 24
 
25
-	if ( ! wp_verify_nonce( $_REQUEST['nonce'], 'give-batch-export' ) ) {
26
-		wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
25
+	if ( ! wp_verify_nonce($_REQUEST['nonce'], 'give-batch-export')) {
26
+		wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
27 27
 	}
28 28
 
29
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export.php';
29
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export.php';
30 30
 
31 31
 	/**
32 32
 	 * Fires before batch export.
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param string $class Export class.
37 37
 	 */
38
-	do_action( 'give_batch_export_class_include', $_REQUEST['class'] );
38
+	do_action('give_batch_export_class_include', $_REQUEST['class']);
39 39
 
40 40
 	$export = new $_REQUEST['class'];
41 41
 	$export->export();
42 42
 
43 43
 }
44 44
 
45
-add_action( 'give_form_batch_export', 'give_process_batch_export_form' );
45
+add_action('give_form_batch_export', 'give_process_batch_export_form');
46 46
 
47 47
 /**
48 48
  * Exports earnings for a specified time period
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
  * @return void
54 54
  */
55 55
 function give_export_earnings() {
56
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-earnings.php';
56
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-earnings.php';
57 57
 
58 58
 	$earnings_export = new Give_Earnings_Export();
59 59
 
60 60
 	$earnings_export->export();
61 61
 }
62 62
 
63
-add_action( 'give_earnings_export', 'give_export_earnings' );
63
+add_action('give_earnings_export', 'give_export_earnings');
64 64
 
65 65
 
66 66
 /**
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
  * @return void
74 74
  */
75 75
 function give_export_all_customers() {
76
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-export-customers.php';
76
+	require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-export-customers.php';
77 77
 
78 78
 	$customer_export = new Give_Donors_Export();
79 79
 
80 80
 	$customer_export->export();
81 81
 }
82 82
 
83
-add_action( 'give_email_export', 'give_export_all_customers' );
83
+add_action('give_email_export', 'give_export_all_customers');
84 84
 
85 85
 /**
86 86
  * Add a hook allowing extensions to register a hook on the batch export process
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  * @return void
90 90
  */
91 91
 function give_register_batch_exporters() {
92
-	if ( is_admin() ) {
92
+	if (is_admin()) {
93 93
 		/**
94 94
 		 * Fires in the admin, while plugins loaded.
95 95
 		 *
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
 		 *
100 100
 		 * @param string $class Export class.
101 101
 		 */
102
-		do_action( 'give_register_batch_exporter' );
102
+		do_action('give_register_batch_exporter');
103 103
 	}
104 104
 }
105 105
 
106
-add_action( 'plugins_loaded', 'give_register_batch_exporters' );
106
+add_action('plugins_loaded', 'give_register_batch_exporters');
107 107
 
108 108
 /**
109 109
  * Register the payments batch exporter
110 110
  * @since  1.5
111 111
  */
112 112
 function give_register_payments_batch_export() {
113
-	add_action( 'give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1 );
113
+	add_action('give_batch_export_class_include', 'give_include_payments_batch_processor', 10, 1);
114 114
 }
115 115
 
116
-add_action( 'give_register_batch_exporter', 'give_register_payments_batch_export', 10 );
116
+add_action('give_register_batch_exporter', 'give_register_payments_batch_export', 10);
117 117
 
118 118
 /**
119 119
  * Loads the payments batch process if needed
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @return void
126 126
  */
127
-function give_include_payments_batch_processor( $class ) {
127
+function give_include_payments_batch_processor($class) {
128 128
 
129
-	if ( 'Give_Batch_Payments_Export' === $class ) {
130
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-payments.php';
129
+	if ('Give_Batch_Payments_Export' === $class) {
130
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-payments.php';
131 131
 	}
132 132
 
133 133
 }
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
  * @since  1.5.2
138 138
  */
139 139
 function give_register_customers_batch_export() {
140
-	add_action( 'give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1 );
140
+	add_action('give_batch_export_class_include', 'give_include_customers_batch_processor', 10, 1);
141 141
 }
142 142
 
143
-add_action( 'give_register_batch_exporter', 'give_register_customers_batch_export', 10 );
143
+add_action('give_register_batch_exporter', 'give_register_customers_batch_export', 10);
144 144
 
145 145
 /**
146 146
  * Loads the customers batch process if needed
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
  *
152 152
  * @return void
153 153
  */
154
-function give_include_customers_batch_processor( $class ) {
154
+function give_include_customers_batch_processor($class) {
155 155
 
156
-	if ( 'Give_Batch_Customers_Export' === $class ) {
157
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-customers.php';
156
+	if ('Give_Batch_Customers_Export' === $class) {
157
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-customers.php';
158 158
 	}
159 159
 
160 160
 }
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
  * @since  1.5
166 166
  */
167 167
 function give_register_forms_batch_export() {
168
-	add_action( 'give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1 );
168
+	add_action('give_batch_export_class_include', 'give_include_forms_batch_processor', 10, 1);
169 169
 }
170 170
 
171
-add_action( 'give_register_batch_exporter', 'give_register_forms_batch_export', 10 );
171
+add_action('give_register_batch_exporter', 'give_register_forms_batch_export', 10);
172 172
 
173 173
 /**
174 174
  * Loads the file downloads batch process if needed
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return void
181 181
  */
182
-function give_include_forms_batch_processor( $class ) {
182
+function give_include_forms_batch_processor($class) {
183 183
 
184
-	if ( 'Give_Batch_Forms_Export' === $class ) {
185
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/class-batch-export-forms.php';
184
+	if ('Give_Batch_Forms_Export' === $class) {
185
+		require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/class-batch-export-forms.php';
186 186
 	}
187 187
 
188 188
 }
189 189
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/reporting/class-settings-earnings.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Earnings' ) ) :
16
+if ( ! class_exists('Give_Settings_Earnings')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Earnings.
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 		 */
44 44
 		public function __construct() {
45 45
 			$this->id    = 'earnings';
46
-			$this->label = esc_html__( 'Income', 'give' );
46
+			$this->label = esc_html__('Income', 'give');
47 47
 
48
-			add_filter( 'give-reports_tabs_array', array( $this, 'add_settings_page' ), 20 );
49
-			add_action( "give-reports_settings_{$this->id}_page", array( $this, 'output' ) );
50
-			add_action( 'give_admin_field_report_earnings', array( $this, 'render_report_earnings_field' ), 10, 2 );
48
+			add_filter('give-reports_tabs_array', array($this, 'add_settings_page'), 20);
49
+			add_action("give-reports_settings_{$this->id}_page", array($this, 'output'));
50
+			add_action('give_admin_field_report_earnings', array($this, 'render_report_earnings_field'), 10, 2);
51 51
 
52 52
 			// Do not use main form for this tab.
53
-			if( give_get_current_setting_tab() === $this->id ) {
54
-				add_action( 'give-reports_open_form', '__return_empty_string' );
55
-				add_action( 'give-reports_close_form', '__return_empty_string' );
53
+			if (give_get_current_setting_tab() === $this->id) {
54
+				add_action('give-reports_open_form', '__return_empty_string');
55
+				add_action('give-reports_close_form', '__return_empty_string');
56 56
 			}
57 57
 		}
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 		 * @param  array $pages Lst of pages.
64 64
 		 * @return array
65 65
 		 */
66
-		public function add_settings_page( $pages ) {
67
-			$pages[ $this->id ] = $this->label;
66
+		public function add_settings_page($pages) {
67
+			$pages[$this->id] = $this->label;
68 68
 
69 69
 			return $pages;
70 70
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			 * @param  array $settings
87 87
 			 */
88 88
 			$settings = apply_filters(
89
-				'give_get_settings_' . $this->id,
89
+				'give_get_settings_'.$this->id,
90 90
 				array(
91 91
 					array(
92 92
 						'id'   => 'give_tools_earnings',
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 					),
96 96
 					array(
97 97
 						'id'   => 'earnings',
98
-						'name' => esc_html__( 'Income', 'give' ),
98
+						'name' => esc_html__('Income', 'give'),
99 99
 						'type' => 'report_earnings',
100 100
 					),
101 101
 					array(
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		public function output() {
120 120
 			$settings = $this->get_settings();
121 121
 
122
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
122
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
123 123
 		}
124 124
 
125 125
 		/**
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		 * @param $field
132 132
 		 * @param $option_value
133 133
 		 */
134
-		public function render_report_earnings_field( $field, $option_value ) {
135
-			do_action( 'give_reports_view_earnings' );
134
+		public function render_report_earnings_field($field, $option_value) {
135
+			do_action('give_reports_view_earnings');
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -25,35 +25,35 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_automatic_upgrades() {
27 27
 	$did_upgrade  = false;
28
-	$give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) );
28
+	$give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version'));
29 29
 
30
-	if ( ! $give_version ) {
30
+	if ( ! $give_version) {
31 31
 		// 1.0 is the first version to use this option so we must add it.
32 32
 		$give_version = '1.0';
33 33
 	}
34 34
 
35
-	switch ( true ) {
35
+	switch (true) {
36 36
 
37
-		case version_compare( $give_version, '1.6', '<' ) :
37
+		case version_compare($give_version, '1.6', '<') :
38 38
 			give_v16_upgrades();
39 39
 			$did_upgrade = true;
40 40
 
41
-		case version_compare( $give_version, '1.7', '<' ) :
41
+		case version_compare($give_version, '1.7', '<') :
42 42
 			give_v17_upgrades();
43 43
 			$did_upgrade = true;
44 44
 
45
-		case version_compare( $give_version, '1.8', '<' ) :
45
+		case version_compare($give_version, '1.8', '<') :
46 46
 			give_v18_upgrades();
47 47
 			$did_upgrade = true;
48 48
 	}
49 49
 
50
-	if ( $did_upgrade ) {
51
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
50
+	if ($did_upgrade) {
51
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
52 52
 	}
53 53
 }
54 54
 
55
-add_action( 'admin_init', 'give_do_automatic_upgrades' );
56
-add_action( 'give_upgrades', 'give_do_automatic_upgrades' );
55
+add_action('admin_init', 'give_do_automatic_upgrades');
56
+add_action('give_upgrades', 'give_do_automatic_upgrades');
57 57
 
58 58
 /**
59 59
  * Display Upgrade Notices
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
  */
64 64
 function give_show_upgrade_notices() {
65 65
 	// Don't show notices on the upgrades page.
66
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
66
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
67 67
 		return;
68 68
 	}
69 69
 
70
-	$give_version = get_option( 'give_version' );
70
+	$give_version = get_option('give_version');
71 71
 
72
-	if ( ! $give_version ) {
72
+	if ( ! $give_version) {
73 73
 		// 1.0 is the first version to use this option so we must add it.
74 74
 		$give_version = '1.0';
75 75
 	}
76 76
 
77
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
77
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
78 78
 
79 79
 	/*
80 80
 	 *  NOTICE:
@@ -85,31 +85,31 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 
87 87
 	// v1.3.2 Upgrades
88
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
88
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
89 89
 		printf(
90 90
 			/* translators: %s: upgrade URL */
91
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
92
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
91
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
92
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
93 93
 		);
94 94
 	}
95 95
 
96 96
 	// v1.3.4 Upgrades //ensure the user has gone through 1.3.4.
97
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
97
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
98 98
 		printf(
99 99
 			/* translators: %s: upgrade URL */
100
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
101
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
100
+			'<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
101
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
102 102
 		);
103 103
 	}
104 104
 
105 105
 	// Check if we have a stalled upgrade.
106 106
 	$resume_upgrade = give_maybe_resume_upgrade();
107
-	if ( ! empty( $resume_upgrade ) ) {
108
-		$resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) );
107
+	if ( ! empty($resume_upgrade)) {
108
+		$resume_url = add_query_arg($resume_upgrade, admin_url('index.php'));
109 109
 		echo Give_Notices::notice_html(
110 110
 			sprintf(
111
-				__( 'Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give' ),
112
-				esc_url( $resume_url )
111
+				__('Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give'),
112
+				esc_url($resume_url)
113 113
 			)
114 114
 		);
115 115
 
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 	}
118 118
 
119 119
 	// v1.8 form metadata upgrades.
120
-	if ( version_compare( $give_version, '1.8', '<' ) || ! give_has_upgrade_completed( 'v18_upgrades_form_metadata' ) ) {
120
+	if (version_compare($give_version, '1.8', '<') || ! give_has_upgrade_completed('v18_upgrades_form_metadata')) {
121 121
 		echo Give_Notices::notice_html(
122 122
 			sprintf(
123
-				esc_html__( 'Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give' ),
124
-				'<a class="give-upgrade-link" href="' . esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata' ) ) . '">',
123
+				esc_html__('Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give'),
124
+				'<a class="give-upgrade-link" href="'.esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata')).'">',
125 125
 				'</a>'
126 126
 			)
127 127
 		);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	<?php
150 150
 }
151 151
 
152
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
152
+add_action('admin_notices', 'give_show_upgrade_notices');
153 153
 
154 154
 /**
155 155
  * Triggers all upgrade functions
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
  */
162 162
 function give_trigger_upgrades() {
163 163
 
164
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
165
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
164
+	if ( ! current_user_can('manage_give_settings')) {
165
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
166 166
 			'response' => 403,
167
-		) );
167
+		));
168 168
 	}
169 169
 
170
-	$give_version = get_option( 'give_version' );
170
+	$give_version = get_option('give_version');
171 171
 
172
-	if ( ! $give_version ) {
172
+	if ( ! $give_version) {
173 173
 		// 1.0 is the first version to use this option so we must add it.
174 174
 		$give_version = '1.0';
175
-		add_option( 'give_version', $give_version );
175
+		add_option('give_version', $give_version);
176 176
 	}
177 177
 
178
-	update_option( 'give_version', GIVE_VERSION );
179
-	delete_option( 'give_doing_upgrade' );
178
+	update_option('give_version', GIVE_VERSION);
179
+	delete_option('give_doing_upgrade');
180 180
 
181
-	if ( DOING_AJAX ) {
182
-		die( 'complete' );
181
+	if (DOING_AJAX) {
182
+		die('complete');
183 183
 	} // End if().
184 184
 }
185 185
 
186
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
186
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
187 187
 
188 188
 /**
189 189
  * Check if the upgrade routine has been run for a specific action
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
  *
195 195
  * @return bool                   If the action has been added to the completed actions array
196 196
  */
197
-function give_has_upgrade_completed( $upgrade_action = '' ) {
197
+function give_has_upgrade_completed($upgrade_action = '') {
198 198
 
199
-	if ( empty( $upgrade_action ) ) {
199
+	if (empty($upgrade_action)) {
200 200
 		return false;
201 201
 	}
202 202
 
203 203
 	$completed_upgrades = give_get_completed_upgrades();
204 204
 
205
-	return in_array( $upgrade_action, $completed_upgrades );
205
+	return in_array($upgrade_action, $completed_upgrades);
206 206
 
207 207
 }
208 208
 
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
  * @return mixed   When nothing to resume returns false, otherwise starts the upgrade where it left off
215 215
  */
216 216
 function give_maybe_resume_upgrade() {
217
-	$doing_upgrade = get_option( 'give_doing_upgrade', false );
218
-	if ( empty( $doing_upgrade ) ) {
217
+	$doing_upgrade = get_option('give_doing_upgrade', false);
218
+	if (empty($doing_upgrade)) {
219 219
 		return false;
220 220
 	}
221 221
 
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return bool                   If the function was successfully added
233 233
  */
234
-function give_set_upgrade_complete( $upgrade_action = '' ) {
234
+function give_set_upgrade_complete($upgrade_action = '') {
235 235
 
236
-	if ( empty( $upgrade_action ) ) {
236
+	if (empty($upgrade_action)) {
237 237
 		return false;
238 238
 	}
239 239
 
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 	$completed_upgrades[] = $upgrade_action;
242 242
 
243 243
 	// Remove any blanks, and only show uniques.
244
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
244
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
245 245
 
246
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
246
+	return update_option('give_completed_upgrades', $completed_upgrades);
247 247
 }
248 248
 
249 249
 /**
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
  */
255 255
 function give_get_completed_upgrades() {
256 256
 
257
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
257
+	$completed_upgrades = get_option('give_completed_upgrades');
258 258
 
259
-	if ( false === $completed_upgrades ) {
259
+	if (false === $completed_upgrades) {
260 260
 		$completed_upgrades = array();
261 261
 	}
262 262
 
@@ -273,31 +273,31 @@  discard block
 block discarded – undo
273 273
  */
274 274
 function give_v132_upgrade_give_payment_customer_id() {
275 275
 	global $wpdb;
276
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
277
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
276
+	if ( ! current_user_can('manage_give_settings')) {
277
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
278 278
 			'response' => 403,
279
-		) );
279
+		));
280 280
 	}
281 281
 
282
-	ignore_user_abort( true );
282
+	ignore_user_abort(true);
283 283
 
284
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
285
-		@set_time_limit( 0 );
284
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
285
+		@set_time_limit(0);
286 286
 	}
287 287
 
288 288
 	// UPDATE DB METAKEYS.
289 289
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
290
-	$query = $wpdb->query( $sql );
290
+	$query = $wpdb->query($sql);
291 291
 
292
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
293
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
294
-	delete_option( 'give_doing_upgrade' );
295
-	wp_redirect( admin_url() );
292
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
293
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
294
+	delete_option('give_doing_upgrade');
295
+	wp_redirect(admin_url());
296 296
 	exit;
297 297
 
298 298
 }
299 299
 
300
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
300
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
301 301
 
302 302
 /**
303 303
  * Upgrades the Offline Status
@@ -310,16 +310,16 @@  discard block
 block discarded – undo
310 310
 
311 311
 	global $wpdb;
312 312
 
313
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
314
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
313
+	if ( ! current_user_can('manage_give_settings')) {
314
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
315 315
 			'response' => 403,
316
-		) );
316
+		));
317 317
 	}
318 318
 
319
-	ignore_user_abort( true );
319
+	ignore_user_abort(true);
320 320
 
321
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
322
-		@set_time_limit( 0 );
321
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
322
+		@set_time_limit(0);
323 323
 	}
324 324
 
325 325
 	// Get abandoned offline payments.
@@ -329,31 +329,31 @@  discard block
 block discarded – undo
329 329
 	$where .= "AND ( p.post_status = 'abandoned' )";
330 330
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
331 331
 
332
-	$sql            = $select . $join . $where;
333
-	$found_payments = $wpdb->get_col( $sql );
332
+	$sql            = $select.$join.$where;
333
+	$found_payments = $wpdb->get_col($sql);
334 334
 
335
-	foreach ( $found_payments as $payment ) {
335
+	foreach ($found_payments as $payment) {
336 336
 
337 337
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
338
-		$modified_time = get_post_modified_time( 'U', false, $payment );
338
+		$modified_time = get_post_modified_time('U', false, $payment);
339 339
 
340 340
 		// 1450124863 =  12/10/2015 20:42:25.
341
-		if ( $modified_time >= 1450124863 ) {
341
+		if ($modified_time >= 1450124863) {
342 342
 
343
-			give_update_payment_status( $payment, 'pending' );
343
+			give_update_payment_status($payment, 'pending');
344 344
 
345 345
 		}
346 346
 	}
347 347
 
348
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
349
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
350
-	delete_option( 'give_doing_upgrade' );
351
-	wp_redirect( admin_url() );
348
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
349
+	give_set_upgrade_complete('upgrade_give_offline_status');
350
+	delete_option('give_doing_upgrade');
351
+	wp_redirect(admin_url());
352 352
 	exit;
353 353
 
354 354
 }
355 355
 
356
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
356
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
357 357
 
358 358
 /**
359 359
  * Cleanup User Roles
@@ -364,17 +364,17 @@  discard block
 block discarded – undo
364 364
  */
365 365
 function give_v152_cleanup_users() {
366 366
 
367
-	$give_version = get_option( 'give_version' );
367
+	$give_version = get_option('give_version');
368 368
 
369
-	if ( ! $give_version ) {
369
+	if ( ! $give_version) {
370 370
 		// 1.0 is the first version to use this option so we must add it.
371 371
 		$give_version = '1.0';
372 372
 	}
373 373
 
374
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
374
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
375 375
 
376 376
 	// v1.5.2 Upgrades
377
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
377
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
378 378
 
379 379
 		// Delete all caps with "ss".
380 380
 		// Also delete all unused "campaign" roles.
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
 		);
422 422
 
423 423
 		global $wp_roles;
424
-		foreach ( $delete_caps as $cap ) {
425
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
426
-				$wp_roles->remove_cap( $role, $cap );
424
+		foreach ($delete_caps as $cap) {
425
+			foreach (array_keys($wp_roles->roles) as $role) {
426
+				$wp_roles->remove_cap($role, $cap);
427 427
 			}
428 428
 		}
429 429
 
@@ -433,15 +433,15 @@  discard block
 block discarded – undo
433 433
 		$roles->add_caps();
434 434
 
435 435
 		// The Update Ran.
436
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
437
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
438
-		delete_option( 'give_doing_upgrade' );
436
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
437
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
438
+		delete_option('give_doing_upgrade');
439 439
 
440 440
 	}// End if().
441 441
 
442 442
 }
443 443
 
444
-add_action( 'admin_init', 'give_v152_cleanup_users' );
444
+add_action('admin_init', 'give_v152_cleanup_users');
445 445
 
446 446
 /**
447 447
  * 1.6 Upgrade routine to create the customer meta table.
@@ -481,53 +481,53 @@  discard block
 block discarded – undo
481 481
 
482 482
 	// Get addons license key.
483 483
 	$addons = array();
484
-	foreach ( $give_options as $key => $value ) {
485
-		if ( false !== strpos( $key, '_license_key' ) ) {
486
-			$addons[ $key ] = $value;
484
+	foreach ($give_options as $key => $value) {
485
+		if (false !== strpos($key, '_license_key')) {
486
+			$addons[$key] = $value;
487 487
 		}
488 488
 	}
489 489
 
490 490
 	// Bailout: We do not have any addon license data to upgrade.
491
-	if ( empty( $addons ) ) {
491
+	if (empty($addons)) {
492 492
 		return false;
493 493
 	}
494 494
 
495
-	foreach ( $addons as $key => $addon_license ) {
495
+	foreach ($addons as $key => $addon_license) {
496 496
 
497 497
 		// Get addon shortname.
498
-		$shortname = str_replace( '_license_key', '', $key );
498
+		$shortname = str_replace('_license_key', '', $key);
499 499
 
500 500
 		// Addon license option name.
501
-		$addon_license_option_name = $shortname . '_license_active';
501
+		$addon_license_option_name = $shortname.'_license_active';
502 502
 
503 503
 		// bailout if license is empty.
504
-		if ( empty( $addon_license ) ) {
505
-			delete_option( $addon_license_option_name );
504
+		if (empty($addon_license)) {
505
+			delete_option($addon_license_option_name);
506 506
 			continue;
507 507
 		}
508 508
 
509 509
 		// Get addon name.
510 510
 		$addon_name       = array();
511
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
512
-		foreach ( $addon_name_parts as $name_part ) {
511
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
512
+		foreach ($addon_name_parts as $name_part) {
513 513
 
514 514
 			// Fix addon name
515
-			switch ( $name_part ) {
515
+			switch ($name_part) {
516 516
 				case 'authorizenet' :
517 517
 					$name_part = 'authorize.net';
518 518
 					break;
519 519
 			}
520 520
 
521
-			$addon_name[] = ucfirst( $name_part );
521
+			$addon_name[] = ucfirst($name_part);
522 522
 		}
523 523
 
524
-		$addon_name = implode( ' ', $addon_name );
524
+		$addon_name = implode(' ', $addon_name);
525 525
 
526 526
 		// Data to send to the API
527 527
 		$api_params = array(
528 528
 			'edd_action' => 'activate_license', // never change from "edd_" to "give_"!
529 529
 			'license'    => $addon_license,
530
-			'item_name'  => urlencode( $addon_name ),
530
+			'item_name'  => urlencode($addon_name),
531 531
 			'url'        => home_url(),
532 532
 		);
533 533
 
@@ -542,17 +542,17 @@  discard block
 block discarded – undo
542 542
 		);
543 543
 
544 544
 		// Make sure there are no errors.
545
-		if ( is_wp_error( $response ) ) {
546
-			delete_option( $addon_license_option_name );
545
+		if (is_wp_error($response)) {
546
+			delete_option($addon_license_option_name);
547 547
 			continue;
548 548
 		}
549 549
 
550 550
 		// Tell WordPress to look for updates.
551
-		set_site_transient( 'update_plugins', null );
551
+		set_site_transient('update_plugins', null);
552 552
 
553 553
 		// Decode license data.
554
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
555
-		update_option( $addon_license_option_name, $license_data );
554
+		$license_data = json_decode(wp_remote_retrieve_body($response));
555
+		update_option($addon_license_option_name, $license_data);
556 556
 	}// End foreach().
557 557
 }
558 558
 
@@ -582,9 +582,9 @@  discard block
 block discarded – undo
582 582
 	);
583 583
 
584 584
 	global $wp_roles;
585
-	foreach ( $delete_caps as $cap ) {
586
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
587
-			$wp_roles->remove_cap( $role, $cap );
585
+	foreach ($delete_caps as $cap) {
586
+		foreach (array_keys($wp_roles->roles) as $role) {
587
+			$wp_roles->remove_cap($role, $cap);
588 588
 		}
589 589
 	}
590 590
 
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 function give_v18_upgrades_core_setting() {
619 619
 	// Core settings which changes from checkbox to radio.
620 620
 	$core_setting_names = array_merge(
621
-		array_keys( give_v18_renamed_core_settings() ),
621
+		array_keys(give_v18_renamed_core_settings()),
622 622
 		array(
623 623
 			'uninstall_on_delete',
624 624
 			'scripts_footer',
@@ -630,48 +630,48 @@  discard block
 block discarded – undo
630 630
 	);
631 631
 
632 632
 	// Bailout: If not any setting define.
633
-	if ( $give_settings = get_option( 'give_settings' ) ) {
633
+	if ($give_settings = get_option('give_settings')) {
634 634
 
635 635
 		$setting_changed = false;
636 636
 
637 637
 		// Loop: check each setting field.
638
-		foreach ( $core_setting_names as $setting_name ) {
638
+		foreach ($core_setting_names as $setting_name) {
639 639
 			// New setting name.
640
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
640
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
641 641
 
642 642
 			// Continue: If setting already set.
643 643
 			if (
644
-				array_key_exists( $new_setting_name, $give_settings )
645
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
644
+				array_key_exists($new_setting_name, $give_settings)
645
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
646 646
 			) {
647 647
 				continue;
648 648
 			}
649 649
 
650 650
 			// Set checkbox value to radio value.
651
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
651
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
652 652
 
653 653
 			// @see https://github.com/WordImpress/Give/issues/1063
654
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
654
+			if (false !== strpos($setting_name, 'disable_')) {
655 655
 
656
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
657
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
656
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
657
+			} elseif (false !== strpos($setting_name, 'enable_')) {
658 658
 
659
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' );
659
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled');
660 660
 			}
661 661
 
662 662
 			// Tell bot to update core setting to db.
663
-			if ( ! $setting_changed ) {
663
+			if ( ! $setting_changed) {
664 664
 				$setting_changed = true;
665 665
 			}
666 666
 		}
667 667
 
668 668
 		// Update setting only if they changed.
669
-		if ( $setting_changed ) {
670
-			update_option( 'give_settings', $give_settings );
669
+		if ($setting_changed) {
670
+			update_option('give_settings', $give_settings);
671 671
 		}
672 672
 	}// End if().
673 673
 
674
-	give_set_upgrade_complete( 'v18_upgrades_core_setting' );
674
+	give_set_upgrade_complete('v18_upgrades_core_setting');
675 675
 }
676 676
 
677 677
 /**
@@ -681,22 +681,22 @@  discard block
 block discarded – undo
681 681
  * @return void
682 682
  */
683 683
 function give_v18_upgrades_form_metadata() {
684
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
685
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array(
684
+	if ( ! current_user_can('manage_give_settings')) {
685
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array(
686 686
 			'response' => 403,
687
-		) );
687
+		));
688 688
 	}
689 689
 
690
-	ignore_user_abort( true );
690
+	ignore_user_abort(true);
691 691
 
692
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
693
-		@set_time_limit( 0 );
692
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
693
+		@set_time_limit(0);
694 694
 	}
695 695
 
696
-	$step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1;
696
+	$step = isset($_GET['step']) ? absint($_GET['step']) : 1;
697 697
 
698 698
 	// form query
699
-	$forms = new WP_Query( array(
699
+	$forms = new WP_Query(array(
700 700
 			'paged'          => $step,
701 701
 			'status'         => 'any',
702 702
 			'order'          => 'ASC',
@@ -706,27 +706,27 @@  discard block
 block discarded – undo
706 706
 	);
707 707
 
708 708
 
709
-	if ( $forms->have_posts() ) {
710
-		while ( $forms->have_posts() ) {
709
+	if ($forms->have_posts()) {
710
+		while ($forms->have_posts()) {
711 711
 			$forms->the_post();
712 712
 
713 713
 			// Form content.
714 714
 			// Note in version 1.8 display content setting split into display content and content placement setting.
715 715
 			// You can delete _give_content_option in future
716
-			$show_content = get_post_meta( get_the_ID(), '_give_content_option', true );
717
-			if ( $show_content && ! get_post_meta( get_the_ID(), '_give_display_content', true ) ) {
718
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
719
-				update_post_meta( get_the_ID(), '_give_display_content', $field_value );
716
+			$show_content = get_post_meta(get_the_ID(), '_give_content_option', true);
717
+			if ($show_content && ! get_post_meta(get_the_ID(), '_give_display_content', true)) {
718
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
719
+				update_post_meta(get_the_ID(), '_give_display_content', $field_value);
720 720
 
721
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
722
-				update_post_meta( get_the_ID(), '_give_content_placement', $field_value );
721
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
722
+				update_post_meta(get_the_ID(), '_give_content_placement', $field_value);
723 723
 			}
724 724
             
725 725
 			// "Disable" Guest Donation. Checkbox
726 726
 			// See: https://github.com/WordImpress/Give/issues/1470
727
-			$guest_donation = get_post_meta( get_the_ID(), '_give_logged_in_only', true );
728
-			$guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' );
729
-			update_post_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval );
727
+			$guest_donation = get_post_meta(get_the_ID(), '_give_logged_in_only', true);
728
+			$guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled');
729
+			update_post_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval);
730 730
 
731 731
 			// Convert yes/no setting field to enabled/disabled.
732 732
 			$form_radio_settings = array(
@@ -749,15 +749,15 @@  discard block
 block discarded – undo
749 749
 				'_give_offline_donation_enable_billing_fields_single',
750 750
 			);
751 751
 
752
-			foreach ( $form_radio_settings as $meta_key ) {
752
+			foreach ($form_radio_settings as $meta_key) {
753 753
 				// Get value.
754
-				$field_value = get_post_meta( get_the_ID(), $meta_key, true );
754
+				$field_value = get_post_meta(get_the_ID(), $meta_key, true);
755 755
 
756 756
 				// Convert meta value only if it is in yes/no/none.
757
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
757
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
758 758
 
759
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
760
-					update_post_meta( get_the_ID(), $meta_key, $field_value );
759
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
760
+					update_post_meta(get_the_ID(), $meta_key, $field_value);
761 761
 				}
762 762
 			}
763 763
 		}// End while().
@@ -765,28 +765,28 @@  discard block
 block discarded – undo
765 765
 		wp_reset_postdata();
766 766
 
767 767
 		// Forms found so upgrade them
768
-		$step ++;
769
-		$redirect = add_query_arg( array(
768
+		$step++;
769
+		$redirect = add_query_arg(array(
770 770
 			'page'         => 'give-upgrades',
771 771
 			'give-upgrade' => 'give_v18_upgrades_form_metadata',
772 772
 			'step'         => $step,
773
-		), admin_url( 'index.php' ) );
774
-		wp_redirect( $redirect );
773
+		), admin_url('index.php'));
774
+		wp_redirect($redirect);
775 775
 		exit();
776 776
 
777 777
 	} else {
778 778
 		// No more forms found, finish up.
779
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
780
-		delete_option( 'give_doing_upgrade' );
781
-		give_set_upgrade_complete( 'v18_upgrades_form_metadata' );
779
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
780
+		delete_option('give_doing_upgrade');
781
+		give_set_upgrade_complete('v18_upgrades_form_metadata');
782 782
 
783 783
 
784
-		wp_redirect( admin_url() );
784
+		wp_redirect(admin_url());
785 785
 		exit;
786 786
 	}
787 787
 }
788 788
 
789
-add_action( 'give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata' );
789
+add_action('give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata');
790 790
 
791 791
 /**
792 792
  * Get list of core setting renamed in version 1.8.
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -654,7 +654,7 @@
 block discarded – undo
654 654
 
655 655
                         <div id="<?php echo $setting['id']; ?>"
656 656
                              class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' );
657
-						     $show_first_tab_content = false; ?>">
657
+							 $show_first_tab_content = false; ?>">
658 658
 							<?php if ( ! empty( $setting['fields'] ) ) : ?>
659 659
 								<?php foreach ( $setting['fields'] as $field ) : ?>
660 660
 									<?php give_render_field( $field ); ?>
Please login to merge, or discard this patch.
Spacing   +289 added lines, -289 removed lines patch added patch discarded remove patch
@@ -46,24 +46,24 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function __construct() {
48 48
 		$this->metabox_id    = 'give-metabox-form-data';
49
-		$this->metabox_label = esc_html__( 'Donation Form Options', 'give' );
49
+		$this->metabox_label = esc_html__('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' ), 30 );
55
+		add_action('add_meta_boxes', array($this, 'add_meta_box'), 30);
56 56
 
57 57
 		// Load required scripts.
58
-		add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) );
58
+		add_action('admin_enqueue_scripts', array($this, 'enqueue_script'));
59 59
 
60 60
 		// Save form meta.
61
-		add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 );
61
+		add_action('save_post_give_forms', array($this, 'save'), 10, 2);
62 62
 
63 63
 		// cmb2 old setting loaders.
64 64
 		// add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) );
65 65
 		// Add offline donations options.
66
-		add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 );
66
+		add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1);
67 67
 	}
68 68
 
69 69
 
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	function get_settings() {
88 88
 		$post_id               = give_get_admin_post_id();
89
-		$price                 = give_get_form_price( $post_id );
90
-		$custom_amount_minimum = give_get_form_minimum_price( $post_id );
91
-		$goal                  = give_get_form_goal( $post_id );
89
+		$price                 = give_get_form_price($post_id);
90
+		$custom_amount_minimum = give_get_form_minimum_price($post_id);
91
+		$goal                  = give_get_form_goal($post_id);
92 92
 
93 93
 		// No empty prices - min. 1.00 for new forms
94
-		if ( empty( $price ) && is_null( $post_id ) ) {
95
-			$price = esc_attr( give_format_decimal( '1.00' ) );
94
+		if (empty($price) && is_null($post_id)) {
95
+			$price = esc_attr(give_format_decimal('1.00'));
96 96
 		}
97 97
 
98 98
 		// Min. $1.00 for new forms
99
-		if ( empty( $custom_amount_minimum ) ) {
100
-			$custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) );
99
+		if (empty($custom_amount_minimum)) {
100
+			$custom_amount_minimum = esc_attr(give_format_decimal('1.00'));
101 101
 		}
102 102
 
103 103
 		// Start with an underscore to hide fields from custom fields list
@@ -107,213 +107,213 @@  discard block
 block discarded – undo
107 107
 			/**
108 108
 			 * Repeatable Field Groups
109 109
 			 */
110
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
110
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
111 111
 				'id'     => 'form_field_options',
112
-				'title'  => esc_html__( 'Donation Options', 'give' ),
113
-				'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array(
112
+				'title'  => esc_html__('Donation Options', 'give'),
113
+				'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(
114 114
 					// Donation Option
115 115
 					array(
116
-						'name'        => esc_html__( 'Donation Option', 'give' ),
117
-						'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
118
-						'id'          => $prefix . 'price_option',
116
+						'name'        => esc_html__('Donation Option', 'give'),
117
+						'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
118
+						'id'          => $prefix.'price_option',
119 119
 						'type'        => 'radio_inline',
120 120
 						'default'     => 'set',
121
-						'options'     => apply_filters( 'give_forms_price_options', array(
122
-							'set'   => esc_html__( 'Set Donation', 'give' ),
123
-							'multi' => esc_html__( 'Multi-level Donation', 'give' ),
124
-						) ),
121
+						'options'     => apply_filters('give_forms_price_options', array(
122
+							'set'   => esc_html__('Set Donation', 'give'),
123
+							'multi' => esc_html__('Multi-level Donation', 'give'),
124
+						)),
125 125
 					),
126 126
 					array(
127
-						'name'        => esc_html__( 'Set Donation', 'give' ),
128
-						'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
129
-						'id'          => $prefix . 'set_price',
127
+						'name'        => esc_html__('Set Donation', 'give'),
128
+						'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
129
+						'id'          => $prefix.'set_price',
130 130
 						'type'        => 'text_small',
131 131
 						'data_type'   => 'price',
132 132
 						'attributes'  => array(
133
-							'placeholder' => give_format_decimal( '1.00' ),
134
-							'value'       => give_format_decimal( $price ),
133
+							'placeholder' => give_format_decimal('1.00'),
134
+							'value'       => give_format_decimal($price),
135 135
 							'class'       => 'give-money-field',
136 136
 						),
137 137
 					),
138 138
 					// Display Style
139 139
 					array(
140
-						'name'        => esc_html__( 'Display Style', 'give' ),
141
-						'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
142
-						'id'          => $prefix . 'display_style',
140
+						'name'        => esc_html__('Display Style', 'give'),
141
+						'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
142
+						'id'          => $prefix.'display_style',
143 143
 						'type'        => 'radio_inline',
144 144
 						'default'     => 'buttons',
145 145
 						'options'     => array(
146
-							'buttons'  => esc_html__( 'Buttons', 'give' ),
147
-							'radios'   => esc_html__( 'Radios', 'give' ),
148
-							'dropdown' => esc_html__( 'Dropdown', 'give' ),
146
+							'buttons'  => esc_html__('Buttons', 'give'),
147
+							'radios'   => esc_html__('Radios', 'give'),
148
+							'dropdown' => esc_html__('Dropdown', 'give'),
149 149
 						),
150 150
 					),
151 151
 					// Custom Amount
152 152
 					array(
153
-						'name'        => esc_html__( 'Custom Amount', 'give' ),
154
-						'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
155
-						'id'          => $prefix . 'custom_amount',
153
+						'name'        => esc_html__('Custom Amount', 'give'),
154
+						'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
155
+						'id'          => $prefix.'custom_amount',
156 156
 						'type'        => 'radio_inline',
157 157
 						'default'     => 'disabled',
158 158
 						'options'     => array(
159
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
160
-							'disabled' => esc_html__( 'Disabled', 'give' ),
159
+							'enabled'  => esc_html__('Enabled', 'give'),
160
+							'disabled' => esc_html__('Disabled', 'give'),
161 161
 						),
162 162
 					),
163 163
 					array(
164
-						'name'        => esc_html__( 'Minimum Amount', 'give' ),
165
-						'description' => esc_html__( 'Enter the minimum custom donation amount.', 'give' ),
166
-						'id'          => $prefix . 'custom_amount_minimum',
164
+						'name'        => esc_html__('Minimum Amount', 'give'),
165
+						'description' => esc_html__('Enter the minimum custom donation amount.', 'give'),
166
+						'id'          => $prefix.'custom_amount_minimum',
167 167
 						'type'        => 'text_small',
168 168
 						'data_type'   => 'price',
169 169
 						'attributes'  => array(
170
-							'placeholder' => give_format_decimal( '1.00' ),
171
-							'value'       => give_format_decimal( $custom_amount_minimum ),
170
+							'placeholder' => give_format_decimal('1.00'),
171
+							'value'       => give_format_decimal($custom_amount_minimum),
172 172
 							'class'       => 'give-money-field',
173 173
 						),
174 174
 					),
175 175
 					array(
176
-						'name'        => esc_html__( 'Custom Amount Text', 'give' ),
177
-						'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
178
-						'id'          => $prefix . 'custom_amount_text',
176
+						'name'        => esc_html__('Custom Amount Text', 'give'),
177
+						'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
178
+						'id'          => $prefix.'custom_amount_text',
179 179
 						'type'        => 'text',
180 180
 						'attributes'  => array(
181 181
 							'rows'        => 3,
182
-							'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
182
+							'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
183 183
 						),
184 184
 					),
185 185
 					// Donation Levels: Repeatable CMB2 Group
186 186
 					array(
187
-						'id'      => $prefix . 'donation_levels',
187
+						'id'      => $prefix.'donation_levels',
188 188
 						'type'    => 'group',
189 189
 						'options' => array(
190
-							'add_button'    => esc_html__( 'Add Level', 'give' ),
191
-							'header_title'  => esc_html__( 'Donation Level', 'give' ),
190
+							'add_button'    => esc_html__('Add Level', 'give'),
191
+							'header_title'  => esc_html__('Donation Level', 'give'),
192 192
 							'remove_button' => '<span class="dashicons dashicons-no"></span>',
193 193
 						),
194 194
 						// Fields array works the same, except id's only need to be unique for this group.
195 195
 						// Prefix is not needed.
196
-						'fields'  => apply_filters( 'give_donation_levels_table_row', array(
196
+						'fields'  => apply_filters('give_donation_levels_table_row', array(
197 197
 							array(
198
-								'name' => esc_html__( 'ID', 'give' ),
199
-								'id'   => $prefix . 'id',
198
+								'name' => esc_html__('ID', 'give'),
199
+								'id'   => $prefix.'id',
200 200
 								'type' => 'levels_id',
201 201
 							),
202 202
 							array(
203
-								'name'       => esc_html__( 'Amount', 'give' ),
204
-								'id'         => $prefix . 'amount',
203
+								'name'       => esc_html__('Amount', 'give'),
204
+								'id'         => $prefix.'amount',
205 205
 								'type'       => 'text_small',
206 206
 								'data_type'  => 'price',
207 207
 								'attributes' => array(
208
-									'placeholder' => give_format_decimal( '1.00' ),
208
+									'placeholder' => give_format_decimal('1.00'),
209 209
 									'class'       => 'give-money-field',
210 210
 								),
211 211
 							),
212 212
 							array(
213
-								'name'       => esc_html__( 'Text', 'give' ),
214
-								'id'         => $prefix . 'text',
213
+								'name'       => esc_html__('Text', 'give'),
214
+								'id'         => $prefix.'text',
215 215
 								'type'       => 'text',
216 216
 								'attributes' => array(
217
-									'placeholder' => esc_html__( 'Donation Level', 'give' ),
217
+									'placeholder' => esc_html__('Donation Level', 'give'),
218 218
 									'class'       => 'give-multilevel-text-field',
219 219
 								),
220 220
 							),
221 221
 							array(
222
-								'name' => esc_html__( 'Default', 'give' ),
223
-								'id'   => $prefix . 'default',
222
+								'name' => esc_html__('Default', 'give'),
223
+								'id'   => $prefix.'default',
224 224
 								'type' => 'give_default_radio_inline',
225 225
 							),
226
-						) ),
226
+						)),
227 227
 					),
228 228
 					array(
229 229
 						'name'  => 'donation_options_docs',
230 230
 						'type'  => 'docs_link',
231 231
 						'url'   => 'http://docs.givewp.com/form-donation-options',
232
-						'title' => esc_html__( 'Donation Options', 'give' ),
232
+						'title' => esc_html__('Donation Options', 'give'),
233 233
 					),
234 234
 				),
235 235
 					$post_id
236 236
 				),
237
-			) ),
237
+			)),
238 238
 
239 239
 			/**
240 240
 			 * Display Options
241 241
 			 */
242
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
242
+			'form_display_options'  => apply_filters('give_form_display_options', array(
243 243
 					'id'     => 'form_display_options',
244
-					'title'  => esc_html__( 'Form Display', 'give' ),
245
-					'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array(
244
+					'title'  => esc_html__('Form Display', 'give'),
245
+					'fields' => apply_filters('give_forms_display_options_metabox_fields', array(
246 246
 						array(
247
-							'name'    => esc_html__( 'Display Options', 'give' ),
248
-							'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
249
-							'id'      => $prefix . 'payment_display',
247
+							'name'    => esc_html__('Display Options', 'give'),
248
+							'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
249
+							'id'      => $prefix.'payment_display',
250 250
 							'type'    => 'radio_inline',
251 251
 							'options' => array(
252
-								'onpage' => esc_html__( 'All Fields', 'give' ),
253
-								'modal'  => esc_html__( 'Modal', 'give' ),
254
-								'reveal' => esc_html__( 'Reveal', 'give' ),
255
-								'button' => esc_html__( 'Button', 'give' ),
252
+								'onpage' => esc_html__('All Fields', 'give'),
253
+								'modal'  => esc_html__('Modal', 'give'),
254
+								'reveal' => esc_html__('Reveal', 'give'),
255
+								'button' => esc_html__('Button', 'give'),
256 256
 							),
257 257
 							'default' => 'onpage',
258 258
 						),
259 259
 						array(
260
-							'id'         => $prefix . 'reveal_label',
261
-							'name'       => esc_html__( 'Continue Button', 'give' ),
262
-							'desc'       => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ),
260
+							'id'         => $prefix.'reveal_label',
261
+							'name'       => esc_html__('Continue Button', 'give'),
262
+							'desc'       => esc_html__('The button label for displaying the additional payment fields.', 'give'),
263 263
 							'type'       => 'text_small',
264 264
 							'attributes' => array(
265
-								'placeholder' => esc_attr__( 'Donate Now', 'give' ),
265
+								'placeholder' => esc_attr__('Donate Now', 'give'),
266 266
 							),
267 267
 						),
268 268
 						array(
269
-							'id'         => $prefix . 'checkout_label',
270
-							'name'       => esc_html__( 'Submit Button', 'give' ),
271
-							'desc'       => esc_html__( 'The button label for completing a donation.', 'give' ),
269
+							'id'         => $prefix.'checkout_label',
270
+							'name'       => esc_html__('Submit Button', 'give'),
271
+							'desc'       => esc_html__('The button label for completing a donation.', 'give'),
272 272
 							'type'       => 'text_small',
273 273
 							'attributes' => array(
274
-								'placeholder' => esc_html__( 'Donate Now', 'give' ),
274
+								'placeholder' => esc_html__('Donate Now', 'give'),
275 275
 							),
276 276
 						),
277 277
 						array(
278
-							'name' => esc_html__( 'Default Gateway', 'give' ),
279
-							'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
280
-							'id'   => $prefix . 'default_gateway',
278
+							'name' => esc_html__('Default Gateway', 'give'),
279
+							'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
280
+							'id'   => $prefix.'default_gateway',
281 281
 							'type' => 'default_gateway',
282 282
 						),
283 283
 						array(
284
-							'name'    => esc_html__( 'Guest Donations', 'give' ),
285
-							'desc'    => esc_html__( 'Do you want to allow non-logged-in users to make donations?', 'give' ),
286
-							'id'      => $prefix . 'logged_in_only',
284
+							'name'    => esc_html__('Guest Donations', 'give'),
285
+							'desc'    => esc_html__('Do you want to allow non-logged-in users to make donations?', 'give'),
286
+							'id'      => $prefix.'logged_in_only',
287 287
 							'type'    => 'radio_inline',
288 288
 							'default' => 'enabled',
289 289
 							'options' => array(
290
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
291
-								'disabled' => esc_html__( 'Disabled', 'give' ),
290
+								'enabled'  => esc_html__('Enabled', 'give'),
291
+								'disabled' => esc_html__('Disabled', 'give'),
292 292
 							),
293 293
 						),
294 294
 						array(
295
-							'name'    => esc_html__( 'Registration', 'give' ),
296
-							'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
297
-							'id'      => $prefix . 'show_register_form',
295
+							'name'    => esc_html__('Registration', 'give'),
296
+							'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
297
+							'id'      => $prefix.'show_register_form',
298 298
 							'type'    => 'radio',
299 299
 							'options' => array(
300
-								'none'         => esc_html__( 'None', 'give' ),
301
-								'registration' => esc_html__( 'Registration', 'give' ),
302
-								'login'        => esc_html__( 'Login', 'give' ),
303
-								'both'         => esc_html__( 'Registration + Login', 'give' ),
300
+								'none'         => esc_html__('None', 'give'),
301
+								'registration' => esc_html__('Registration', 'give'),
302
+								'login'        => esc_html__('Login', 'give'),
303
+								'both'         => esc_html__('Registration + Login', 'give'),
304 304
 							),
305 305
 							'default' => 'none',
306 306
 						),
307 307
 						array(
308
-							'name'    => esc_html__( 'Floating Labels', 'give' ),
308
+							'name'    => esc_html__('Floating Labels', 'give'),
309 309
 							/* translators: %s: forms http://docs.givewp.com/form-floating-labels */
310
-							'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' ) ),
311
-							'id'      => $prefix . 'form_floating_labels',
310
+							'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')),
311
+							'id'      => $prefix.'form_floating_labels',
312 312
 							'type'    => 'radio_inline',
313 313
 							'options' => array(
314
-								'global'   => esc_html__( 'Global Option', 'give' ),
315
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
316
-								'disabled' => esc_html__( 'Disabled', 'give' ),
314
+								'global'   => esc_html__('Global Option', 'give'),
315
+								'enabled'  => esc_html__('Enabled', 'give'),
316
+								'disabled' => esc_html__('Disabled', 'give'),
317 317
 							),
318 318
 							'default' => 'global',
319 319
 						),
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 							'name'  => 'form_display_docs',
322 322
 							'type'  => 'docs_link',
323 323
 							'url'   => 'http://docs.givewp.com/form-display-options',
324
-							'title' => esc_html__( 'Form Display', 'give' ),
324
+							'title' => esc_html__('Form Display', 'give'),
325 325
 						),
326 326
 					),
327 327
 						$post_id
@@ -332,190 +332,190 @@  discard block
 block discarded – undo
332 332
 			/**
333 333
 			 * Donation Goals
334 334
 			 */
335
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
335
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
336 336
 				'id'     => 'donation_goal_options',
337
-				'title'  => esc_html__( 'Donation Goal', 'give' ),
338
-				'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
337
+				'title'  => esc_html__('Donation Goal', 'give'),
338
+				'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array(
339 339
 					// Goals
340 340
 					array(
341
-						'name'        => esc_html__( 'Donation Goal', 'give' ),
342
-						'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
343
-						'id'          => $prefix . 'goal_option',
341
+						'name'        => esc_html__('Donation Goal', 'give'),
342
+						'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
343
+						'id'          => $prefix.'goal_option',
344 344
 						'type'        => 'radio_inline',
345 345
 						'default'     => 'disabled',
346 346
 						'options'     => array(
347
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
348
-							'disabled' => esc_html__( 'Disabled', 'give' ),
347
+							'enabled'  => esc_html__('Enabled', 'give'),
348
+							'disabled' => esc_html__('Disabled', 'give'),
349 349
 						),
350 350
 					),
351 351
 					array(
352
-						'name'        => esc_html__( 'Goal Amount', 'give' ),
353
-						'description' => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
354
-						'id'          => $prefix . 'set_goal',
352
+						'name'        => esc_html__('Goal Amount', 'give'),
353
+						'description' => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'),
354
+						'id'          => $prefix.'set_goal',
355 355
 						'type'        => 'text_small',
356 356
 						'data_type'   => 'price',
357 357
 						'attributes'  => array(
358
-							'placeholder' => give_format_decimal( '0.00' ),
359
-							'value'       => give_format_decimal( $goal ),
358
+							'placeholder' => give_format_decimal('0.00'),
359
+							'value'       => give_format_decimal($goal),
360 360
 							'class'       => 'give-money-field',
361 361
 						),
362 362
 					),
363 363
 
364 364
 					array(
365
-						'name'        => esc_html__( 'Goal Format', 'give' ),
366
-						'description' => esc_html__( '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' ),
367
-						'id'          => $prefix . 'goal_format',
365
+						'name'        => esc_html__('Goal Format', 'give'),
366
+						'description' => esc_html__('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'),
367
+						'id'          => $prefix.'goal_format',
368 368
 						'type'        => 'radio_inline',
369 369
 						'default'     => 'amount',
370 370
 						'options'     => array(
371
-							'amount'     => esc_html__( 'Amount', 'give' ),
372
-							'percentage' => esc_html__( 'Percentage', 'give' ),
371
+							'amount'     => esc_html__('Amount', 'give'),
372
+							'percentage' => esc_html__('Percentage', 'give'),
373 373
 						),
374 374
 					),
375 375
 					array(
376
-						'name'    => esc_html__( 'Progress Bar Color', 'give' ),
377
-						'desc'    => esc_html__( 'Customize the color of the goal progress bar.', 'give' ),
378
-						'id'      => $prefix . 'goal_color',
376
+						'name'    => esc_html__('Progress Bar Color', 'give'),
377
+						'desc'    => esc_html__('Customize the color of the goal progress bar.', 'give'),
378
+						'id'      => $prefix.'goal_color',
379 379
 						'type'    => 'colorpicker',
380 380
 						'default' => '#2bc253',
381 381
 					),
382 382
 
383 383
 					array(
384
-						'name'    => esc_html__( 'Close Form', 'give' ),
385
-						'desc'    => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
386
-						'id'      => $prefix . 'close_form_when_goal_achieved',
384
+						'name'    => esc_html__('Close Form', 'give'),
385
+						'desc'    => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
386
+						'id'      => $prefix.'close_form_when_goal_achieved',
387 387
 						'type'    => 'radio_inline',
388 388
 						'default' => 'disabled',
389 389
 						'options' => array(
390
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
391
-							'disabled' => esc_html__( 'Disabled', 'give' ),
390
+							'enabled'  => esc_html__('Enabled', 'give'),
391
+							'disabled' => esc_html__('Disabled', 'give'),
392 392
 						),
393 393
 					),
394 394
 					array(
395
-						'name'       => esc_html__( 'Goal Achieved Message', 'give' ),
396
-						'desc'       => esc_html__( 'Do you want to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
397
-						'id'         => $prefix . 'form_goal_achieved_message',
395
+						'name'       => esc_html__('Goal Achieved Message', 'give'),
396
+						'desc'       => esc_html__('Do you want to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
397
+						'id'         => $prefix.'form_goal_achieved_message',
398 398
 						'type'       => 'textarea',
399 399
 						'attributes' => array(
400
-							'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
400
+							'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'),
401 401
 						),
402 402
 					),
403 403
 					array(
404 404
 						'name'  => 'donation_goal_docs',
405 405
 						'type'  => 'docs_link',
406 406
 						'url'   => 'http://docs.givewp.com/form-donation-goal',
407
-						'title' => esc_html__( 'Donation Goal', 'give' ),
407
+						'title' => esc_html__('Donation Goal', 'give'),
408 408
 					),
409 409
 				),
410 410
 					$post_id
411 411
 				),
412
-			) ),
412
+			)),
413 413
 
414 414
 			/**
415 415
 			 * Content Field
416 416
 			 */
417
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
417
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
418 418
 				'id'     => 'form_content_options',
419
-				'title'  => esc_html__( 'Form Content', 'give' ),
420
-				'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array(
419
+				'title'  => esc_html__('Form Content', 'give'),
420
+				'fields' => apply_filters('give_forms_content_options_metabox_fields', array(
421 421
 
422 422
 					// Donation content.
423 423
 					array(
424
-						'name'        => esc_html__( 'Display Content', 'give' ),
425
-						'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ),
426
-						'id'          => $prefix . 'display_content',
424
+						'name'        => esc_html__('Display Content', 'give'),
425
+						'description' => esc_html__('Do you want to add custom content to this form?', 'give'),
426
+						'id'          => $prefix.'display_content',
427 427
 						'type'        => 'radio_inline',
428 428
 						'options'     => array(
429
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
430
-							'disabled' => esc_html__( 'Disabled', 'give' ),
429
+							'enabled'  => esc_html__('Enabled', 'give'),
430
+							'disabled' => esc_html__('Disabled', 'give'),
431 431
 						),
432 432
 						'default'     => 'disabled',
433 433
 					),
434 434
 
435 435
 					// Content placement.
436 436
 					array(
437
-						'name'        => esc_html__( 'Content Placement', 'give' ),
438
-						'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ),
439
-						'id'          => $prefix . 'content_placement',
437
+						'name'        => esc_html__('Content Placement', 'give'),
438
+						'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'),
439
+						'id'          => $prefix.'content_placement',
440 440
 						'type'        => 'radio_inline',
441
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
442
-								'give_pre_form'  => esc_html__( 'Above fields', 'give' ),
443
-								'give_post_form' => esc_html__( 'Below fields', 'give' ),
441
+						'options'     => apply_filters('give_forms_content_options_select', array(
442
+								'give_pre_form'  => esc_html__('Above fields', 'give'),
443
+								'give_post_form' => esc_html__('Below fields', 'give'),
444 444
 							)
445 445
 						),
446 446
 						'default'     => 'give_pre_form',
447 447
 					),
448 448
 					array(
449
-						'name'        => esc_html__( 'Content', 'give' ),
450
-						'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
451
-						'id'          => $prefix . 'form_content',
449
+						'name'        => esc_html__('Content', 'give'),
450
+						'description' => esc_html__('This content will display on the single give form page.', 'give'),
451
+						'id'          => $prefix.'form_content',
452 452
 						'type'        => 'wysiwyg',
453 453
 					),
454 454
 					array(
455 455
 						'name'  => 'form_content_docs',
456 456
 						'type'  => 'docs_link',
457 457
 						'url'   => 'http://docs.givewp.com/form-content',
458
-						'title' => esc_html__( 'Form Content', 'give' ),
458
+						'title' => esc_html__('Form Content', 'give'),
459 459
 					),
460 460
 				),
461 461
 					$post_id
462 462
 				),
463
-			) ),
463
+			)),
464 464
 
465 465
 			/**
466 466
 			 * Terms & Conditions
467 467
 			 */
468
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
468
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
469 469
 				'id'     => 'form_terms_options',
470
-				'title'  => esc_html__( 'Terms & Conditions', 'give' ),
471
-				'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array(
470
+				'title'  => esc_html__('Terms & Conditions', 'give'),
471
+				'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(
472 472
 					// Donation Option
473 473
 					array(
474
-						'name'        => esc_html__( 'Terms & Conditions', 'give' ),
475
-						'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
476
-						'id'          => $prefix . 'terms_option',
474
+						'name'        => esc_html__('Terms & Conditions', 'give'),
475
+						'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
476
+						'id'          => $prefix.'terms_option',
477 477
 						'type'        => 'radio_inline',
478
-						'options'     => apply_filters( 'give_forms_content_options_select', array(
479
-								'global'   => esc_html__( 'Global Option', 'give' ),
480
-								'enabled'  => esc_html__( 'Customize', 'give' ),
481
-								'disabled' => esc_html__( 'Disable', 'give' ),
478
+						'options'     => apply_filters('give_forms_content_options_select', array(
479
+								'global'   => esc_html__('Global Option', 'give'),
480
+								'enabled'  => esc_html__('Customize', 'give'),
481
+								'disabled' => esc_html__('Disable', 'give'),
482 482
 							)
483 483
 						),
484 484
 						'default'     => 'global',
485 485
 					),
486 486
 					array(
487
-						'id'         => $prefix . 'agree_label',
488
-						'name'       => esc_html__( 'Agreement Label', 'give' ),
489
-						'desc'       => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
487
+						'id'         => $prefix.'agree_label',
488
+						'name'       => esc_html__('Agreement Label', 'give'),
489
+						'desc'       => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
490 490
 						'type'       => 'text',
491 491
 						'size'       => 'regular',
492 492
 						'attributes' => array(
493
-							'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
493
+							'placeholder' => esc_attr__('Agree to Terms?', 'give'),
494 494
 						),
495 495
 					),
496 496
 					array(
497
-						'id'   => $prefix . 'agree_text',
498
-						'name' => esc_html__( 'Agreement Text', 'give' ),
499
-						'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
497
+						'id'   => $prefix.'agree_text',
498
+						'name' => esc_html__('Agreement Text', 'give'),
499
+						'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
500 500
 						'type' => 'wysiwyg',
501 501
 					),
502 502
 					array(
503 503
 						'name'  => 'terms_docs',
504 504
 						'type'  => 'docs_link',
505 505
 						'url'   => 'http://docs.givewp.com/form-terms',
506
-						'title' => esc_html__( 'Terms & Conditions', 'give' ),
506
+						'title' => esc_html__('Terms & Conditions', 'give'),
507 507
 					),
508 508
 				),
509 509
 					$post_id
510 510
 				),
511
-			) ),
511
+			)),
512 512
 		);
513 513
 
514 514
 
515 515
 		/**
516 516
 		 * Filter the metabox tabbed panel settings.
517 517
 		 */
518
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id );
518
+		$settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id);
519 519
 
520 520
 		// Output.
521 521
 		return $settings;
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
 		add_meta_box(
532 532
 			$this->get_metabox_ID(),
533 533
 			$this->get_metabox_label(),
534
-			array( $this, 'output' ),
535
-			array( 'give_forms' ),
534
+			array($this, 'output'),
535
+			array('give_forms'),
536 536
 			'normal',
537 537
 			'high'
538 538
 		);
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	function enqueue_script() {
549 549
 		global $post;
550 550
 
551
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
552
-			wp_enqueue_style( 'wp-color-picker' );
553
-			wp_enqueue_script( 'wp-color-picker' );
551
+		if (is_object($post) && 'give_forms' === $post->post_type) {
552
+			wp_enqueue_style('wp-color-picker');
553
+			wp_enqueue_script('wp-color-picker');
554 554
 		}
555 555
 	}
556 556
 
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 	public function get_tabs() {
585 585
 		$tabs = array();
586 586
 
587
-		if ( ! empty( $this->settings ) ) {
588
-			foreach ( $this->settings as $setting ) {
589
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
587
+		if ( ! empty($this->settings)) {
588
+			foreach ($this->settings as $setting) {
589
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
590 590
 					continue;
591 591
 				}
592 592
 				$tab = array(
@@ -594,11 +594,11 @@  discard block
 block discarded – undo
594 594
 					'label' => $setting['title'],
595 595
 				);
596 596
 
597
-				if ( $this->has_sub_tab( $setting ) ) {
598
-					if ( empty( $setting['sub-fields'] ) ) {
597
+				if ($this->has_sub_tab($setting)) {
598
+					if (empty($setting['sub-fields'])) {
599 599
 						$tab = array();
600 600
 					} else {
601
-						foreach ( $setting['sub-fields'] as $sub_fields ) {
601
+						foreach ($setting['sub-fields'] as $sub_fields) {
602 602
 							$tab['sub-fields'][] = array(
603 603
 								'id'    => $sub_fields['id'],
604 604
 								'label' => $sub_fields['title'],
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 					}
608 608
 				}
609 609
 
610
-				if ( ! empty( $tab ) ) {
610
+				if ( ! empty($tab)) {
611 611
 					$tabs[] = $tab;
612 612
 				}
613 613
 			}
@@ -624,17 +624,17 @@  discard block
 block discarded – undo
624 624
 	 */
625 625
 	public function output() {
626 626
 		// Bailout.
627
-		if ( $form_data_tabs = $this->get_tabs() ) {
628
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
627
+		if ($form_data_tabs = $this->get_tabs()) {
628
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
629 629
 			?>
630 630
             <div class="give-metabox-panel-wrap">
631 631
                 <ul class="give-form-data-tabs give-metabox-tabs">
632
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
633
-                        <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>">
632
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
633
+                        <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>">
634 634
                             <a href="#<?php echo $form_data_tab['id']; ?>"><span><?php echo $form_data_tab['label']; ?></span></a>
635
-							<?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?>
635
+							<?php if ($this->has_sub_tab($form_data_tab)) : ?>
636 636
                                 <ul class="give-metabox-sub-tabs give-hidden">
637
-									<?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?>
637
+									<?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?>
638 638
                                         <li class="<?php echo "{$sub_tab['id']}_tab"; ?>">
639 639
                                             <a href="#<?php echo $sub_tab['id']; ?>">
640 640
                                                 <span><?php echo $sub_tab['label']; ?></span>
@@ -648,30 +648,30 @@  discard block
 block discarded – undo
648 648
                 </ul>
649 649
 
650 650
 				<?php $show_first_tab_content = true; ?>
651
-				<?php foreach ( $this->settings as $setting ) : ?>
652
-					<?php if ( ! $this->has_sub_tab( $setting ) ) : ?>
653
-						<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
651
+				<?php foreach ($this->settings as $setting) : ?>
652
+					<?php if ( ! $this->has_sub_tab($setting)) : ?>
653
+						<?php do_action("give_before_{$setting['id']}_settings"); ?>
654 654
 
655 655
                         <div id="<?php echo $setting['id']; ?>"
656
-                             class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' );
656
+                             class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden');
657 657
 						     $show_first_tab_content = false; ?>">
658
-							<?php if ( ! empty( $setting['fields'] ) ) : ?>
659
-								<?php foreach ( $setting['fields'] as $field ) : ?>
660
-									<?php give_render_field( $field ); ?>
658
+							<?php if ( ! empty($setting['fields'])) : ?>
659
+								<?php foreach ($setting['fields'] as $field) : ?>
660
+									<?php give_render_field($field); ?>
661 661
 								<?php endforeach; ?>
662 662
 							<?php endif; ?>
663 663
                         </div>
664 664
 
665
-						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
665
+						<?php do_action("give_after_{$setting['id']}_settings"); ?>
666 666
 					<?php else: ?>
667
-						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
668
-							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
669
-								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
667
+						<?php if ($this->has_sub_tab($setting)) : ?>
668
+							<?php if ( ! empty($setting['sub-fields'])) : ?>
669
+								<?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?>
670 670
                                     <div id="<?php echo $sub_fields['id']; ?>"
671 671
                                          class="panel give_options_panel give-hidden">
672
-										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
673
-											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
674
-												<?php give_render_field( $sub_field ); ?>
672
+										<?php if ( ! empty($sub_fields['fields'])) : ?>
673
+											<?php foreach ($sub_fields['fields'] as $sub_field) : ?>
674
+												<?php give_render_field($sub_field); ?>
675 675
 											<?php endforeach; ?>
676 676
 										<?php endif; ?>
677 677
                                     </div>
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 	 *
696 696
 	 * @return bool
697 697
 	 */
698
-	private function has_sub_tab( $field_setting ) {
698
+	private function has_sub_tab($field_setting) {
699 699
 		$has_sub_tab = false;
700
-		if ( array_key_exists( 'sub-fields', $field_setting ) ) {
700
+		if (array_key_exists('sub-fields', $field_setting)) {
701 701
 			$has_sub_tab = true;
702 702
 		}
703 703
 
@@ -711,13 +711,13 @@  discard block
 block discarded – undo
711 711
 	 * @return array
712 712
 	 */
713 713
 	function cmb2_metabox_settings() {
714
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
714
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
715 715
 		$give_forms_settings = $all_cmb2_settings;
716 716
 
717 717
 		// Filter settings: Use only give forms related settings.
718
-		foreach ( $all_cmb2_settings as $index => $setting ) {
719
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
720
-				unset( $give_forms_settings[ $index ] );
718
+		foreach ($all_cmb2_settings as $index => $setting) {
719
+			if ( ! in_array('give_forms', $setting['object_types'])) {
720
+				unset($give_forms_settings[$index]);
721 721
 			}
722 722
 		}
723 723
 
@@ -735,114 +735,114 @@  discard block
 block discarded – undo
735 735
 	 *
736 736
 	 * @return void
737 737
 	 */
738
-	public function save( $post_id, $post ) {
738
+	public function save($post_id, $post) {
739 739
 
740 740
 		// $post_id and $post are required.
741
-		if ( empty( $post_id ) || empty( $post ) ) {
741
+		if (empty($post_id) || empty($post)) {
742 742
 			return;
743 743
 		}
744 744
 
745 745
 		// Don't save meta boxes for revisions or autosaves.
746
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
746
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
747 747
 			return;
748 748
 		}
749 749
 
750 750
 		// Check the nonce.
751
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
751
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
752 752
 			return;
753 753
 		}
754 754
 
755 755
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
756
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
756
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
757 757
 			return;
758 758
 		}
759 759
 
760 760
 		// Check user has permission to edit.
761
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
761
+		if ( ! current_user_can('edit_post', $post_id)) {
762 762
 			return;
763 763
 		}
764 764
 
765 765
 		// Fire action before saving form meta.
766
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
766
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
767 767
 
768 768
 		/**
769 769
 		 * Filter the meta key to save.
770 770
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
771 771
 		 */
772
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
772
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
773 773
 
774 774
 		// Save form meta data.
775
-		if ( ! empty( $form_meta_keys ) ) {
776
-			foreach ( $form_meta_keys as $form_meta_key ) {
775
+		if ( ! empty($form_meta_keys)) {
776
+			foreach ($form_meta_keys as $form_meta_key) {
777 777
 
778 778
 				// Set default value for checkbox fields.
779 779
 				if (
780
-					! isset( $_POST[ $form_meta_key ] )
781
-					&& ( 'checkbox' === $this->get_field_type( $form_meta_key ) )
780
+					! isset($_POST[$form_meta_key])
781
+					&& ('checkbox' === $this->get_field_type($form_meta_key))
782 782
 				) {
783
-					$_POST[ $form_meta_key ] = '';
783
+					$_POST[$form_meta_key] = '';
784 784
 				}
785 785
 
786
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
787
-					if ( $field_type = $this->get_field_type( $form_meta_key ) ) {
788
-						switch ( $field_type ) {
786
+				if (isset($_POST[$form_meta_key])) {
787
+					if ($field_type = $this->get_field_type($form_meta_key)) {
788
+						switch ($field_type) {
789 789
 							case 'textarea':
790 790
 							case 'wysiwyg':
791
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
792
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
791
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
792
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
793 793
 								break;
794 794
 
795 795
 							case 'group':
796 796
 								$form_meta_value = array();
797 797
 
798
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
798
+								foreach ($_POST[$form_meta_key] as $index => $group) {
799 799
 
800 800
 									// Do not save template input field values.
801
-									if ( '{{row-count-placeholder}}' === $index ) {
801
+									if ('{{row-count-placeholder}}' === $index) {
802 802
 										continue;
803 803
 									}
804 804
 
805 805
 									$group_meta_value = array();
806
-									foreach ( $group as $field_id => $field_value ) {
807
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
806
+									foreach ($group as $field_id => $field_value) {
807
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
808 808
 											case 'wysiwyg':
809
-												$group_meta_value[ $field_id ] = wp_kses_post( $field_value );
809
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
810 810
 												break;
811 811
 
812 812
 											default:
813
-												$group_meta_value[ $field_id ] = give_clean( $field_value );
813
+												$group_meta_value[$field_id] = give_clean($field_value);
814 814
 										}
815 815
 									}
816 816
 
817
-									if ( ! empty( $group_meta_value ) ) {
818
-										$form_meta_value[ $index ] = $group_meta_value;
817
+									if ( ! empty($group_meta_value)) {
818
+										$form_meta_value[$index] = $group_meta_value;
819 819
 									}
820 820
 								}
821 821
 
822 822
 
823 823
 								// Arrange repeater field keys in order.
824
-								$form_meta_value = array_values( $form_meta_value );
824
+								$form_meta_value = array_values($form_meta_value);
825 825
 
826 826
 								// Save data.
827
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
827
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
828 828
 								break;
829 829
 
830 830
 							default:
831
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
831
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
832 832
 
833 833
 								// Save data.
834
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
834
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
835 835
 						}
836 836
 
837 837
 						// Fire after saving form meta key.
838
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
838
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
839 839
 					}
840 840
 				}
841 841
 			}
842 842
 		}
843 843
 
844 844
 		// Fire action after saving form meta.
845
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
845
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
846 846
 	}
847 847
 
848 848
 
@@ -855,10 +855,10 @@  discard block
 block discarded – undo
855 855
 	 *
856 856
 	 * @return string
857 857
 	 */
858
-	private function get_field_id( $field ) {
858
+	private function get_field_id($field) {
859 859
 		$field_id = '';
860 860
 
861
-		if ( array_key_exists( 'id', $field ) ) {
861
+		if (array_key_exists('id', $field)) {
862 862
 			$field_id = $field['id'];
863 863
 
864 864
 		}
@@ -875,12 +875,12 @@  discard block
 block discarded – undo
875 875
 	 *
876 876
 	 * @return array
877 877
 	 */
878
-	private function get_fields_id( $setting ) {
878
+	private function get_fields_id($setting) {
879 879
 		$meta_keys = array();
880 880
 
881
-		if ( ! empty( $setting ) ) {
882
-			foreach ( $setting['fields'] as $field ) {
883
-				if ( $field_id = $this->get_field_id( $field ) ) {
881
+		if ( ! empty($setting)) {
882
+			foreach ($setting['fields'] as $field) {
883
+				if ($field_id = $this->get_field_id($field)) {
884 884
 					$meta_keys[] = $field_id;
885 885
 				}
886 886
 			}
@@ -898,14 +898,14 @@  discard block
 block discarded – undo
898 898
 	 *
899 899
 	 * @return array
900 900
 	 */
901
-	private function get_sub_fields_id( $setting ) {
901
+	private function get_sub_fields_id($setting) {
902 902
 		$meta_keys = array();
903 903
 
904
-		if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) {
905
-			foreach ( $setting['sub-fields'] as $fields ) {
906
-				if ( ! empty( $fields['fields'] ) ) {
907
-					foreach ( $fields['fields'] as $field ) {
908
-						if ( $field_id = $this->get_field_id( $field ) ) {
904
+		if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) {
905
+			foreach ($setting['sub-fields'] as $fields) {
906
+				if ( ! empty($fields['fields'])) {
907
+					foreach ($fields['fields'] as $field) {
908
+						if ($field_id = $this->get_field_id($field)) {
909 909
 							$meta_keys[] = $field_id;
910 910
 						}
911 911
 					}
@@ -926,14 +926,14 @@  discard block
 block discarded – undo
926 926
 	private function get_meta_keys_from_settings() {
927 927
 		$meta_keys = array();
928 928
 
929
-		foreach ( $this->settings as $setting ) {
930
-			if ( $this->has_sub_tab( $setting ) ) {
931
-				$meta_key = $this->get_sub_fields_id( $setting );
929
+		foreach ($this->settings as $setting) {
930
+			if ($this->has_sub_tab($setting)) {
931
+				$meta_key = $this->get_sub_fields_id($setting);
932 932
 			} else {
933
-				$meta_key = $this->get_fields_id( $setting );
933
+				$meta_key = $this->get_fields_id($setting);
934 934
 			}
935 935
 
936
-			$meta_keys = array_merge( $meta_keys, $meta_key );
936
+			$meta_keys = array_merge($meta_keys, $meta_key);
937 937
 		}
938 938
 
939 939
 		return $meta_keys;
@@ -950,10 +950,10 @@  discard block
 block discarded – undo
950 950
 	 *
951 951
 	 * @return string
952 952
 	 */
953
-	function get_field_type( $field_id, $group_id = '' ) {
954
-		$field = $this->get_setting_field( $field_id, $group_id );
953
+	function get_field_type($field_id, $group_id = '') {
954
+		$field = $this->get_setting_field($field_id, $group_id);
955 955
 
956
-		$type = array_key_exists( 'type', $field )
956
+		$type = array_key_exists('type', $field)
957 957
 			? $field['type']
958 958
 			: '';
959 959
 
@@ -971,12 +971,12 @@  discard block
 block discarded – undo
971 971
 	 *
972 972
 	 * @return array
973 973
 	 */
974
-	private function get_field( $setting, $field_id ) {
974
+	private function get_field($setting, $field_id) {
975 975
 		$setting_field = array();
976 976
 
977
-		if ( ! empty( $setting['fields'] ) ) {
978
-			foreach ( $setting['fields'] as $field ) {
979
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) {
977
+		if ( ! empty($setting['fields'])) {
978
+			foreach ($setting['fields'] as $field) {
979
+				if (array_key_exists('id', $field) && $field['id'] === $field_id) {
980 980
 					$setting_field = $field;
981 981
 					break;
982 982
 				}
@@ -996,12 +996,12 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @return array
998 998
 	 */
999
-	private function get_sub_field( $setting, $field_id ) {
999
+	private function get_sub_field($setting, $field_id) {
1000 1000
 		$setting_field = array();
1001 1001
 
1002
-		if ( ! empty( $setting['sub-fields'] ) ) {
1003
-			foreach ( $setting['sub-fields'] as $fields ) {
1004
-				if ( $field = $this->get_field( $fields, $field_id ) ) {
1002
+		if ( ! empty($setting['sub-fields'])) {
1003
+			foreach ($setting['sub-fields'] as $fields) {
1004
+				if ($field = $this->get_field($fields, $field_id)) {
1005 1005
 					$setting_field = $field;
1006 1006
 					break;
1007 1007
 				}
@@ -1021,17 +1021,17 @@  discard block
 block discarded – undo
1021 1021
 	 *
1022 1022
 	 * @return array
1023 1023
 	 */
1024
-	function get_setting_field( $field_id, $group_id = '' ) {
1024
+	function get_setting_field($field_id, $group_id = '') {
1025 1025
 		$setting_field = array();
1026 1026
 
1027 1027
 		$_field_id = $field_id;
1028
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
1028
+		$field_id  = empty($group_id) ? $field_id : $group_id;
1029 1029
 
1030
-		if ( ! empty( $this->settings ) ) {
1031
-			foreach ( $this->settings as $setting ) {
1030
+		if ( ! empty($this->settings)) {
1031
+			foreach ($this->settings as $setting) {
1032 1032
 				if (
1033
-					( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) )
1034
-					|| ( $setting_field = $this->get_field( $setting, $field_id ) )
1033
+					($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id)))
1034
+					|| ($setting_field = $this->get_field($setting, $field_id))
1035 1035
 				) {
1036 1036
 					break;
1037 1037
 				}
@@ -1040,9 +1040,9 @@  discard block
 block discarded – undo
1040 1040
 
1041 1041
 
1042 1042
 		// Get field from group.
1043
-		if ( ! empty( $group_id ) ) {
1044
-			foreach ( $setting_field['fields'] as $field ) {
1045
-				if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) {
1043
+		if ( ! empty($group_id)) {
1044
+			foreach ($setting_field['fields'] as $field) {
1045
+				if (array_key_exists('id', $field) && $field['id'] === $_field_id) {
1046 1046
 					$setting_field = $field;
1047 1047
 				}
1048 1048
 			}
@@ -1061,13 +1061,13 @@  discard block
 block discarded – undo
1061 1061
 	 *
1062 1062
 	 * @return mixed
1063 1063
 	 */
1064
-	function add_offline_donations_setting_tab( $settings ) {
1065
-		if ( give_is_gateway_active( 'offline' ) ) {
1066
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
1064
+	function add_offline_donations_setting_tab($settings) {
1065
+		if (give_is_gateway_active('offline')) {
1066
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
1067 1067
 				'id'     => 'offline_donations_options',
1068
-				'title'  => esc_html__( 'Offline Donations', 'give' ),
1069
-				'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
1070
-			) );
1068
+				'title'  => esc_html__('Offline Donations', 'give'),
1069
+				'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()),
1070
+			));
1071 1071
 		}
1072 1072
 
1073 1073
 		return $settings;
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -663,11 +663,14 @@
 block discarded – undo
663 663
                         </div>
664 664
 
665 665
 						<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
666
-					<?php else: ?>
666
+					<?php else {
667
+	: ?>
667 668
 						<?php if ( $this->has_sub_tab( $setting ) ) : ?>
668 669
 							<?php if ( ! empty( $setting['sub-fields'] ) ) : ?>
669 670
 								<?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?>
670
-                                    <div id="<?php echo $sub_fields['id']; ?>"
671
+                                    <div id="<?php echo $sub_fields['id'];
672
+}
673
+?>"
671 674
                                          class="panel give_options_panel give-hidden">
672 675
 										<?php if ( ! empty( $sub_fields['fields'] ) ) : ?>
673 676
 											<?php foreach ( $sub_fields['fields'] as $sub_field ) : ?>
Please login to merge, or discard this patch.