Completed
Pull Request — master (#1300)
by Ravinder
16:35
created
includes/admin/reporting/class-form-reports-table.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 		global $status, $page;
51 51
 
52 52
 		// Set parent defaults
53
-		parent::__construct( array(
54
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
55
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
53
+		parent::__construct(array(
54
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
55
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
56 56
 			'ajax'     => false                        // Does this table support ajax?
57
-		) );
57
+		));
58 58
 
59
-		add_action( 'give_report_view_actions', array( $this, 'category_filter' ) );
59
+		add_action('give_report_view_actions', array($this, 'category_filter'));
60 60
 		$this->query();
61 61
 
62 62
 	}
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @return string Column Name
74 74
 	 */
75
-	public function column_default( $item, $column_name ) {
76
-		switch ( $column_name ) {
75
+	public function column_default($item, $column_name) {
76
+		switch ($column_name) {
77 77
 			case 'earnings' :
78
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
78
+				return give_currency_filter(give_format_amount($item[$column_name]));
79 79
 			case 'average_sales' :
80
-				return round( $item[ $column_name ] );
80
+				return round($item[$column_name]);
81 81
 			case 'average_earnings' :
82
-				return give_currency_filter( give_format_amount( $item[ $column_name ] ) );
82
+				return give_currency_filter(give_format_amount($item[$column_name]));
83 83
 			case 'details' :
84
-				return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>';
84
+				return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>';
85 85
 			default:
86
-				return $item[ $column_name ];
86
+				return $item[$column_name];
87 87
 		}
88 88
 	}
89 89
 
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function get_columns() {
98 98
 		$columns = array(
99
-			'title'            => esc_html__( 'Form', 'give' ),
100
-			'sales'            => esc_html__( 'Donations', 'give' ),
101
-			'earnings'         => esc_html__( 'Income', 'give' ),
102
-			'average_sales'    => esc_html__( 'Monthly Average Donations', 'give' ),
103
-			'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ),
104
-			'details'          => esc_html__( 'Detailed Report', 'give' )
99
+			'title'            => esc_html__('Form', 'give'),
100
+			'sales'            => esc_html__('Donations', 'give'),
101
+			'earnings'         => esc_html__('Income', 'give'),
102
+			'average_sales'    => esc_html__('Monthly Average Donations', 'give'),
103
+			'average_earnings' => esc_html__('Monthly Average Income', 'give'),
104
+			'details'          => esc_html__('Detailed Report', 'give')
105 105
 		);
106 106
 
107 107
 		return $columns;
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public function get_sortable_columns() {
118 118
 		return array(
119
-			'title'    => array( 'title', true ),
120
-			'sales'    => array( 'sales', false ),
121
-			'earnings' => array( 'earnings', false ),
119
+			'title'    => array('title', true),
120
+			'sales'    => array('sales', false),
121
+			'earnings' => array('earnings', false),
122 122
 		);
123 123
 	}
124 124
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @return int Current page number
131 131
 	 */
132 132
 	public function get_paged() {
133
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
133
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
134 134
 	}
135 135
 
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @return int Category ID
143 143
 	 */
144 144
 	public function get_category() {
145
-		return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0;
145
+		return isset($_GET['category']) ? absint($_GET['category']) : 0;
146 146
 	}
147 147
 
148 148
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function get_total_forms() {
157 157
 		$total  = 0;
158
-		$counts = wp_count_posts( 'give_forms', 'readable' );
159
-		foreach ( $counts as $status => $count ) {
158
+		$counts = wp_count_posts('give_forms', 'readable');
159
+		foreach ($counts as $status => $count) {
160 160
 			$total += $count;
161 161
 		}
162 162
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @since  1.0
171 171
 	 * @return void
172 172
 	 */
173
-	public function bulk_actions( $which = '' ) {
173
+	public function bulk_actions($which = '') {
174 174
 
175 175
 	}
176 176
 
@@ -182,27 +182,27 @@  discard block
 block discarded – undo
182 182
 	 *
183 183
 	 * @param string $which
184 184
 	 */
185
-	protected function display_tablenav( $which ) {
185
+	protected function display_tablenav($which) {
186 186
 
187
-		if ( 'top' === $which ) {
188
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
187
+		if ('top' === $which) {
188
+			wp_nonce_field('bulk-'.$this->_args['plural']);
189 189
 		}
190 190
 		?>
191
-		<div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
191
+		<div class="tablenav give-clearfix <?php echo esc_attr($which); ?>">
192 192
 
193
-			<?php if ( 'top' === $which ) { ?>
193
+			<?php if ('top' === $which) { ?>
194 194
 				<h3 class="alignleft reports-earnings-title">
195
-					<span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span>
195
+					<span><?php esc_html_e('Donation Forms Report', 'give'); ?></span>
196 196
 				</h3>
197 197
 			<?php } ?>
198 198
 
199 199
 			<div class="alignright tablenav-right">
200 200
 				<div class="actions bulkactions">
201
-					<?php $this->bulk_actions( $which ); ?>
201
+					<?php $this->bulk_actions($which); ?>
202 202
 				</div>
203 203
 				<?php
204
-				$this->extra_tablenav( $which );
205
-				$this->pagination( $which );
204
+				$this->extra_tablenav($which);
205
+				$this->pagination($which);
206 206
 				?>
207 207
 			</div>
208 208
 
@@ -222,9 +222,9 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function category_filter() {
224 224
 
225
-		$categories = get_terms( 'form_category' );
226
-		if ( $categories && ! is_wp_error( $categories ) ) {
227
-			echo Give()->html->category_dropdown( 'category', $this->get_category() );
225
+		$categories = get_terms('form_category');
226
+		if ($categories && ! is_wp_error($categories)) {
227
+			echo Give()->html->category_dropdown('category', $this->get_category());
228 228
 		}
229 229
 	}
230 230
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	public function query() {
240 240
 
241
-		$orderby  = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title';
242
-		$order    = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC';
241
+		$orderby  = isset($_GET['orderby']) ? $_GET['orderby'] : 'title';
242
+		$order    = isset($_GET['order']) ? $_GET['order'] : 'DESC';
243 243
 		$category = $this->get_category();
244 244
 
245 245
 		$args = array(
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			'suppress_filters' => true
253 253
 		);
254 254
 
255
-		if ( ! empty( $category ) ) {
255
+		if ( ! empty($category)) {
256 256
 			$args['tax_query'] = array(
257 257
 				array(
258 258
 					'taxonomy' => 'form_category',
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 			);
262 262
 		}
263 263
 
264
-		switch ( $orderby ) :
264
+		switch ($orderby) :
265 265
 			case 'title' :
266 266
 				$args['orderby'] = 'title';
267 267
 				break;
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
 				break;
278 278
 		endswitch;
279 279
 
280
-		$args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this );
280
+		$args = apply_filters('give_form_reports_prepare_items_args', $args, $this);
281 281
 
282
-		$this->products = new WP_Query( $args );
282
+		$this->products = new WP_Query($args);
283 283
 
284 284
 	}
285 285
 
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
 
296 296
 		$give_forms = $this->products->posts;
297 297
 
298
-		if ( $give_forms ) {
299
-			foreach ( $give_forms as $form ) {
298
+		if ($give_forms) {
299
+			foreach ($give_forms as $form) {
300 300
 				$reports_data[] = array(
301 301
 					'ID'               => $form,
302
-					'title'            => get_the_title( $form ),
303
-					'sales'            => give_get_form_sales_stats( $form ),
304
-					'earnings'         => give_get_form_earnings_stats( $form ),
305
-					'average_sales'    => give_get_average_monthly_form_sales( $form ),
306
-					'average_earnings' => give_get_average_monthly_form_earnings( $form )
302
+					'title'            => get_the_title($form),
303
+					'sales'            => give_get_form_sales_stats($form),
304
+					'earnings'         => give_get_form_earnings_stats($form),
305
+					'average_sales'    => give_get_average_monthly_form_sales($form),
306
+					'average_earnings' => give_get_average_monthly_form_earnings($form)
307 307
 				);
308 308
 			}
309 309
 		}
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
 		$sortable = $this->get_sortable_columns();
333 333
 
334
-		$this->_column_headers = array( $columns, $hidden, $sortable );
334
+		$this->_column_headers = array($columns, $hidden, $sortable);
335 335
 
336 336
 		$data = $this->reports_data();
337 337
 
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 
340 340
 		$this->items = $data;
341 341
 
342
-		$this->set_pagination_args( array(
342
+		$this->set_pagination_args(array(
343 343
 				'total_items' => $total_items,
344 344
 				'per_page'    => $this->per_page,
345
-				'total_pages' => ceil( $total_items / $this->per_page )
345
+				'total_pages' => ceil($total_items / $this->per_page)
346 346
 			)
347 347
 		);
348 348
 	}
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateways-reports-table.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load WP_List_Table if not loaded
18
-if ( ! class_exists( 'WP_List_Table' ) ) {
19
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
+if ( ! class_exists('WP_List_Table')) {
19
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
20 20
 }
21 21
 
22 22
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 
54 54
 	}
55 55
 
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
68
-		switch ( $column_name ) {
67
+	public function column_default($item, $column_name) {
68
+		switch ($column_name) {
69 69
 			default:
70
-				return $item[ $column_name ];
70
+				return $item[$column_name];
71 71
 		}
72 72
 	}
73 73
 
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function get_columns() {
82 82
 		$columns = array(
83
-			'label'           => esc_attr__( 'Gateway', 'give' ),
84
-			'complete_sales'  => esc_attr__( 'Complete Transactions', 'give' ),
85
-			'pending_sales'   => esc_attr__( 'Pending / Failed Transactions', 'give' ),
86
-			'total_sales'     => esc_attr__( 'Total Transactions', 'give' ),
87
-			'total_donations' => esc_attr__( 'Total Donated', 'give' )
83
+			'label'           => esc_attr__('Gateway', 'give'),
84
+			'complete_sales'  => esc_attr__('Complete Transactions', 'give'),
85
+			'pending_sales'   => esc_attr__('Pending / Failed Transactions', 'give'),
86
+			'total_sales'     => esc_attr__('Total Transactions', 'give'),
87
+			'total_donations' => esc_attr__('Total Donated', 'give')
88 88
 		);
89 89
 
90 90
 		return $columns;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return int Current page number
100 100
 	 */
101 101
 	public function get_paged() {
102
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
102
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
103 103
 	}
104 104
 
105 105
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @since  1.0
111 111
 	 * @return void
112 112
 	 */
113
-	public function bulk_actions( $which = '' ) {
113
+	public function bulk_actions($which = '') {
114 114
 
115 115
 	}
116 116
 
@@ -122,27 +122,27 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @param string $which
124 124
 	 */
125
-	protected function display_tablenav( $which ) {
125
+	protected function display_tablenav($which) {
126 126
 
127
-		if ( 'top' === $which ) {
128
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
127
+		if ('top' === $which) {
128
+			wp_nonce_field('bulk-'.$this->_args['plural']);
129 129
 		}
130 130
 		?>
131
-		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>">
131
+		<div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>">
132 132
 
133
-			<?php if ( 'top' === $which ) { ?>
133
+			<?php if ('top' === $which) { ?>
134 134
 				<h3 class="alignleft reports-earnings-title">
135
-					<span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span>
135
+					<span><?php esc_html_e('Donation Methods Report', 'give'); ?></span>
136 136
 				</h3>
137 137
 			<?php } ?>
138 138
 
139 139
 			<div class="alignright tablenav-right">
140 140
 				<div class="actions bulkactions">
141
-					<?php $this->bulk_actions( $which ); ?>
141
+					<?php $this->bulk_actions($which); ?>
142 142
 				</div>
143 143
 				<?php
144
-				$this->extra_tablenav( $which );
145
-				$this->pagination( $which );
144
+				$this->extra_tablenav($which);
145
+				$this->pagination($which);
146 146
 				?>
147 147
 			</div>
148 148
 
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 		$gateways     = give_get_payment_gateways();
168 168
 		$stats        = new Give_Payment_Stats();
169 169
 
170
-		foreach ( $gateways as $gateway_id => $gateway ) {
170
+		foreach ($gateways as $gateway_id => $gateway) {
171 171
 
172
-			$complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' );
173
-			$pending_count  = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) );
172
+			$complete_count = give_count_sales_by_gateway($gateway_id, 'publish');
173
+			$pending_count  = give_count_sales_by_gateway($gateway_id, array('pending', 'failed'));
174 174
 
175 175
 			$reports_data[] = array(
176 176
 				'ID'              => $gateway_id,
177 177
 				'label'           => $gateway['admin_label'],
178
-				'complete_sales'  => give_format_amount( $complete_count, false ),
179
-				'pending_sales'   => give_format_amount( $pending_count, false ),
180
-				'total_sales'     => give_format_amount( $complete_count + $pending_count, false ),
181
-				'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) )
178
+				'complete_sales'  => give_format_amount($complete_count, false),
179
+				'pending_sales'   => give_format_amount($pending_count, false),
180
+				'total_sales'     => give_format_amount($complete_count + $pending_count, false),
181
+				'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id)))
182 182
 			);
183 183
 		}
184 184
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		$columns               = $this->get_columns();
201 201
 		$hidden                = array(); // No hidden columns
202 202
 		$sortable              = $this->get_sortable_columns();
203
-		$this->_column_headers = array( $columns, $hidden, $sortable );
203
+		$this->_column_headers = array($columns, $hidden, $sortable);
204 204
 		$this->items           = $this->reports_data();
205 205
 
206 206
 	}
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +129 added lines, -129 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,34 +25,34 @@  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' );
55
+add_action('admin_init', 'give_do_automatic_upgrades');
56 56
 
57 57
 /**
58 58
  * Display Upgrade Notices
@@ -62,18 +62,18 @@  discard block
 block discarded – undo
62 62
  */
63 63
 function give_show_upgrade_notices() {
64 64
 	// Don't show notices on the upgrades page.
65
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
65
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
66 66
 		return;
67 67
 	}
68 68
 
69
-	$give_version = get_option( 'give_version' );
69
+	$give_version = get_option('give_version');
70 70
 
71
-	if ( ! $give_version ) {
71
+	if ( ! $give_version) {
72 72
 		// 1.0 is the first version to use this option so we must add it.
73 73
 		$give_version = '1.0';
74 74
 	}
75 75
 
76
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
76
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
77 77
 
78 78
 	/*
79 79
 	 *  NOTICE:
@@ -84,27 +84,27 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 
86 86
 	// v1.3.2 Upgrades
87
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
87
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
88 88
 		printf(
89 89
 		/* translators: %s: upgrade URL */
90
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
91
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
90
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
91
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
92 92
 		);
93 93
 	}
94 94
 
95 95
 	// v1.3.4 Upgrades //ensure the user has gone through 1.3.4.
96
-	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' ) ) ) {
96
+	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 97
 		printf(
98 98
 		/* translators: %s: upgrade URL */
99
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
100
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
99
+			'<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
100
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
101 101
 		);
102 102
 	}
103 103
 
104 104
 	// End 'Stepped' upgrade process notices.
105 105
 }
106 106
 
107
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
107
+add_action('admin_notices', 'give_show_upgrade_notices');
108 108
 
109 109
 /**
110 110
  * Triggers all upgrade functions
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
  */
117 117
 function give_trigger_upgrades() {
118 118
 
119
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
120
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
119
+	if ( ! current_user_can('manage_give_settings')) {
120
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
121 121
 	}
122 122
 
123
-	$give_version = get_option( 'give_version' );
123
+	$give_version = get_option('give_version');
124 124
 
125
-	if ( ! $give_version ) {
125
+	if ( ! $give_version) {
126 126
 		// 1.0 is the first version to use this option so we must add it.
127 127
 		$give_version = '1.0';
128
-		add_option( 'give_version', $give_version );
128
+		add_option('give_version', $give_version);
129 129
 	}
130 130
 
131
-	update_option( 'give_version', GIVE_VERSION );
131
+	update_option('give_version', GIVE_VERSION);
132 132
 
133
-	if ( DOING_AJAX ) {
134
-		die( 'complete' );
133
+	if (DOING_AJAX) {
134
+		die('complete');
135 135
 	} // Let AJAX know that the upgrade is complete.
136 136
 }
137 137
 
138
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
138
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
139 139
 
140 140
 /**
141 141
  * Check if the upgrade routine has been run for a specific action
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
  *
147 147
  * @return bool                   If the action has been added to the completed actions array
148 148
  */
149
-function give_has_upgrade_completed( $upgrade_action = '' ) {
149
+function give_has_upgrade_completed($upgrade_action = '') {
150 150
 
151
-	if ( empty( $upgrade_action ) ) {
151
+	if (empty($upgrade_action)) {
152 152
 		return false;
153 153
 	}
154 154
 
155 155
 	$completed_upgrades = give_get_completed_upgrades();
156 156
 
157
-	return in_array( $upgrade_action, $completed_upgrades );
157
+	return in_array($upgrade_action, $completed_upgrades);
158 158
 
159 159
 }
160 160
 
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
  *
168 168
  * @return bool                   If the function was successfully added
169 169
  */
170
-function give_set_upgrade_complete( $upgrade_action = '' ) {
170
+function give_set_upgrade_complete($upgrade_action = '') {
171 171
 
172
-	if ( empty( $upgrade_action ) ) {
172
+	if (empty($upgrade_action)) {
173 173
 		return false;
174 174
 	}
175 175
 
@@ -177,9 +177,9 @@  discard block
 block discarded – undo
177 177
 	$completed_upgrades[] = $upgrade_action;
178 178
 
179 179
 	// Remove any blanks, and only show uniques.
180
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
180
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
181 181
 
182
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
182
+	return update_option('give_completed_upgrades', $completed_upgrades);
183 183
 }
184 184
 
185 185
 /**
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
  */
191 191
 function give_get_completed_upgrades() {
192 192
 
193
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
193
+	$completed_upgrades = get_option('give_completed_upgrades');
194 194
 
195
-	if ( false === $completed_upgrades ) {
195
+	if (false === $completed_upgrades) {
196 196
 		$completed_upgrades = array();
197 197
 	}
198 198
 
@@ -209,29 +209,29 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function give_v132_upgrade_give_payment_customer_id() {
211 211
 	global $wpdb;
212
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
213
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
212
+	if ( ! current_user_can('manage_give_settings')) {
213
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
214 214
 	}
215 215
 
216
-	ignore_user_abort( true );
216
+	ignore_user_abort(true);
217 217
 
218
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
219
-		@set_time_limit( 0 );
218
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
219
+		@set_time_limit(0);
220 220
 	}
221 221
 
222 222
 	// UPDATE DB METAKEYS.
223 223
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
224
-	$query = $wpdb->query( $sql );
224
+	$query = $wpdb->query($sql);
225 225
 
226
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
227
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
228
-	delete_option( 'give_doing_upgrade' );
229
-	wp_redirect( admin_url() );
226
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
227
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
228
+	delete_option('give_doing_upgrade');
229
+	wp_redirect(admin_url());
230 230
 	exit;
231 231
 
232 232
 }
233 233
 
234
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
234
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
235 235
 
236 236
 /**
237 237
  * Upgrades the Offline Status
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 
245 245
 	global $wpdb;
246 246
 
247
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
248
-		wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );
247
+	if ( ! current_user_can('manage_give_settings')) {
248
+		wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403));
249 249
 	}
250 250
 
251
-	ignore_user_abort( true );
251
+	ignore_user_abort(true);
252 252
 
253
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
254
-		@set_time_limit( 0 );
253
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
254
+		@set_time_limit(0);
255 255
 	}
256 256
 
257 257
 	// Get abandoned offline payments.
@@ -261,31 +261,31 @@  discard block
 block discarded – undo
261 261
 	$where .= "AND ( p.post_status = 'abandoned' )";
262 262
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
263 263
 
264
-	$sql            = $select . $join . $where;
265
-	$found_payments = $wpdb->get_col( $sql );
264
+	$sql            = $select.$join.$where;
265
+	$found_payments = $wpdb->get_col($sql);
266 266
 
267
-	foreach ( $found_payments as $payment ) {
267
+	foreach ($found_payments as $payment) {
268 268
 
269 269
 		// Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves.
270
-		$modified_time = get_post_modified_time( 'U', false, $payment );
270
+		$modified_time = get_post_modified_time('U', false, $payment);
271 271
 
272 272
 		// 1450124863 =  12/10/2015 20:42:25.
273
-		if ( $modified_time >= 1450124863 ) {
273
+		if ($modified_time >= 1450124863) {
274 274
 
275
-			give_update_payment_status( $payment, 'pending' );
275
+			give_update_payment_status($payment, 'pending');
276 276
 
277 277
 		}
278 278
 	}
279 279
 
280
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
281
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
282
-	delete_option( 'give_doing_upgrade' );
283
-	wp_redirect( admin_url() );
280
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
281
+	give_set_upgrade_complete('upgrade_give_offline_status');
282
+	delete_option('give_doing_upgrade');
283
+	wp_redirect(admin_url());
284 284
 	exit;
285 285
 
286 286
 }
287 287
 
288
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
288
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
289 289
 
290 290
 /**
291 291
  * Cleanup User Roles
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
  */
297 297
 function give_v152_cleanup_users() {
298 298
 
299
-	$give_version = get_option( 'give_version' );
299
+	$give_version = get_option('give_version');
300 300
 
301
-	if ( ! $give_version ) {
301
+	if ( ! $give_version) {
302 302
 		// 1.0 is the first version to use this option so we must add it.
303 303
 		$give_version = '1.0';
304 304
 	}
305 305
 
306
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
306
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
307 307
 
308 308
 	// v1.5.2 Upgrades
309
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
309
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
310 310
 
311 311
 		// Delete all caps with "ss".
312 312
 		// Also delete all unused "campaign" roles.
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 		);
354 354
 
355 355
 		global $wp_roles;
356
-		foreach ( $delete_caps as $cap ) {
357
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
358
-				$wp_roles->remove_cap( $role, $cap );
356
+		foreach ($delete_caps as $cap) {
357
+			foreach (array_keys($wp_roles->roles) as $role) {
358
+				$wp_roles->remove_cap($role, $cap);
359 359
 			}
360 360
 		}
361 361
 
@@ -365,15 +365,15 @@  discard block
 block discarded – undo
365 365
 		$roles->add_caps();
366 366
 
367 367
 		// The Update Ran.
368
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
369
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
370
-		delete_option( 'give_doing_upgrade' );
368
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
369
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
370
+		delete_option('give_doing_upgrade');
371 371
 
372 372
 	}
373 373
 
374 374
 }
375 375
 
376
-add_action( 'admin_init', 'give_v152_cleanup_users' );
376
+add_action('admin_init', 'give_v152_cleanup_users');
377 377
 
378 378
 /**
379 379
  * 1.6 Upgrade routine to create the customer meta table.
@@ -413,53 +413,53 @@  discard block
 block discarded – undo
413 413
 
414 414
 	// Get addons license key.
415 415
 	$addons = array();
416
-	foreach ( $give_options as $key => $value ) {
417
-		if ( false !== strpos( $key, '_license_key' ) ) {
418
-			$addons[ $key ] = $value;
416
+	foreach ($give_options as $key => $value) {
417
+		if (false !== strpos($key, '_license_key')) {
418
+			$addons[$key] = $value;
419 419
 		}
420 420
 	}
421 421
 
422 422
 	// Bailout: We do not have any addon license data to upgrade.
423
-	if ( empty( $addons ) ) {
423
+	if (empty($addons)) {
424 424
 		return false;
425 425
 	}
426 426
 
427
-	foreach ( $addons as $key => $addon_license ) {
427
+	foreach ($addons as $key => $addon_license) {
428 428
 
429 429
 		// Get addon shortname.
430
-		$shortname = str_replace( '_license_key', '', $key );
430
+		$shortname = str_replace('_license_key', '', $key);
431 431
 
432 432
 		// Addon license option name.
433
-		$addon_license_option_name = $shortname . '_license_active';
433
+		$addon_license_option_name = $shortname.'_license_active';
434 434
 
435 435
 		// bailout if license is empty.
436
-		if ( empty( $addon_license ) ) {
437
-			delete_option( $addon_license_option_name );
436
+		if (empty($addon_license)) {
437
+			delete_option($addon_license_option_name);
438 438
 			continue;
439 439
 		}
440 440
 
441 441
 		// Get addon name.
442 442
 		$addon_name       = array();
443
-		$addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) );
444
-		foreach ( $addon_name_parts as $name_part ) {
443
+		$addon_name_parts = explode('_', str_replace('give_', '', $shortname));
444
+		foreach ($addon_name_parts as $name_part) {
445 445
 
446 446
 			// Fix addon name
447
-			switch ( $name_part ) {
447
+			switch ($name_part) {
448 448
 				case 'authorizenet' :
449 449
 					$name_part = 'authorize.net';
450 450
 					break;
451 451
 			}
452 452
 
453
-			$addon_name[] = ucfirst( $name_part );
453
+			$addon_name[] = ucfirst($name_part);
454 454
 		}
455 455
 
456
-		$addon_name = implode( ' ', $addon_name );
456
+		$addon_name = implode(' ', $addon_name);
457 457
 
458 458
 		// Data to send to the API
459 459
 		$api_params = array(
460 460
 			'edd_action' => 'activate_license', //never change from "edd_" to "give_"!
461 461
 			'license'    => $addon_license,
462
-			'item_name'  => urlencode( $addon_name ),
462
+			'item_name'  => urlencode($addon_name),
463 463
 			'url'        => home_url()
464 464
 		);
465 465
 
@@ -474,17 +474,17 @@  discard block
 block discarded – undo
474 474
 		);
475 475
 
476 476
 		// Make sure there are no errors.
477
-		if ( is_wp_error( $response ) ) {
478
-			delete_option( $addon_license_option_name );
477
+		if (is_wp_error($response)) {
478
+			delete_option($addon_license_option_name);
479 479
 			continue;
480 480
 		}
481 481
 
482 482
 		// Tell WordPress to look for updates.
483
-		set_site_transient( 'update_plugins', null );
483
+		set_site_transient('update_plugins', null);
484 484
 
485 485
 		// Decode license data.
486
-		$license_data = json_decode( wp_remote_retrieve_body( $response ) );
487
-		update_option( $addon_license_option_name, $license_data );
486
+		$license_data = json_decode(wp_remote_retrieve_body($response));
487
+		update_option($addon_license_option_name, $license_data);
488 488
 	}
489 489
 }
490 490
 
@@ -514,9 +514,9 @@  discard block
 block discarded – undo
514 514
 	);
515 515
 
516 516
 	global $wp_roles;
517
-	foreach ( $delete_caps as $cap ) {
518
-		foreach ( array_keys( $wp_roles->roles ) as $role ) {
519
-			$wp_roles->remove_cap( $role, $cap );
517
+	foreach ($delete_caps as $cap) {
518
+		foreach (array_keys($wp_roles->roles) as $role) {
519
+			$wp_roles->remove_cap($role, $cap);
520 520
 		}
521 521
 	}
522 522
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 function give_v18_upgrades_core_setting() {
553 553
 	// Core settings which changes from checkbox to radio.
554 554
 	$core_setting_names = array_merge(
555
-		array_keys( give_v18_renamed_core_settings() ),
555
+		array_keys(give_v18_renamed_core_settings()),
556 556
 		array(
557 557
 			'uninstall_on_delete',
558 558
 			'scripts_footer',
@@ -564,44 +564,44 @@  discard block
 block discarded – undo
564 564
 	);
565 565
 
566 566
 	// Bailout: If not any setting define.
567
-	if ( $give_settings = get_option( 'give_settings' ) ) {
567
+	if ($give_settings = get_option('give_settings')) {
568 568
 
569 569
 		$setting_changed = false;
570 570
 
571 571
 		// Loop: check each setting field.
572
-		foreach ( $core_setting_names as $setting_name ) {
572
+		foreach ($core_setting_names as $setting_name) {
573 573
 			// New setting name.
574
-			$new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name );
574
+			$new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name);
575 575
 
576 576
 			// Continue: If setting already set.
577 577
 			if (
578
-				array_key_exists( $new_setting_name, $give_settings )
579
-				&& in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) )
578
+				array_key_exists($new_setting_name, $give_settings)
579
+				&& in_array($give_settings[$new_setting_name], array('enabled', 'disabled'))
580 580
 			) {
581 581
 				continue;
582 582
 			}
583 583
 
584 584
 			// Set checkbox value to radio value.
585
-			$give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' );
585
+			$give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled');
586 586
 
587 587
 			// @see https://github.com/WordImpress/Give/issues/1063
588
-			if ( false !== strpos( $setting_name, 'disable_' ) ) {
588
+			if (false !== strpos($setting_name, 'disable_')) {
589 589
 
590
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' );
591
-			} elseif ( false !== strpos( $setting_name, 'enable_' ) ) {
590
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled');
591
+			} elseif (false !== strpos($setting_name, 'enable_')) {
592 592
 
593
-				$give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enable' : 'disabled' );
593
+				$give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enable' : 'disabled');
594 594
 			}
595 595
 
596 596
 			// Tell bot to update core setting to db.
597
-			if ( ! $setting_changed ) {
597
+			if ( ! $setting_changed) {
598 598
 				$setting_changed = true;
599 599
 			}
600 600
 		}
601 601
 
602 602
 		// Update setting only if they changed.
603
-		if ( $setting_changed ) {
604
-			update_option( 'give_settings', $give_settings );
603
+		if ($setting_changed) {
604
+			update_option('give_settings', $give_settings);
605 605
 		}
606 606
 	}
607 607
 }
@@ -613,25 +613,25 @@  discard block
 block discarded – undo
613 613
  * @return void
614 614
  */
615 615
 function give_v18_upgrades_form_metadata() {
616
-	$forms = new WP_Query( array(
616
+	$forms = new WP_Query(array(
617 617
 			'post_type'      => 'give_forms',
618
-			'posts_per_page' => - 1,
618
+			'posts_per_page' => -1,
619 619
 		)
620 620
 	);
621 621
 
622
-	if ( $forms->have_posts() ) {
623
-		while ( $forms->have_posts() ) {
622
+	if ($forms->have_posts()) {
623
+		while ($forms->have_posts()) {
624 624
 			$forms->the_post();
625 625
 
626 626
 			// Form content.
627 627
 			// Note in version 1.8 display content setting split into display content and content placement setting.
628
-			$show_content = get_post_meta( get_the_ID(), '_give_content_option', true );
629
-			if ( $show_content && ! get_post_meta( get_the_ID(), '_give_display_content', true ) ) {
630
-				$field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' );
631
-				update_post_meta( get_the_ID(), '_give_display_content', $field_value );
628
+			$show_content = get_post_meta(get_the_ID(), '_give_content_option', true);
629
+			if ($show_content && ! get_post_meta(get_the_ID(), '_give_display_content', true)) {
630
+				$field_value = ('none' !== $show_content ? 'enabled' : 'disabled');
631
+				update_post_meta(get_the_ID(), '_give_display_content', $field_value);
632 632
 
633
-				$field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' );
634
-				update_post_meta( get_the_ID(), '_give_content_option', $field_value );
633
+				$field_value = ('none' !== $show_content ? $show_content : 'give_pre_form');
634
+				update_post_meta(get_the_ID(), '_give_content_option', $field_value);
635 635
 			}
636 636
 
637 637
 
@@ -660,15 +660,15 @@  discard block
 block discarded – undo
660 660
 			);
661 661
 
662 662
 
663
-			foreach ( $form_radio_settings as $meta_key ) {
663
+			foreach ($form_radio_settings as $meta_key) {
664 664
 				// Get value.
665
-				$field_value = get_post_meta( get_the_ID(), $meta_key, true );
665
+				$field_value = get_post_meta(get_the_ID(), $meta_key, true);
666 666
 
667 667
 				// Convert meta value only if it is in yes/no/none.
668
-				if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) {
668
+				if (in_array($field_value, array('yes', 'on', 'no', 'none'))) {
669 669
 
670
-					$field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' );
671
-					update_post_meta( get_the_ID(), $meta_key, $field_value );
670
+					$field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled');
671
+					update_post_meta(get_the_ID(), $meta_key, $field_value);
672 672
 				}
673 673
 
674 674
 			}
Please login to merge, or discard this patch.
includes/admin/forms/class-metabox-form-data.php 1 patch
Spacing   +244 added lines, -244 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,20 +86,20 @@  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 );
92
-		$variable_pricing      = give_has_variable_prices( $post_id );
93
-		$prices                = give_get_variable_prices( $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
+		$variable_pricing      = give_has_variable_prices($post_id);
93
+		$prices                = give_get_variable_prices($post_id);
94 94
 
95 95
 		// No empty prices - min. 1.00 for new forms
96
-		if ( empty( $price ) && is_null( $post_id ) ) {
97
-			$price = esc_attr( give_format_decimal( '1.00' ) );
96
+		if (empty($price) && is_null($post_id)) {
97
+			$price = esc_attr(give_format_decimal('1.00'));
98 98
 		}
99 99
 
100 100
 		// Min. $1.00 for new forms
101
-		if ( empty( $custom_amount_minimum ) ) {
102
-			$custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) );
101
+		if (empty($custom_amount_minimum)) {
102
+			$custom_amount_minimum = esc_attr(give_format_decimal('1.00'));
103 103
 		}
104 104
 
105 105
 		// Start with an underscore to hide fields from custom fields list
@@ -109,280 +109,280 @@  discard block
 block discarded – undo
109 109
 			/**
110 110
 			 * Repeatable Field Groups
111 111
 			 */
112
-			'form_field_options'    => apply_filters( 'give_forms_field_options', array(
112
+			'form_field_options'    => apply_filters('give_forms_field_options', array(
113 113
 				'id'     => 'form_field_options',
114
-				'title'  => esc_html__( 'Donation Options', 'give' ),
115
-				'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array(
114
+				'title'  => esc_html__('Donation Options', 'give'),
115
+				'fields' => apply_filters('give_forms_donation_form_metabox_fields', array(
116 116
 						// Donation Option
117 117
 						array(
118
-							'name'        => esc_html__( 'Donation Option', 'give' ),
119
-							'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
120
-							'id'          => $prefix . 'price_option',
118
+							'name'        => esc_html__('Donation Option', 'give'),
119
+							'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
120
+							'id'          => $prefix.'price_option',
121 121
 							'type'        => 'radio_inline',
122 122
 							'default'     => 'set',
123
-							'options'     => apply_filters( 'give_forms_price_options', array(
124
-								'set'   => esc_html__( 'Set Donation', 'give' ),
125
-								'multi' => esc_html__( 'Multi-level Donation', 'give' ),
126
-							) ),
123
+							'options'     => apply_filters('give_forms_price_options', array(
124
+								'set'   => esc_html__('Set Donation', 'give'),
125
+								'multi' => esc_html__('Multi-level Donation', 'give'),
126
+							)),
127 127
 						),
128 128
 						array(
129
-							'name'          => esc_html__( 'Set Donation', 'give' ),
130
-							'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' ),
131
-							'id'            => $prefix . 'set_price',
129
+							'name'          => esc_html__('Set Donation', 'give'),
130
+							'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'),
131
+							'id'            => $prefix.'set_price',
132 132
 							'type'          => 'text_small',
133 133
 							'data_type'     => 'price',
134 134
 							'attributes'    => array(
135
-								'placeholder' => give_format_decimal( '1.00' ),
136
-								'value'       => give_format_decimal( $price ),
135
+								'placeholder' => give_format_decimal('1.00'),
136
+								'value'       => give_format_decimal($price),
137 137
 								'class'       => 'cmb-type-text-small give-money-field',
138 138
 							),
139 139
 						),
140 140
 						// Donation Levels: Repeatable CMB2 Group
141 141
 						array(
142
-							'id'      => $prefix . 'donation_levels',
142
+							'id'      => $prefix.'donation_levels',
143 143
 							'type'    => 'group',
144 144
 							'options' => array(
145
-								'add_button'    => esc_html__( 'Add Level', 'give' ),
146
-								'header_title'  => esc_html__( 'Donation Level', 'give' ),
145
+								'add_button'    => esc_html__('Add Level', 'give'),
146
+								'header_title'  => esc_html__('Donation Level', 'give'),
147 147
 								'remove_button' => '<span class="dashicons dashicons-no"></span>',
148 148
 							),
149 149
 							// Fields array works the same, except id's only need to be unique for this group.
150 150
 							// Prefix is not needed.
151
-							'fields'  => apply_filters( 'give_donation_levels_table_row', array(
151
+							'fields'  => apply_filters('give_donation_levels_table_row', array(
152 152
 								array(
153
-									'name' => esc_html__( 'ID', 'give' ),
154
-									'id'   => $prefix . 'id',
153
+									'name' => esc_html__('ID', 'give'),
154
+									'id'   => $prefix.'id',
155 155
 									'type' => 'levels_id',
156 156
 								),
157 157
 								array(
158
-									'name'         => esc_html__( 'Amount', 'give' ),
159
-									'id'           => $prefix . 'amount',
158
+									'name'         => esc_html__('Amount', 'give'),
159
+									'id'           => $prefix.'amount',
160 160
 									'type'         => 'text_small',
161 161
 									'data_type'    => 'price',
162 162
 									'attributes'   => array(
163
-										'placeholder' => give_format_decimal( '1.00' ),
163
+										'placeholder' => give_format_decimal('1.00'),
164 164
 										'class'       => 'cmb-type-text-small give-money-field',
165 165
 									),
166 166
 									'before'       => 'give_format_admin_multilevel_amount',
167 167
 								),
168 168
 								array(
169
-									'name'       => esc_html__( 'Text', 'give' ),
170
-									'id'         => $prefix . 'text',
169
+									'name'       => esc_html__('Text', 'give'),
170
+									'id'         => $prefix.'text',
171 171
 									'type'       => 'text',
172 172
 									'attributes' => array(
173
-										'placeholder' => esc_html__( 'Donation Level', 'give' ),
173
+										'placeholder' => esc_html__('Donation Level', 'give'),
174 174
 										'class'       => 'give-multilevel-text-field',
175 175
 									),
176 176
 								),
177 177
 								array(
178
-									'name' => esc_html__( 'Default', 'give' ),
179
-									'id'   => $prefix . 'default',
178
+									'name' => esc_html__('Default', 'give'),
179
+									'id'   => $prefix.'default',
180 180
 									'type' => 'give_default_radio_inline',
181 181
 								),
182
-							) ),
182
+							)),
183 183
 						),
184 184
 						// Display Style
185 185
 						array(
186
-							'name'        => esc_html__( 'Display Style', 'give' ),
187
-							'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ),
188
-							'id'          => $prefix . 'display_style',
186
+							'name'        => esc_html__('Display Style', 'give'),
187
+							'description' => esc_html__('Set how the donations levels will display on the form.', 'give'),
188
+							'id'          => $prefix.'display_style',
189 189
 							'type'        => 'radio_inline',
190 190
 							'default'     => 'buttons',
191 191
 							'options'     => array(
192
-								'buttons'  => esc_html__( 'Buttons', 'give' ),
193
-								'radios'   => esc_html__( 'Radios', 'give' ),
194
-								'dropdown' => esc_html__( 'Dropdown', 'give' ),
192
+								'buttons'  => esc_html__('Buttons', 'give'),
193
+								'radios'   => esc_html__('Radios', 'give'),
194
+								'dropdown' => esc_html__('Dropdown', 'give'),
195 195
 							),
196 196
 						),
197 197
 						// Custom Amount
198 198
 						array(
199
-							'name'        => esc_html__( 'Custom Amount', 'give' ),
200
-							'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ),
201
-							'id'          => $prefix . 'custom_amount',
199
+							'name'        => esc_html__('Custom Amount', 'give'),
200
+							'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'),
201
+							'id'          => $prefix.'custom_amount',
202 202
 							'type'        => 'radio_inline',
203 203
 							'default'     => 'disabled',
204 204
 							'options'     => array(
205
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
206
-								'disabled' => esc_html__( 'Disabled', 'give' ),
205
+								'enabled'  => esc_html__('Enabled', 'give'),
206
+								'disabled' => esc_html__('Disabled', 'give'),
207 207
 							),
208 208
 						),
209 209
 						array(
210
-							'name'        => esc_html__( 'Minimum Amount', 'give' ),
211
-							'description' => esc_html__( 'Enter the minimum custom donation amount.', 'give' ),
212
-							'id'          => $prefix . 'custom_amount_minimum',
210
+							'name'        => esc_html__('Minimum Amount', 'give'),
211
+							'description' => esc_html__('Enter the minimum custom donation amount.', 'give'),
212
+							'id'          => $prefix.'custom_amount_minimum',
213 213
 							'type'        => 'text_small',
214 214
 							'data_type'   => 'price',
215 215
 							'attributes'  => array(
216
-								'placeholder' => give_format_decimal( '1.00' ),
217
-								'value'       => give_format_decimal( $custom_amount_minimum ),
216
+								'placeholder' => give_format_decimal('1.00'),
217
+								'value'       => give_format_decimal($custom_amount_minimum),
218 218
 								'class'       => 'cmb-type-text-small give-money-field',
219 219
 							),
220 220
 						),
221 221
 						array(
222
-							'name'        => esc_html__( 'Custom Amount Text', 'give' ),
223
-							'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' ),
224
-							'id'          => $prefix . 'custom_amount_text',
222
+							'name'        => esc_html__('Custom Amount Text', 'give'),
223
+							'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'),
224
+							'id'          => $prefix.'custom_amount_text',
225 225
 							'type'        => 'text',
226 226
 							'attributes'  => array(
227 227
 								'rows'        => 3,
228
-								'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ),
228
+								'placeholder' => esc_attr__('Give a Custom Amount', 'give'),
229 229
 							),
230 230
 						),
231 231
 					)
232 232
 				),
233
-			) ),
233
+			)),
234 234
 
235 235
 			/**
236 236
 			 * Donation Goals
237 237
 			 */
238
-			'donation_goal_options' => apply_filters( 'give_donation_goal_options', array(
238
+			'donation_goal_options' => apply_filters('give_donation_goal_options', array(
239 239
 				'id'     => 'donation_goal_options',
240
-				'title'  => esc_html__( 'Donation Goal', 'give' ),
241
-				'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array(
240
+				'title'  => esc_html__('Donation Goal', 'give'),
241
+				'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array(
242 242
 					// Goals
243 243
 					array(
244
-						'name'        => esc_html__( 'Donation Goal', 'give' ),
245
-						'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ),
246
-						'id'          => $prefix . 'goal_option',
244
+						'name'        => esc_html__('Donation Goal', 'give'),
245
+						'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'),
246
+						'id'          => $prefix.'goal_option',
247 247
 						'type'        => 'radio_inline',
248 248
 						'default'     => 'disabled',
249 249
 						'options'     => array(
250
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
251
-							'disabled' => esc_html__( 'Disabled', 'give' ),
250
+							'enabled'  => esc_html__('Enabled', 'give'),
251
+							'disabled' => esc_html__('Disabled', 'give'),
252 252
 						),
253 253
 					),
254 254
 					array(
255
-						'name'        => esc_html__( 'Goal Amount', 'give' ),
256
-						'description' => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ),
257
-						'id'          => $prefix . 'set_goal',
255
+						'name'        => esc_html__('Goal Amount', 'give'),
256
+						'description' => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'),
257
+						'id'          => $prefix.'set_goal',
258 258
 						'type'        => 'text_small',
259 259
 						'data_type'   => 'decimal',
260 260
 						'attributes'  => array(
261
-							'placeholder' => give_format_decimal( '0.00' ),
262
-							'value'       => give_format_decimal( $goal ),
261
+							'placeholder' => give_format_decimal('0.00'),
262
+							'value'       => give_format_decimal($goal),
263 263
 							'class'       => 'cmb-type-text-small give-money-field',
264 264
 						),
265 265
 					),
266 266
 
267 267
 					array(
268
-						'name'        => esc_html__( 'Goal Format', 'give' ),
269
-						'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' ),
270
-						'id'          => $prefix . 'goal_format',
268
+						'name'        => esc_html__('Goal Format', 'give'),
269
+						'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'),
270
+						'id'          => $prefix.'goal_format',
271 271
 						'type'        => 'radio_inline',
272 272
 						'default'     => 'amount',
273 273
 						'options'     => array(
274
-							'amount'     => esc_html__( 'Amount', 'give' ),
275
-							'percentage' => esc_html__( 'Percentage', 'give' ),
274
+							'amount'     => esc_html__('Amount', 'give'),
275
+							'percentage' => esc_html__('Percentage', 'give'),
276 276
 						),
277 277
 					),
278 278
 					array(
279
-						'name'    => esc_html__( 'Progress Bar Color', 'give' ),
280
-						'desc'    => esc_html__( 'Customize the color of the goal progress bar.', 'give' ),
281
-						'id'      => $prefix . 'goal_color',
279
+						'name'    => esc_html__('Progress Bar Color', 'give'),
280
+						'desc'    => esc_html__('Customize the color of the goal progress bar.', 'give'),
281
+						'id'      => $prefix.'goal_color',
282 282
 						'type'    => 'colorpicker',
283 283
 						'default' => '#2bc253',
284 284
 					),
285 285
 
286 286
 					array(
287
-						'name'    => esc_html__( 'Close Form', 'give' ),
288
-						'desc'    => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
289
-						'id'      => $prefix . 'close_form_when_goal_achieved',
287
+						'name'    => esc_html__('Close Form', 'give'),
288
+						'desc'    => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
289
+						'id'      => $prefix.'close_form_when_goal_achieved',
290 290
 						'type'    => 'radio_inline',
291 291
 						'default' => 'disabled',
292 292
 						'options' => array(
293
-							'enabled'  => esc_html__( 'Enabled', 'give' ),
294
-							'disabled' => esc_html__( 'Disabled', 'give' ),
293
+							'enabled'  => esc_html__('Enabled', 'give'),
294
+							'disabled' => esc_html__('Disabled', 'give'),
295 295
 						),
296 296
 					),
297 297
 					array(
298
-						'name'       => esc_html__( 'Goal Achieved Message', 'give' ),
299
-						'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' ),
300
-						'id'         => $prefix . 'form_goal_achieved_message',
298
+						'name'       => esc_html__('Goal Achieved Message', 'give'),
299
+						'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'),
300
+						'id'         => $prefix.'form_goal_achieved_message',
301 301
 						'type'       => 'textarea',
302 302
 						'attributes' => array(
303
-							'placeholder' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
303
+							'placeholder' => esc_attr__('Thank you to all our donors, we have met our fundraising goal.', 'give'),
304 304
 						),
305 305
 					),
306
-				) ),
307
-			) ),
306
+				)),
307
+			)),
308 308
 
309 309
 			/**
310 310
 			 * Display Options
311 311
 			 */
312
-			'form_display_options'  => apply_filters( 'give_form_display_options', array(
312
+			'form_display_options'  => apply_filters('give_form_display_options', array(
313 313
 					'id'     => 'form_display_options',
314
-					'title'  => esc_html__( 'Form Display', 'give' ),
315
-					'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array(
314
+					'title'  => esc_html__('Form Display', 'give'),
315
+					'fields' => apply_filters('give_forms_display_options_metabox_fields', array(
316 316
 							array(
317
-								'name'    => esc_html__( 'Display Options', 'give' ),
318
-								'desc'    => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ),
319
-								'id'      => $prefix . 'payment_display',
317
+								'name'    => esc_html__('Display Options', 'give'),
318
+								'desc'    => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'),
319
+								'id'      => $prefix.'payment_display',
320 320
 								'type'    => 'radio_inline',
321 321
 								'options' => array(
322
-									'onpage' => esc_html__( 'All Fields', 'give' ),
323
-									'modal'  => esc_html__( 'Modal', 'give' ),
324
-									'reveal' => esc_html__( 'Reveal', 'give' ),
322
+									'onpage' => esc_html__('All Fields', 'give'),
323
+									'modal'  => esc_html__('Modal', 'give'),
324
+									'reveal' => esc_html__('Reveal', 'give'),
325 325
 								),
326 326
 								'default' => 'onpage',
327 327
 							),
328 328
 							array(
329
-								'id'         => $prefix . 'reveal_label',
330
-								'name'       => esc_html__( 'Continue Button', 'give' ),
331
-								'desc'       => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ),
329
+								'id'         => $prefix.'reveal_label',
330
+								'name'       => esc_html__('Continue Button', 'give'),
331
+								'desc'       => esc_html__('The button label for displaying the additional payment fields.', 'give'),
332 332
 								'type'       => 'text_small',
333 333
 								'attributes' => array(
334
-									'placeholder' => esc_attr__( 'Donate Now', 'give' ),
334
+									'placeholder' => esc_attr__('Donate Now', 'give'),
335 335
 								),
336 336
 							),
337 337
 							array(
338
-								'id'         => $prefix . 'checkout_label',
339
-								'name'       => esc_html__( 'Submit Button', 'give' ),
340
-								'desc'       => esc_html__( 'The button label for completing a donation.', 'give' ),
338
+								'id'         => $prefix.'checkout_label',
339
+								'name'       => esc_html__('Submit Button', 'give'),
340
+								'desc'       => esc_html__('The button label for completing a donation.', 'give'),
341 341
 								'type'       => 'text_small',
342 342
 								'attributes' => array(
343
-									'placeholder' => esc_html__( 'Donate Now', 'give' ),
343
+									'placeholder' => esc_html__('Donate Now', 'give'),
344 344
 								),
345 345
 							),
346 346
 							array(
347
-								'name' => esc_html__( 'Default Gateway', 'give' ),
348
-								'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' ),
349
-								'id'   => $prefix . 'default_gateway',
347
+								'name' => esc_html__('Default Gateway', 'give'),
348
+								'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'),
349
+								'id'   => $prefix.'default_gateway',
350 350
 								'type' => 'default_gateway',
351 351
 							),
352 352
 							array(
353
-								'name'    => esc_html__( 'Guest Donations', 'give' ),
354
-								'desc'    => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ),
355
-								'id'      => $prefix . 'logged_in_only',
353
+								'name'    => esc_html__('Guest Donations', 'give'),
354
+								'desc'    => esc_html__('Do you want to require users be logged-in to make donations?', 'give'),
355
+								'id'      => $prefix.'logged_in_only',
356 356
 								'type'    => 'radio_inline',
357 357
 								'default' => 'enabled',
358 358
 								'options' => array(
359
-									'enabled'  => esc_html__( 'Enabled', 'give' ),
360
-									'disabled' => esc_html__( 'Disabled', 'give' ),
359
+									'enabled'  => esc_html__('Enabled', 'give'),
360
+									'disabled' => esc_html__('Disabled', 'give'),
361 361
 								),
362 362
 							),
363 363
 							array(
364
-								'name'    => esc_html__( 'Registration', 'give' ),
365
-								'desc'    => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
366
-								'id'      => $prefix . 'show_register_form',
364
+								'name'    => esc_html__('Registration', 'give'),
365
+								'desc'    => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
366
+								'id'      => $prefix.'show_register_form',
367 367
 								'type'    => 'radio',
368 368
 								'options' => array(
369
-									'none'         => esc_html__( 'None', 'give' ),
370
-									'registration' => esc_html__( 'Registration', 'give' ),
371
-									'login'        => esc_html__( 'Login', 'give' ),
372
-									'both'         => esc_html__( 'Registration + Login', 'give' ),
369
+									'none'         => esc_html__('None', 'give'),
370
+									'registration' => esc_html__('Registration', 'give'),
371
+									'login'        => esc_html__('Login', 'give'),
372
+									'both'         => esc_html__('Registration + Login', 'give'),
373 373
 								),
374 374
 								'default' => 'none',
375 375
 							),
376 376
 							array(
377
-								'name'    => esc_html__( 'Floating Labels', 'give' ),
377
+								'name'    => esc_html__('Floating Labels', 'give'),
378 378
 								/* translators: %s: forms https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
379
-								'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( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
380
-								'id'      => $prefix . 'form_floating_labels',
379
+								'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('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
380
+								'id'      => $prefix.'form_floating_labels',
381 381
 								'type'    => 'radio_inline',
382 382
 								'options' => array(
383
-									'global'   => esc_html__( 'Global Options', 'give' ),
384
-									'enabled'  => esc_html__( 'Enabled', 'give' ),
385
-									'disabled' => esc_html__( 'Disabled', 'give' ),
383
+									'global'   => esc_html__('Global Options', 'give'),
384
+									'enabled'  => esc_html__('Enabled', 'give'),
385
+									'disabled' => esc_html__('Disabled', 'give'),
386 386
 								),
387 387
 								'default' => 'global',
388 388
 							),
@@ -394,92 +394,92 @@  discard block
 block discarded – undo
394 394
 			/**
395 395
 			 * Content Field
396 396
 			 */
397
-			'form_content_options'  => apply_filters( 'give_forms_content_options', array(
397
+			'form_content_options'  => apply_filters('give_forms_content_options', array(
398 398
 				'id'     => 'form_content_options',
399
-				'title'  => esc_html__( 'Form Content', 'give' ),
400
-				'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array(
399
+				'title'  => esc_html__('Form Content', 'give'),
400
+				'fields' => apply_filters('give_forms_content_options_metabox_fields', array(
401 401
 
402 402
 						// Donation content.
403 403
 						array(
404
-							'name'        => esc_html__( 'Display Content', 'give' ),
405
-							'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ),
406
-							'id'          => $prefix . 'display_content',
404
+							'name'        => esc_html__('Display Content', 'give'),
405
+							'description' => esc_html__('Do you want to add custom content to this form?', 'give'),
406
+							'id'          => $prefix.'display_content',
407 407
 							'type'        => 'radio_inline',
408 408
 							'options'     => array(
409
-								'enabled'  => esc_html__( 'Enabled', 'give' ),
410
-								'disabled' => esc_html__( 'Disabled', 'give' ),
409
+								'enabled'  => esc_html__('Enabled', 'give'),
410
+								'disabled' => esc_html__('Disabled', 'give'),
411 411
 							),
412 412
 							'default'     => 'disabled',
413 413
 						),
414 414
 
415 415
 						// Content placement.
416 416
 						array(
417
-							'name'        => esc_html__( 'Content Placement', 'give' ),
418
-							'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ),
419
-							'id'          => $prefix . 'content_placement',
417
+							'name'        => esc_html__('Content Placement', 'give'),
418
+							'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'),
419
+							'id'          => $prefix.'content_placement',
420 420
 							'type'        => 'radio_inline',
421
-							'options'     => apply_filters( 'give_forms_content_options_select', array(
422
-									'give_pre_form'  => esc_html__( 'Above fields', 'give' ),
423
-									'give_post_form' => esc_html__( 'Below fields', 'give' ),
421
+							'options'     => apply_filters('give_forms_content_options_select', array(
422
+									'give_pre_form'  => esc_html__('Above fields', 'give'),
423
+									'give_post_form' => esc_html__('Below fields', 'give'),
424 424
 								)
425 425
 							),
426 426
 							'default'     => 'give_pre_form',
427 427
 						),
428 428
 						array(
429
-							'name'        => esc_html__( 'Content', 'give' ),
430
-							'description' => esc_html__( 'This content will display on the single give form page.', 'give' ),
431
-							'id'          => $prefix . 'form_content',
429
+							'name'        => esc_html__('Content', 'give'),
430
+							'description' => esc_html__('This content will display on the single give form page.', 'give'),
431
+							'id'          => $prefix.'form_content',
432 432
 							'type'        => 'wysiwyg',
433 433
 						),
434 434
 					)
435 435
 				),
436
-			) ),
436
+			)),
437 437
 
438 438
 			/**
439 439
 			 * Terms & Conditions
440 440
 			 */
441
-			'form_terms_options'    => apply_filters( 'give_forms_terms_options', array(
441
+			'form_terms_options'    => apply_filters('give_forms_terms_options', array(
442 442
 				'id'     => 'form_terms_options',
443
-				'title'  => esc_html__( 'Terms & Conditions', 'give' ),
444
-				'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array(
443
+				'title'  => esc_html__('Terms & Conditions', 'give'),
444
+				'fields' => apply_filters('give_forms_terms_options_metabox_fields', array(
445 445
 						// Donation Option
446 446
 						array(
447
-							'name'        => esc_html__( 'Terms & Conditions', 'give' ),
448
-							'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ),
449
-							'id'          => $prefix . 'terms_option',
447
+							'name'        => esc_html__('Terms & Conditions', 'give'),
448
+							'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'),
449
+							'id'          => $prefix.'terms_option',
450 450
 							'type'        => 'radio_inline',
451
-							'options'     => apply_filters( 'give_forms_content_options_select', array(
452
-									'global'   => esc_html__( 'Global Options', 'give' ),
453
-									'enabled'  => esc_html__( 'Customize', 'give' ),
454
-									'disabled' => esc_html__( 'Disable', 'give' ),
451
+							'options'     => apply_filters('give_forms_content_options_select', array(
452
+									'global'   => esc_html__('Global Options', 'give'),
453
+									'enabled'  => esc_html__('Customize', 'give'),
454
+									'disabled' => esc_html__('Disable', 'give'),
455 455
 								)
456 456
 							),
457 457
 							'default'     => 'global',
458 458
 						),
459 459
 						array(
460
-							'id'         => $prefix . 'agree_label',
461
-							'name'       => esc_html__( 'Agreement Label', 'give' ),
462
-							'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' ),
460
+							'id'         => $prefix.'agree_label',
461
+							'name'       => esc_html__('Agreement Label', 'give'),
462
+							'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'),
463 463
 							'type'       => 'text',
464 464
 							'size'       => 'regular',
465 465
 							'attributes' => array(
466
-								'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
466
+								'placeholder' => esc_attr__('Agree to Terms?', 'give'),
467 467
 							),
468 468
 						),
469 469
 						array(
470
-							'id'   => $prefix . 'agree_text',
471
-							'name' => esc_html__( 'Agreement Text', 'give' ),
472
-							'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
470
+							'id'   => $prefix.'agree_text',
471
+							'name' => esc_html__('Agreement Text', 'give'),
472
+							'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
473 473
 							'type' => 'wysiwyg',
474 474
 						),
475 475
 					)
476 476
 				),
477
-			) ),
477
+			)),
478 478
 		);
479 479
 		/**
480 480
 		 * Filter the metabox tabbed panel settings.
481 481
 		 */
482
-		$settings = apply_filters( 'give_metabox_form_data_settings', $settings );
482
+		$settings = apply_filters('give_metabox_form_data_settings', $settings);
483 483
 
484 484
 		// Output.
485 485
 		return $settings;
@@ -495,8 +495,8 @@  discard block
 block discarded – undo
495 495
 		add_meta_box(
496 496
 			$this->get_metabox_ID(),
497 497
 			$this->get_metabox_label(),
498
-			array( $this, 'output' ),
499
-			array( 'give_forms' ),
498
+			array($this, 'output'),
499
+			array('give_forms'),
500 500
 			'normal',
501 501
 			'high'
502 502
 		);
@@ -512,9 +512,9 @@  discard block
 block discarded – undo
512 512
 	function enqueue_script() {
513 513
 		global $post;
514 514
 
515
-		if ( is_object( $post ) && 'give_forms' === $post->post_type ) {
516
-			wp_enqueue_style( 'wp-color-picker' );
517
-			wp_enqueue_script( 'wp-color-picker' );
515
+		if (is_object($post) && 'give_forms' === $post->post_type) {
516
+			wp_enqueue_style('wp-color-picker');
517
+			wp_enqueue_script('wp-color-picker');
518 518
 		}
519 519
 	}
520 520
 
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	public function get_tabs() {
549 549
 		$tabs = array();
550 550
 
551
-		if ( ! empty( $this->settings ) ) {
552
-			foreach ( $this->settings as $setting ) {
553
-				if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) {
551
+		if ( ! empty($this->settings)) {
552
+			foreach ($this->settings as $setting) {
553
+				if ( ! isset($setting['id']) || ! isset($setting['title'])) {
554 554
 					continue;
555 555
 				}
556 556
 
@@ -572,31 +572,31 @@  discard block
 block discarded – undo
572 572
 	 */
573 573
 	public function output() {
574 574
 		// Bailout.
575
-		if ( $form_data_tabs = $this->get_tabs() ) {
576
-			wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' );
575
+		if ($form_data_tabs = $this->get_tabs()) {
576
+			wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce');
577 577
 			?>
578 578
 			<div class="give-metabox-panel-wrap">
579 579
 				<ul class="give-form-data-tabs give-metabox-tabs">
580
-					<?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?>
581
-						<li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ); ?>">
580
+					<?php foreach ($form_data_tabs as $index => $form_data_tab) : ?>
581
+						<li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : ''); ?>">
582 582
 							<a href="#<?php echo $form_data_tab['id']; ?>"><?php echo $form_data_tab['label']; ?></a>
583 583
 						</li>
584 584
 					<?php endforeach; ?>
585 585
 				</ul>
586 586
 
587 587
 				<?php $show_first_tab_content = true; ?>
588
-				<?php foreach ( $this->settings as $setting ) : ?>
589
-					<?php do_action( "give_before_{$setting['id']}_settings" ); ?>
588
+				<?php foreach ($this->settings as $setting) : ?>
589
+					<?php do_action("give_before_{$setting['id']}_settings"); ?>
590 590
 
591
-					<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel <?php echo( $show_first_tab_content ? '' : 'give-hidden' );$show_first_tab_content = false; ?>">
592
-						<?php if ( ! empty( $setting['fields'] ) ) : ?>
593
-							<?php foreach ( $setting['fields'] as $field ) : ?>
594
-								<?php give_render_field( $field ); ?>
591
+					<div id="<?php echo $setting['id']; ?>" class="panel give_options_panel <?php echo($show_first_tab_content ? '' : 'give-hidden'); $show_first_tab_content = false; ?>">
592
+						<?php if ( ! empty($setting['fields'])) : ?>
593
+							<?php foreach ($setting['fields'] as $field) : ?>
594
+								<?php give_render_field($field); ?>
595 595
 							<?php endforeach; ?>
596 596
 						<?php endif; ?>
597 597
 					</div>
598 598
 
599
-					<?php do_action( "give_after_{$setting['id']}_settings" ); ?>
599
+					<?php do_action("give_after_{$setting['id']}_settings"); ?>
600 600
 				<?php endforeach; ?>
601 601
 			</div>
602 602
 			<?php
@@ -610,13 +610,13 @@  discard block
 block discarded – undo
610 610
 	 * @return mixed|void
611 611
 	 */
612 612
 	function cmb2_metabox_settings() {
613
-		$all_cmb2_settings   = apply_filters( 'cmb2_meta_boxes', array() );
613
+		$all_cmb2_settings   = apply_filters('cmb2_meta_boxes', array());
614 614
 		$give_forms_settings = $all_cmb2_settings;
615 615
 
616 616
 		// Filter settings: Use only give forms related settings.
617
-		foreach ( $all_cmb2_settings as $index => $setting ) {
618
-			if ( ! in_array( 'give_forms', $setting['object_types'] ) ) {
619
-				unset( $give_forms_settings[ $index ] );
617
+		foreach ($all_cmb2_settings as $index => $setting) {
618
+			if ( ! in_array('give_forms', $setting['object_types'])) {
619
+				unset($give_forms_settings[$index]);
620 620
 			}
621 621
 		}
622 622
 
@@ -634,98 +634,98 @@  discard block
 block discarded – undo
634 634
 	 *
635 635
 	 * @return void
636 636
 	 */
637
-	public function save( $post_id, $post ) {
637
+	public function save($post_id, $post) {
638 638
 
639 639
 		// $post_id and $post are required.
640
-		if ( empty( $post_id ) || empty( $post ) ) {
640
+		if (empty($post_id) || empty($post)) {
641 641
 			return;
642 642
 		}
643 643
 
644 644
 		// Don't save meta boxes for revisions or autosaves.
645
-		if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) {
645
+		if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) {
646 646
 			return;
647 647
 		}
648 648
 
649 649
 		// Check the nonce.
650
-		if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) {
650
+		if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) {
651 651
 			return;
652 652
 		}
653 653
 
654 654
 		// Check the post being saved == the $post_id to prevent triggering this call for other save_post events.
655
-		if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) {
655
+		if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) {
656 656
 			return;
657 657
 		}
658 658
 
659 659
 		// Check user has permission to edit.
660
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
660
+		if ( ! current_user_can('edit_post', $post_id)) {
661 661
 			return;
662 662
 		}
663 663
 
664 664
 		// Fire action before saving form meta.
665
-		do_action( 'give_pre_process_give_forms_meta', $post_id, $post );
665
+		do_action('give_pre_process_give_forms_meta', $post_id, $post);
666 666
 
667 667
 		/**
668 668
 		 * Filter the meta key to save.
669 669
 		 * Third party addon developer can remove there meta keys from this array to handle saving data on there own.
670 670
 		 */
671
-		$form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() );
671
+		$form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings());
672 672
 
673 673
 		// Save form meta data.
674
-		if ( ! empty( $form_meta_keys ) ) {
675
-			foreach ( $form_meta_keys as $form_meta_key ) {
676
-				if ( isset( $_POST[ $form_meta_key ] ) ) {
677
-					if ( $field_type = $this->get_field_type( $form_meta_key ) ) {
678
-						switch ( $field_type ) {
674
+		if ( ! empty($form_meta_keys)) {
675
+			foreach ($form_meta_keys as $form_meta_key) {
676
+				if (isset($_POST[$form_meta_key])) {
677
+					if ($field_type = $this->get_field_type($form_meta_key)) {
678
+						switch ($field_type) {
679 679
 							case 'wysiwyg':
680
-								$form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] );
681
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
680
+								$form_meta_value = wp_kses_post($_POST[$form_meta_key]);
681
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
682 682
 								break;
683 683
 							
684 684
 							case 'group':
685 685
 								$form_meta_value = array();
686 686
 
687
-								foreach ( $_POST[ $form_meta_key ] as $index => $group ) {
687
+								foreach ($_POST[$form_meta_key] as $index => $group) {
688 688
 									$group_meta_value = array();
689
-									foreach ( $group as $field_id => $field_value ){
690
-										switch ( $this->get_field_type( $field_id, $form_meta_key ) ) {
689
+									foreach ($group as $field_id => $field_value) {
690
+										switch ($this->get_field_type($field_id, $form_meta_key)) {
691 691
 											case 'wysiwyg':
692
-												$group_meta_value[$field_id] = wp_kses_post( $field_value );
692
+												$group_meta_value[$field_id] = wp_kses_post($field_value);
693 693
 												break;
694 694
 
695 695
 											default:
696
-												$group_meta_value[$field_id] = give_clean( $field_value );
696
+												$group_meta_value[$field_id] = give_clean($field_value);
697 697
 										}
698 698
 									}
699 699
 
700
-									if( ! empty( $group_meta_value ) ) {
700
+									if ( ! empty($group_meta_value)) {
701 701
 										$form_meta_value[$index] = $group_meta_value;
702 702
 									}
703 703
 								}
704 704
 
705 705
 
706 706
 								// Arrange repeater field keys in order.
707
-								$form_meta_value = array_values( $form_meta_value );
707
+								$form_meta_value = array_values($form_meta_value);
708 708
 
709 709
 								// Save data.
710
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
710
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
711 711
 								break;
712 712
 
713 713
 							default:
714
-								$form_meta_value = give_clean( $_POST[ $form_meta_key ] );
714
+								$form_meta_value = give_clean($_POST[$form_meta_key]);
715 715
 
716 716
 								// Save data.
717
-								update_post_meta( $post_id, $form_meta_key, $form_meta_value );
717
+								update_post_meta($post_id, $form_meta_key, $form_meta_value);
718 718
 						}
719 719
 
720 720
 						// Fire after saving form meta key.
721
-						do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post );
721
+						do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post);
722 722
 					}
723 723
 				}
724 724
 			}
725 725
 		}
726 726
 
727 727
 		// Fire action after saving form meta.
728
-		do_action( 'give_post_process_give_forms_meta', $post_id, $post );
728
+		do_action('give_post_process_give_forms_meta', $post_id, $post);
729 729
 	}
730 730
 
731 731
 
@@ -737,9 +737,9 @@  discard block
 block discarded – undo
737 737
 	 */
738 738
 	private function get_meta_keys_from_settings() {
739 739
 		$meta_keys = array();
740
-		foreach ( $this->settings as $setting ) {
741
-			if ( ! empty( $setting['fields'] ) ) {
742
-				foreach ( $setting['fields'] as $field ) {
740
+		foreach ($this->settings as $setting) {
741
+			if ( ! empty($setting['fields'])) {
742
+				foreach ($setting['fields'] as $field) {
743 743
 					$meta_keys[] = $field['id'];
744 744
 				}
745 745
 			}
@@ -759,9 +759,9 @@  discard block
 block discarded – undo
759 759
 	 *
760 760
 	 * @return string
761 761
 	 */
762
-	function get_field_type( $field_id, $group_id = '' ) {
762
+	function get_field_type($field_id, $group_id = '') {
763 763
 
764
-		return $this->get_setting_field( $field_id, $group_id )['type'];
764
+		return $this->get_setting_field($field_id, $group_id)['type'];
765 765
 	}
766 766
 
767 767
 	/**
@@ -774,17 +774,17 @@  discard block
 block discarded – undo
774 774
 	 *
775 775
 	 * @return array
776 776
 	 */
777
-	function get_setting_field( $field_id, $group_id = '' ) {
777
+	function get_setting_field($field_id, $group_id = '') {
778 778
 		$setting_field = array();
779 779
 		
780 780
 		$_field_id = $field_id;
781
-		$field_id  = empty( $group_id ) ? $field_id : $group_id;
781
+		$field_id  = empty($group_id) ? $field_id : $group_id;
782 782
 
783
-		if ( ! empty( $this->settings ) ) {
784
-			foreach ( $this->settings as $setting ) {
785
-				if ( ! empty( $setting['fields'] ) ) {
786
-					foreach ( $setting['fields'] as $field ) {
787
-						if ( $field['id'] === $field_id ) {
783
+		if ( ! empty($this->settings)) {
784
+			foreach ($this->settings as $setting) {
785
+				if ( ! empty($setting['fields'])) {
786
+					foreach ($setting['fields'] as $field) {
787
+						if ($field['id'] === $field_id) {
788 788
 							$setting_field = $field;
789 789
 						}
790 790
 					}
@@ -794,9 +794,9 @@  discard block
 block discarded – undo
794 794
 		
795 795
 		
796 796
 		// Get field from group.
797
-		if( ! empty( $group_id ) ) {
798
-			foreach ( $setting_field['fields'] as $field ) {
799
-				if ( $field['id'] === $_field_id ) {
797
+		if ( ! empty($group_id)) {
798
+			foreach ($setting_field['fields'] as $field) {
799
+				if ($field['id'] === $_field_id) {
800 800
 					$setting_field = $field;
801 801
 				}
802 802
 			}
@@ -815,13 +815,13 @@  discard block
 block discarded – undo
815 815
 	 *
816 816
 	 * @return mixed
817 817
 	 */
818
-	function add_offline_donations_setting_tab( $settings ) {
819
-		if ( give_is_gateway_active( 'offline' ) ) {
820
-			$settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array(
818
+	function add_offline_donations_setting_tab($settings) {
819
+		if (give_is_gateway_active('offline')) {
820
+			$settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array(
821 821
 				'id'     => 'offline_donations_options',
822
-				'title'  => esc_html__( 'Offline Donations', 'give' ),
823
-				'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ),
824
-			) );
822
+				'title'  => esc_html__('Offline Donations', 'give'),
823
+				'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()),
824
+			));
825 825
 		}
826 826
 
827 827
 		return $settings;
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		$this->shortcode['title'] = esc_html__( 'Donation Form', 'give' );
28
-		$this->shortcode['label'] = esc_html__( 'Donation Form', 'give' );
27
+		$this->shortcode['title'] = esc_html__('Donation Form', 'give');
28
+		$this->shortcode['label'] = esc_html__('Donation Form', 'give');
29 29
 
30
-		parent::__construct( 'give_form' );
30
+		parent::__construct('give_form');
31 31
 	}
32 32
 
33 33
 	/**
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$create_form_link = sprintf(
41 41
 		/* translators: %s: create new form URL */
42
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
43
-			admin_url( 'post-new.php?post_type=give_forms' )
42
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
43
+			admin_url('post-new.php?post_type=give_forms')
44 44
 		);
45 45
 
46 46
 		return array(
@@ -50,59 +50,59 @@  discard block
 block discarded – undo
50 50
 					'post_type' => 'give_forms',
51 51
 				),
52 52
 				'name'        => 'id',
53
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
54
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
53
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
54
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
55 55
 				'required'    => array(
56
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
57
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
56
+					'alert' => esc_html__('You must first select a Form!', 'give'),
57
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
58 58
 				),
59 59
 			),
60 60
 			array(
61 61
 				'type' => 'container',
62
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
62
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_title',
67
-				'label'   => esc_attr__( 'Show Title:', 'give' ),
68
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
67
+				'label'   => esc_attr__('Show Title:', 'give'),
68
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
69 69
 				'options' => array(
70
-					'true'  => esc_html__( 'Show', 'give' ),
71
-					'false' => esc_html__( 'Hide', 'give' ),
70
+					'true'  => esc_html__('Show', 'give'),
71
+					'false' => esc_html__('Hide', 'give'),
72 72
 				),
73 73
 			),
74 74
 			array(
75 75
 				'type'    => 'listbox',
76 76
 				'name'    => 'show_goal',
77
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
77
+				'label'   => esc_attr__('Show Goal:', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'     => 'listbox',
86 86
 				'name'     => 'show_content',
87 87
 				'minWidth' => 240,
88
-				'label'    => esc_attr__( 'Display Content:', 'give' ),
89
-				'tooltip'  => esc_attr__( 'Do you want to display the form content?', 'give' ),
88
+				'label'    => esc_attr__('Display Content:', 'give'),
89
+				'tooltip'  => esc_attr__('Do you want to display the form content?', 'give'),
90 90
 				'options'  => array(
91
-					'none'  => esc_html__( 'No Content', 'give' ),
92
-					'above' => esc_html__( 'Display content ABOVE the fields', 'give' ),
93
-					'below' => esc_html__( 'Display content BELOW the fields', 'give' ),
91
+					'none'  => esc_html__('No Content', 'give'),
92
+					'above' => esc_html__('Display content ABOVE the fields', 'give'),
93
+					'below' => esc_html__('Display content BELOW the fields', 'give'),
94 94
 				),
95 95
 			),
96 96
 			array(
97 97
 				'type'    => 'listbox',
98 98
 				'name'    => 'display_style',
99
-				'label'   => esc_attr__( 'Donation Options:', 'give' ),
100
-				'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ),
99
+				'label'   => esc_attr__('Donation Options:', 'give'),
100
+				'tooltip' => esc_attr__('How would you like to display donation information?', 'give'),
101 101
 				'options' => array(
102
-					'onpage' => esc_html__( 'All Fields', 'give' ),
103
-					'modal'  => esc_html__( 'Modal', 'give' ),
104
-					'reveal' => esc_html__( 'Reveal', 'give' ),
105
-					'button' => esc_html__( 'Button', 'give' ),
102
+					'onpage' => esc_html__('All Fields', 'give'),
103
+					'modal'  => esc_html__('Modal', 'give'),
104
+					'reveal' => esc_html__('Reveal', 'give'),
105
+					'button' => esc_html__('Button', 'give'),
106 106
 				),
107 107
 			),
108 108
 		);
Please login to merge, or discard this patch.
includes/admin/admin-pages.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -33,37 +33,37 @@  discard block
 block discarded – undo
33 33
 	global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page, $give_tools_page;
34 34
 
35 35
 	//Payments
36
-	$give_payment       = get_post_type_object( 'give_payment' );
37
-	$give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' );
36
+	$give_payment       = get_post_type_object('give_payment');
37
+	$give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page');
38 38
 
39 39
 	//Donors
40
-	$give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donors', 'give' ), esc_html__( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' );
40
+	$give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donors', 'give'), esc_html__('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page');
41 41
 
42 42
 	//Reports`
43
-	$give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Donation Reports', 'give' ), esc_html__( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' );
43
+	$give_reports_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Donation Reports', 'give'), esc_html__('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page');
44 44
 
45 45
 	//Settings
46
-	$give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Settings', 'give' ), esc_html__( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array(
46
+	$give_settings_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Settings', 'give'), esc_html__('Settings', 'give'), 'manage_give_settings', 'give-settings', array(
47 47
 		Give()->give_settings,
48 48
 		'output'
49
-	) );
49
+	));
50 50
 
51 51
 	//Tools.
52
-	$give_tools_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Tools', 'give' ), esc_html__( 'Tools', 'give' ), 'manage_give_settings', 'give-tools', array(
52
+	$give_tools_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Tools', 'give'), esc_html__('Tools', 'give'), 'manage_give_settings', 'give-tools', array(
53 53
 		Give()->give_settings,
54 54
 		'output'
55
-	) );
55
+	));
56 56
 
57 57
 	//Add-ons
58
-	$give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html__( 'Give Add-ons', 'give' ), esc_html__( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' );
58
+	$give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html__('Give Add-ons', 'give'), esc_html__('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page');
59 59
 
60 60
 	//Upgrades
61
-	$give_upgrades_screen = add_submenu_page( null, esc_html__( 'Give Upgrades', 'give' ), esc_html__( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' );
61
+	$give_upgrades_screen = add_submenu_page(null, esc_html__('Give Upgrades', 'give'), esc_html__('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen');
62 62
 
63 63
 
64 64
 }
65 65
 
66
-add_action( 'admin_menu', 'give_add_options_links', 10 );
66
+add_action('admin_menu', 'give_add_options_links', 10);
67 67
 
68 68
 /**
69 69
  *  Determines whether the current admin page is a Give admin page.
@@ -78,224 +78,224 @@  discard block
 block discarded – undo
78 78
  *
79 79
  * @return bool True if Give admin page.
80 80
  */
81
-function give_is_admin_page( $passed_page = '', $passed_view = '' ) {
81
+function give_is_admin_page($passed_page = '', $passed_view = '') {
82 82
 
83 83
 	global $pagenow, $typenow;
84 84
 
85 85
 	$found     = false;
86
-	$post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false;
87
-	$action    = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false;
88
-	$taxonomy  = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false;
89
-	$page      = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false;
90
-	$view      = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false;
91
-	$tab       = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false;
92
-
93
-	switch ( $passed_page ) {
86
+	$post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false;
87
+	$action    = isset($_GET['action']) ? strtolower($_GET['action']) : false;
88
+	$taxonomy  = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false;
89
+	$page      = isset($_GET['page']) ? strtolower($_GET['page']) : false;
90
+	$view      = isset($_GET['view']) ? strtolower($_GET['view']) : false;
91
+	$tab       = isset($_GET['tab']) ? strtolower($_GET['tab']) : false;
92
+
93
+	switch ($passed_page) {
94 94
 		case 'give_forms':
95
-			switch ( $passed_view ) {
95
+			switch ($passed_view) {
96 96
 				case 'list-table':
97
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) {
97
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') {
98 98
 						$found = true;
99 99
 					}
100 100
 					break;
101 101
 				case 'edit':
102
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) {
102
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') {
103 103
 						$found = true;
104 104
 					}
105 105
 					break;
106 106
 				case 'new':
107
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) {
107
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') {
108 108
 						$found = true;
109 109
 					}
110 110
 					break;
111 111
 				default:
112
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) {
112
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) {
113 113
 						$found = true;
114 114
 					}
115 115
 					break;
116 116
 			}
117 117
 			break;
118 118
 		case 'categories':
119
-			switch ( $passed_view ) {
119
+			switch ($passed_view) {
120 120
 				case 'list-table':
121 121
 				case 'new':
122
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) {
122
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) {
123 123
 						$found = true;
124 124
 					}
125 125
 					break;
126 126
 				case 'edit':
127
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) {
127
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) {
128 128
 						$found = true;
129 129
 					}
130 130
 					break;
131 131
 				default:
132
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) {
132
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) {
133 133
 						$found = true;
134 134
 					}
135 135
 					break;
136 136
 			}
137 137
 			break;
138 138
 		case 'tags':
139
-			switch ( $passed_view ) {
139
+			switch ($passed_view) {
140 140
 				case 'list-table':
141 141
 				case 'new':
142
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) {
142
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) {
143 143
 						$found = true;
144 144
 					}
145 145
 					break;
146 146
 				case 'edit':
147
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) {
147
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) {
148 148
 						$found = true;
149 149
 					}
150 150
 					break;
151 151
 				default:
152
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) {
152
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) {
153 153
 						$found = true;
154 154
 					}
155 155
 					break;
156 156
 			}
157 157
 			break;
158 158
 		case 'payments':
159
-			switch ( $passed_view ) {
159
+			switch ($passed_view) {
160 160
 				case 'list-table':
161
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) {
161
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) {
162 162
 						$found = true;
163 163
 					}
164 164
 					break;
165 165
 				case 'edit':
166
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) {
166
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) {
167 167
 						$found = true;
168 168
 					}
169 169
 					break;
170 170
 				default:
171
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) {
171
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) {
172 172
 						$found = true;
173 173
 					}
174 174
 					break;
175 175
 			}
176 176
 			break;
177 177
 		case 'reports':
178
-			switch ( $passed_view ) {
178
+			switch ($passed_view) {
179 179
 				// If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ]
180 180
 				case 'earnings':
181
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) {
181
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) {
182 182
 						$found = true;
183 183
 					}
184 184
 					break;
185 185
 				case 'donors':
186
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) {
186
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) {
187 187
 						$found = true;
188 188
 					}
189 189
 					break;
190 190
 				case 'gateways':
191
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) {
191
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) {
192 192
 						$found = true;
193 193
 					}
194 194
 					break;
195 195
 				case 'export':
196
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) {
196
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) {
197 197
 						$found = true;
198 198
 					}
199 199
 					break;
200 200
 				case 'logs':
201
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) {
201
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) {
202 202
 						$found = true;
203 203
 					}
204 204
 					break;
205 205
 				default:
206
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
206
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
207 207
 						$found = true;
208 208
 					}
209 209
 					break;
210 210
 			}
211 211
 			break;
212 212
 		case 'settings':
213
-			switch ( $passed_view ) {
213
+			switch ($passed_view) {
214 214
 				case 'general':
215
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) {
215
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) {
216 216
 						$found = true;
217 217
 					}
218 218
 					break;
219 219
 				case 'gateways':
220
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) {
220
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) {
221 221
 						$found = true;
222 222
 					}
223 223
 					break;
224 224
 				case 'emails':
225
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) {
225
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) {
226 226
 						$found = true;
227 227
 					}
228 228
 					break;
229 229
 				case 'display':
230
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) {
230
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) {
231 231
 						$found = true;
232 232
 					}
233 233
 					break;
234 234
 				case 'licenses':
235
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) {
235
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) {
236 236
 						$found = true;
237 237
 					}
238 238
 					break;
239 239
 				case 'api':
240
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) {
240
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) {
241 241
 						$found = true;
242 242
 					}
243 243
 					break;
244 244
 				case 'advanced':
245
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) {
245
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) {
246 246
 						$found = true;
247 247
 					}
248 248
 					break;
249 249
 				case 'system_info':
250
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) {
250
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) {
251 251
 						$found = true;
252 252
 					}
253 253
 					break;
254 254
 				default:
255
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) {
255
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) {
256 256
 						$found = true;
257 257
 					}
258 258
 					break;
259 259
 			}
260 260
 			break;
261 261
 		case 'addons':
262
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) {
262
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) {
263 263
 				$found = true;
264 264
 			}
265 265
 			break;
266 266
 		case 'donors':
267
-			switch ( $passed_view ) {
267
+			switch ($passed_view) {
268 268
 				case 'list-table':
269
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) {
269
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) {
270 270
 						$found = true;
271 271
 					}
272 272
 					break;
273 273
 				case 'overview':
274
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) {
274
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) {
275 275
 						$found = true;
276 276
 					}
277 277
 					break;
278 278
 				case 'notes':
279
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) {
279
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) {
280 280
 						$found = true;
281 281
 					}
282 282
 					break;
283 283
 				default:
284
-					if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) {
284
+					if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) {
285 285
 						$found = true;
286 286
 					}
287 287
 					break;
288 288
 			}
289 289
 			break;
290 290
 		case 'reports':
291
-			if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) {
291
+			if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) {
292 292
 				$found = true;
293 293
 			}
294 294
 			break;
295 295
 		default:
296 296
 			global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page, $give_tools_page;
297 297
 
298
-			$admin_pages = apply_filters( 'give_admin_pages', array(
298
+			$admin_pages = apply_filters('give_admin_pages', array(
299 299
 				$give_payments_page,
300 300
 				$give_settings_page,
301 301
 				$give_reports_page,
@@ -306,19 +306,19 @@  discard block
 block discarded – undo
306 306
 				$give_customers_page,
307 307
 				$give_tools_page,
308 308
 				'widgets.php'
309
-		) );
310
-			if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) {
309
+		));
310
+			if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) {
311 311
 				$found = true;
312
-				if ( 'give-upgrades' === $page ) {
312
+				if ('give-upgrades' === $page) {
313 313
 					$found = false;
314 314
 				}
315
-			} elseif ( in_array( $pagenow, $admin_pages ) ) {
315
+			} elseif (in_array($pagenow, $admin_pages)) {
316 316
 				$found = true;
317 317
 			}
318 318
 			break;
319 319
 	}
320 320
 
321
-	return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view );
321
+	return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view);
322 322
 
323 323
 }
324 324
 
@@ -330,37 +330,37 @@  discard block
 block discarded – undo
330 330
  * @param  array $settings
331 331
  * @return array
332 332
  */
333
-function give_settings_page_pages( $settings ) {
334
-	include( 'abstract-admin-settings-page.php' );
335
-	include( 'settings/class-settings-cmb2-backward-compatibility.php' );
333
+function give_settings_page_pages($settings) {
334
+	include('abstract-admin-settings-page.php');
335
+	include('settings/class-settings-cmb2-backward-compatibility.php');
336 336
 
337 337
 	$settings = array(
338 338
 		// General settings.
339
-		include( 'settings/class-settings-general.php' ),
339
+		include('settings/class-settings-general.php'),
340 340
 
341 341
 		// Payment Gateways Settings.
342
-		include( 'settings/class-settings-gateways.php' ),
342
+		include('settings/class-settings-gateways.php'),
343 343
 
344 344
 		// Display settings.
345
-		include( 'settings/class-settings-display.php' ),
345
+		include('settings/class-settings-display.php'),
346 346
 
347 347
 		// Emails settings.
348
-		include( 'settings/class-settings-email.php' ),
348
+		include('settings/class-settings-email.php'),
349 349
 
350 350
 		// Addons settings.
351
-		include( 'settings/class-settings-addon.php' ),
351
+		include('settings/class-settings-addon.php'),
352 352
 
353 353
 		// License settings.
354
-		include( 'settings/class-settings-license.php' ),
354
+		include('settings/class-settings-license.php'),
355 355
 
356 356
 		// Advanced settinns.
357
-		include( 'settings/class-settings-advanced.php' )
357
+		include('settings/class-settings-advanced.php')
358 358
 	);
359 359
 
360 360
 	// Output.
361 361
 	return $settings;
362 362
 }
363
-add_filter( 'give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1 );
363
+add_filter('give-settings_get_settings_pages', 'give_settings_page_pages', 0, 1);
364 364
 
365 365
 
366 366
 /**
@@ -370,25 +370,25 @@  discard block
 block discarded – undo
370 370
  * @param  array $settings
371 371
  * @return array
372 372
  */
373
-function give_tools_page_pages( $settings ) {
373
+function give_tools_page_pages($settings) {
374 374
 	$settings = array(
375 375
 		// System Info.
376
-		include( 'tools/class-settings-system-info.php' ),
376
+		include('tools/class-settings-system-info.php'),
377 377
 
378 378
 		// Logs.
379
-		include( 'tools/class-settings-logs.php' ),
379
+		include('tools/class-settings-logs.php'),
380 380
 
381 381
 		// API.
382
-		include( 'tools/class-settings-api.php' ),
382
+		include('tools/class-settings-api.php'),
383 383
 
384 384
 		// Data.
385
-		include( 'tools/class-settings-data.php' ),
385
+		include('tools/class-settings-data.php'),
386 386
 	);
387 387
 
388 388
 	// Output.
389 389
 	return $settings;
390 390
 }
391
-add_filter( 'give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1 );
391
+add_filter('give-tools_get_settings_pages', 'give_tools_page_pages', 0, 1);
392 392
 
393 393
 /**
394 394
  * Set default tools page tab.
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
  * @param  string $default_tab Default tab name.
398 398
  * @return string
399 399
  */
400
-function give_set_default_tab_form_tools_page( $default_tab ) {
400
+function give_set_default_tab_form_tools_page($default_tab) {
401 401
 	return 'system-info';
402 402
 }
403
-add_filter( 'give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1 );
404 403
\ No newline at end of file
404
+add_filter('give_default_setting_tab_give-tools', 'give_set_default_tab_form_tools_page', 10, 1);
405 405
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/admin-actions.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,54 +24,54 @@  discard block
 block discarded – undo
24 24
 function give_hide_subscription_notices() {
25 25
 
26 26
 	// Hide subscription notices permanently.
27
-	if ( ! empty( $_GET['_give_hide_license_notices_permanently'] ) ) {
27
+	if ( ! empty($_GET['_give_hide_license_notices_permanently'])) {
28 28
 		$current_user = wp_get_current_user();
29 29
 
30 30
 		// check previously disabled notice ids.
31
-		$already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) )
31
+		$already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true))
32 32
 			? $already_dismiss_notices
33 33
 			: array();
34 34
 
35 35
 		// Get notice id.
36
-		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_permanently'] );
36
+		$notice_id = sanitize_text_field($_GET['_give_hide_license_notices_permanently']);
37 37
 
38
-		if ( ! in_array( $notice_id, $already_dismiss_notices ) ) {
38
+		if ( ! in_array($notice_id, $already_dismiss_notices)) {
39 39
 			$already_dismiss_notices[] = $notice_id;
40 40
 		}
41 41
 
42 42
 		// Store subscription ids.
43
-		update_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices );
43
+		update_user_meta($current_user->ID, '_give_hide_license_notices_permanently', $already_dismiss_notices);
44 44
 
45 45
 		// Redirect user.
46
-		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI'] ) );
46
+		wp_safe_redirect(remove_query_arg('_give_hide_license_notices_permanently', $_SERVER['REQUEST_URI']));
47 47
 		exit();
48 48
 	}
49 49
 
50 50
 	// Hide subscription notices shortly.
51
-	if ( ! empty( $_GET['_give_hide_license_notices_shortly'] ) ) {
51
+	if ( ! empty($_GET['_give_hide_license_notices_shortly'])) {
52 52
 		$current_user = wp_get_current_user();
53 53
 
54 54
 		// Get notice id.
55
-		$notice_id = sanitize_text_field( $_GET['_give_hide_license_notices_shortly'] );
55
+		$notice_id = sanitize_text_field($_GET['_give_hide_license_notices_shortly']);
56 56
 
57 57
 		// Transient key name.
58 58
 		$transient_key = "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}";
59 59
 
60
-		if ( get_transient( $transient_key ) ) {
60
+		if (get_transient($transient_key)) {
61 61
 			return;
62 62
 		}
63 63
 
64 64
 
65 65
 		// Hide notice for 24 hours.
66
-		set_transient( $transient_key, true, 24 * HOUR_IN_SECONDS );
66
+		set_transient($transient_key, true, 24 * HOUR_IN_SECONDS);
67 67
 
68 68
 		// Redirect user.
69
-		wp_safe_redirect( remove_query_arg( '_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI'] ) );
69
+		wp_safe_redirect(remove_query_arg('_give_hide_license_notices_shortly', $_SERVER['REQUEST_URI']));
70 70
 		exit();
71 71
 	}
72 72
 }
73 73
 
74
-add_action( 'admin_init', 'give_hide_subscription_notices' );
74
+add_action('admin_init', 'give_hide_subscription_notices');
75 75
 
76 76
 /**
77 77
  * Load wp editor by ajax.
@@ -79,16 +79,16 @@  discard block
 block discarded – undo
79 79
  * @since 1.8
80 80
  */
81 81
 function give_load_wp_editor() {
82
-	if ( ! isset( $_POST['wp_editor'] ) ) {
82
+	if ( ! isset($_POST['wp_editor'])) {
83 83
 		die();
84 84
 	}
85 85
 
86
-	$wp_editor                     = json_decode( base64_decode( $_POST['wp_editor'] ), true );
86
+	$wp_editor                     = json_decode(base64_decode($_POST['wp_editor']), true);
87 87
 	$wp_editor[2]['textarea_name'] = $_POST['textarea_name'];
88 88
 
89
-	wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] );
89
+	wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]);
90 90
 
91 91
 	die();
92 92
 }
93 93
 
94
-add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' );
94
+add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor');
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-display.php 1 patch
Spacing   +62 added lines, -62 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_Display' ) ) :
16
+if ( ! class_exists('Give_Settings_Display')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Display.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'display';
30
-			$this->label = esc_html__( 'Display Options', 'give' );
30
+			$this->label = esc_html__('Display Options', 'give');
31 31
 
32 32
 			$this->default_tab = 'display-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'display-settings' :
49 49
 					$settings = array(
50 50
 						// Section 1: Display
@@ -53,38 +53,38 @@  discard block
 block discarded – undo
53 53
 							'type' => 'title'
54 54
 						),
55 55
 						array(
56
-							'name'    => esc_html__( 'Default Give Styles', 'give' ),
57
-							'desc'    => esc_html__( 'Give includes default styles for donation forms and other frontend elements.', 'give' ),
56
+							'name'    => esc_html__('Default Give Styles', 'give'),
57
+							'desc'    => esc_html__('Give includes default styles for donation forms and other frontend elements.', 'give'),
58 58
 							'id'      => 'css',
59 59
 							'type'    => 'radio_inline',
60 60
 							'default' => 'enabled',
61 61
 							'options' => array(
62
-								'enabled' => __( 'Enabled', 'give' ),
63
-								'disabled' => __( 'Disabled', 'give' ),
62
+								'enabled' => __('Enabled', 'give'),
63
+								'disabled' => __('Disabled', 'give'),
64 64
 							)
65 65
 						),
66 66
 						array(
67
-							'name' => esc_html__( 'Floating Labels', 'give' ),
67
+							'name' => esc_html__('Floating Labels', 'give'),
68 68
 							/* translators: %s: https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels */
69
-							'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> in set form labels within fields and can improve the donor experience. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( 'https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels' ) ),
69
+							'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> in set form labels within fields and can improve the donor experience. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url('https://givewp.com/documentation/core/give-forms/creating-give-forms/#floating-labels')),
70 70
 							'id'   => 'floatlabels',
71 71
 							'type'    => 'radio_inline',
72 72
 							'default' => 'disabled',
73 73
 							'options' => array(
74
-								'enabled' => __( 'Enabled', 'give' ),
75
-								'disabled' => __( 'Disabled', 'give' ),
74
+								'enabled' => __('Enabled', 'give'),
75
+								'disabled' => __('Disabled', 'give'),
76 76
 							)
77 77
 						),
78 78
 						array(
79
-							'name'    => esc_html__( 'Welcome Screen', 'give' ),
79
+							'name'    => esc_html__('Welcome Screen', 'give'),
80 80
 							/* translators: %s: about page URL */
81
-							'desc'    => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that display each time Give is activated or updated.', 'give' ), array( 'a' => array( 'href' => array(), 'target' => array() ) ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ),
81
+							'desc'    => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that display each time Give is activated or updated.', 'give'), array('a' => array('href' => array(), 'target' => array()))), esc_url(admin_url('index.php?page=give-about'))),
82 82
 							'id'      => 'welcome',
83 83
 							'type'    => 'radio_inline',
84 84
 							'default' => 'enabled',
85 85
 							'options' => array(
86
-								'enabled' => __( 'Enabled', 'give' ),
87
-								'disabled' => __( 'Disabled', 'give' ),
86
+								'enabled' => __('Enabled', 'give'),
87
+								'disabled' => __('Disabled', 'give'),
88 88
 							)
89 89
 						),
90 90
 						array(
@@ -101,66 +101,66 @@  discard block
 block discarded – undo
101 101
 							'type' => 'title'
102 102
 						),
103 103
 						array(
104
-							'name'    => esc_html__( 'Form Single Views', 'give' ),
105
-							'desc'    => esc_html__( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ),
104
+							'name'    => esc_html__('Form Single Views', 'give'),
105
+							'desc'    => esc_html__('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'),
106 106
 							'id'      => 'forms_singular',
107 107
 							'type'    => 'radio_inline',
108 108
 							'default' => 'enabled',
109 109
 							'options' => array(
110
-								'enabled' => __( 'Enabled', 'give' ),
111
-								'disabled' => __( 'Disabled', 'give' ),
110
+								'enabled' => __('Enabled', 'give'),
111
+								'disabled' => __('Disabled', 'give'),
112 112
 							)
113 113
 						),
114 114
 						array(
115
-							'name'    => esc_html__( 'Form Archives', 'give' ),
116
-							'desc'    => esc_html__( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ),
115
+							'name'    => esc_html__('Form Archives', 'give'),
116
+							'desc'    => esc_html__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'),
117 117
 							'id'      => 'forms_archives',
118 118
 							'type'    => 'radio_inline',
119 119
 							'default' => 'enabled',
120 120
 							'options' => array(
121
-								'enabled' => __( 'Enabled', 'give' ),
122
-								'disabled' => __( 'Disabled', 'give' ),
121
+								'enabled' => __('Enabled', 'give'),
122
+								'disabled' => __('Disabled', 'give'),
123 123
 							)
124 124
 						),
125 125
 						array(
126
-							'name'    => esc_html__( 'Form Excerpts', 'give' ),
127
-							'desc'    => esc_html__( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ),
126
+							'name'    => esc_html__('Form Excerpts', 'give'),
127
+							'desc'    => esc_html__('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'),
128 128
 							'id'      => 'forms_excerpt',
129 129
 							'type'    => 'radio_inline',
130 130
 							'default' => 'enabled',
131 131
 							'options' => array(
132
-								'enabled' => __( 'Enabled', 'give' ),
133
-								'disabled' => __( 'Disabled', 'give' ),
132
+								'enabled' => __('Enabled', 'give'),
133
+								'disabled' => __('Disabled', 'give'),
134 134
 							)
135 135
 						),
136 136
 						array(
137
-							'name'    => esc_html__( 'Form Featured Image', 'give' ),
138
-							'desc'    => esc_html__( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ),
137
+							'name'    => esc_html__('Form Featured Image', 'give'),
138
+							'desc'    => esc_html__('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'),
139 139
 							'id'      => 'form_featured_img',
140 140
 							'type'    => 'radio_inline',
141 141
 							'default' => 'enabled',
142 142
 							'options' => array(
143
-								'enabled' => __( 'Enabled', 'give' ),
144
-								'disabled' => __( 'Disabled', 'give' ),
143
+								'enabled' => __('Enabled', 'give'),
144
+								'disabled' => __('Disabled', 'give'),
145 145
 							)
146 146
 						),
147 147
 						array(
148
-							'name'    => esc_html__( 'Featured Image Size', 'give' ),
149
-							'desc'    => esc_html__( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ),
148
+							'name'    => esc_html__('Featured Image Size', 'give'),
149
+							'desc'    => esc_html__('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'),
150 150
 							'id'      => 'featured_image_size',
151 151
 							'type'    => 'select',
152 152
 							'default' => 'large',
153 153
 							'options' => give_get_featured_image_sizes()
154 154
 						),
155 155
 						array(
156
-							'name'    => esc_html__( 'Single Form Sidebar', 'give' ),
157
-							'desc'    => esc_html__( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ),
156
+							'name'    => esc_html__('Single Form Sidebar', 'give'),
157
+							'desc'    => esc_html__('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'),
158 158
 							'id'      => 'form_sidebar',
159 159
 							'type'    => 'radio_inline',
160 160
 							'default' => 'enabled',
161 161
 							'options' => array(
162
-								'enabled' => __( 'Enabled', 'give' ),
163
-								'disabled' => __( 'Disabled', 'give' ),
162
+								'enabled' => __('Enabled', 'give'),
163
+								'disabled' => __('Disabled', 'give'),
164 164
 							)
165 165
 						),
166 166
 						array(
@@ -177,25 +177,25 @@  discard block
 block discarded – undo
177 177
 							'type' => 'title'
178 178
 						),
179 179
 						array(
180
-							'name' => esc_html__( 'Form Categories', 'give' ),
181
-							'desc' => esc_html__( 'Enable the "Category" taxonomy for all Give forms.', 'give' ),
180
+							'name' => esc_html__('Form Categories', 'give'),
181
+							'desc' => esc_html__('Enable the "Category" taxonomy for all Give forms.', 'give'),
182 182
 							'id'   => 'categories',
183 183
 							'type'    => 'radio_inline',
184 184
 							'default' => 'disabled',
185 185
 							'options' => array(
186
-								'enabled' => __( 'Enabled', 'give' ),
187
-								'disabled' => __( 'Disabled', 'give' ),
186
+								'enabled' => __('Enabled', 'give'),
187
+								'disabled' => __('Disabled', 'give'),
188 188
 							)
189 189
 						),
190 190
 						array(
191
-							'name' => esc_html__( 'Form Tags', 'give' ),
192
-							'desc' => esc_html__( 'Enable the "Tag" taxonomy for all Give forms.', 'give' ),
191
+							'name' => esc_html__('Form Tags', 'give'),
192
+							'desc' => esc_html__('Enable the "Tag" taxonomy for all Give forms.', 'give'),
193 193
 							'id'   => 'tags',
194 194
 							'type'    => 'radio_inline',
195 195
 							'default' => 'disabled',
196 196
 							'options' => array(
197
-								'enabled' => __( 'Enabled', 'give' ),
198
-								'disabled' => __( 'Disabled', 'give' ),
197
+								'enabled' => __('Enabled', 'give'),
198
+								'disabled' => __('Disabled', 'give'),
199 199
 							)
200 200
 						),
201 201
 						array(
@@ -212,28 +212,28 @@  discard block
 block discarded – undo
212 212
 							'type' => 'title'
213 213
 						),
214 214
 						array(
215
-							'name'    => esc_html__( 'Terms and Conditions', 'give' ),
216
-							'desc'    => esc_html__( 'Would you like donors to have to agree to your terms when making a donation? Note: You can toggle this option and customize the terms per form.', 'give' ),
215
+							'name'    => esc_html__('Terms and Conditions', 'give'),
216
+							'desc'    => esc_html__('Would you like donors to have to agree to your terms when making a donation? Note: You can toggle this option and customize the terms per form.', 'give'),
217 217
 							'id'      => 'terms',
218 218
 							'type'    => 'radio_inline',
219 219
 							'default' => 'disabled',
220 220
 							'options' => array(
221
-								'enabled' => __( 'Enabled', 'give' ),
222
-								'disabled' => __( 'Disabled', 'give' ),
221
+								'enabled' => __('Enabled', 'give'),
222
+								'disabled' => __('Disabled', 'give'),
223 223
 							)
224 224
 						),
225 225
 						array(
226
-							'name' => esc_html__( 'Agree to Terms Label', 'give' ),
227
-							'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. Note: You can customize the label per form as needed.', 'give' ),
226
+							'name' => esc_html__('Agree to Terms Label', 'give'),
227
+							'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. Note: You can customize the label per form as needed.', 'give'),
228 228
 							'id'   => 'agree_to_terms_label',
229 229
 							'attributes'  => array(
230
-								'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ),
230
+								'placeholder' => esc_attr__('Agree to Terms?', 'give'),
231 231
 							),
232 232
 							'type' => 'text'
233 233
 						),
234 234
 						array(
235
-							'name' => esc_html__( 'Agreement Text', 'give' ),
236
-							'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation. Note: You can customize the content per form as needed.', 'give' ),
235
+							'name' => esc_html__('Agreement Text', 'give'),
236
+							'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation. Note: You can customize the content per form as needed.', 'give'),
237 237
 							'id'   => 'agreement_text',
238 238
 							'type' => 'wysiwyg'
239 239
 						),
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			 * Filter the display options settings.
250 250
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
251 251
 			 */
252
-			$settings = apply_filters( 'give_settings_display', $settings );
252
+			$settings = apply_filters('give_settings_display', $settings);
253 253
 
254 254
 			/**
255 255
 			 * Filter the settings.
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 			 * @since  1.8
258 258
 			 * @param  array $settings
259 259
 			 */
260
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
260
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
261 261
 
262 262
 			// Output.
263 263
 			return $settings;
@@ -271,13 +271,13 @@  discard block
 block discarded – undo
271 271
 		 */
272 272
 		public function get_sections() {
273 273
 			$sections = array(
274
-				'display-settings'    => esc_html__( 'Display', 'give' ),
275
-				'post-types'          => esc_html__( 'Post Types', 'give' ),
276
-				'taxonomies'          => esc_html__( 'Taxonomies', 'give' ),
277
-				'term-and-conditions' => esc_html__( 'Term and Conditions', 'give' )
274
+				'display-settings'    => esc_html__('Display', 'give'),
275
+				'post-types'          => esc_html__('Post Types', 'give'),
276
+				'taxonomies'          => esc_html__('Taxonomies', 'give'),
277
+				'term-and-conditions' => esc_html__('Term and Conditions', 'give')
278 278
 			);
279 279
 
280
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
280
+			return apply_filters('give_get_sections_'.$this->id, $sections);
281 281
 		}
282 282
 	}
283 283
 
Please login to merge, or discard this patch.
includes/scripts.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,105 +25,105 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_load_scripts() {
27 27
 
28
-	$js_dir         = GIVE_PLUGIN_URL . 'assets/js/frontend/';
29
-	$js_plugins     = GIVE_PLUGIN_URL . 'assets/js/plugins/';
30
-	$scripts_footer = ( give_get_option( 'scripts_footer' ) == 'on' ) ? true : false;
28
+	$js_dir         = GIVE_PLUGIN_URL.'assets/js/frontend/';
29
+	$js_plugins     = GIVE_PLUGIN_URL.'assets/js/plugins/';
30
+	$scripts_footer = (give_get_option('scripts_footer') == 'on') ? true : false;
31 31
 
32 32
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
33
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
33
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
34 34
 
35 35
 	// Localize / PHP to AJAX vars.
36
-	$localize_give_checkout = apply_filters( 'give_global_script_vars', array(
36
+	$localize_give_checkout = apply_filters('give_global_script_vars', array(
37 37
 		'ajaxurl'             => give_get_ajax_url(),
38
-		'checkout_nonce'      => wp_create_nonce( 'give_checkout_nonce' ),
39
-		'currency_sign'       => give_currency_filter( '' ),
38
+		'checkout_nonce'      => wp_create_nonce('give_checkout_nonce'),
39
+		'currency_sign'       => give_currency_filter(''),
40 40
 		'currency_pos'        => give_get_currency_position(),
41 41
 		'thousands_separator' => give_get_price_thousand_separator(),
42 42
 		'decimal_separator'   => give_get_price_decimal_separator(),
43
-		'no_gateway'          => esc_html__( 'Please select a payment method.', 'give' ),
44
-		'bad_minimum'         => esc_html__( 'The minimum donation amount for this form is', 'give' ),
45
-		'general_loading'     => esc_html__( 'Loading...', 'give' ),
46
-		'purchase_loading'    => esc_html__( 'Please Wait...', 'give' ),
43
+		'no_gateway'          => esc_html__('Please select a payment method.', 'give'),
44
+		'bad_minimum'         => esc_html__('The minimum donation amount for this form is', 'give'),
45
+		'general_loading'     => esc_html__('Loading...', 'give'),
46
+		'purchase_loading'    => esc_html__('Please Wait...', 'give'),
47 47
 		'number_decimals'     => give_get_price_decimals(),
48 48
 		'give_version'        => GIVE_VERSION,
49 49
 		'form_translation'    => apply_filters(
50 50
 			'give_form_translation_js',
51 51
 			array(
52 52
 				// Field name               Validation message.
53
-				'payment-mode'           => esc_html__( 'Please select payment mode.', 'give' ),
54
-				'give_first'             => esc_html__( 'Please enter your first name.', 'give' ),
55
-				'give_email'             => esc_html__( 'Please enter a valid email address.', 'give' ),
56
-				'give_user_login'        => esc_html__( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ),
57
-				'give_user_pass'         => esc_html__( 'Enter a password.', 'give' ),
58
-				'give_user_pass_confirm' => esc_html__( 'Enter a confirm password.', 'give' ),
59
-				'give_agree_to_terms'    => esc_html__( 'You must agree to the terms and conditions.', 'give' ),
53
+				'payment-mode'           => esc_html__('Please select payment mode.', 'give'),
54
+				'give_first'             => esc_html__('Please enter your first name.', 'give'),
55
+				'give_email'             => esc_html__('Please enter a valid email address.', 'give'),
56
+				'give_user_login'        => esc_html__('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give'),
57
+				'give_user_pass'         => esc_html__('Enter a password.', 'give'),
58
+				'give_user_pass_confirm' => esc_html__('Enter a confirm password.', 'give'),
59
+				'give_agree_to_terms'    => esc_html__('You must agree to the terms and conditions.', 'give'),
60 60
 			)
61 61
 		),
62
-	) );
63
-	$localize_give_ajax     = apply_filters( 'give_global_ajax_vars', array(
62
+	));
63
+	$localize_give_ajax = apply_filters('give_global_ajax_vars', array(
64 64
 		'ajaxurl'         => give_get_ajax_url(),
65
-		'loading'         => esc_html__( 'Loading', 'give' ),
65
+		'loading'         => esc_html__('Loading', 'give'),
66 66
 		// General loading message.
67
-		'select_option'   => esc_html__( 'Please select an option', 'give' ),
67
+		'select_option'   => esc_html__('Please select an option', 'give'),
68 68
 		// Variable pricing error with multi-donation option enabled.
69
-		'default_gateway' => give_get_default_gateway( null ),
70
-		'permalinks'      => get_option( 'permalink_structure' ) ? '1' : '0',
69
+		'default_gateway' => give_get_default_gateway(null),
70
+		'permalinks'      => get_option('permalink_structure') ? '1' : '0',
71 71
 		'number_decimals' => give_get_price_decimals(),
72
-	) );
72
+	));
73 73
 
74 74
 	// DEBUG is On.
75
-	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
75
+	if (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) {
76 76
 
77
-		if ( give_is_cc_verify_enabled() ) {
78
-			wp_register_script( 'give-cc-validator', $js_plugins . 'jquery.payment' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
79
-			wp_enqueue_script( 'give-cc-validator' );
77
+		if (give_is_cc_verify_enabled()) {
78
+			wp_register_script('give-cc-validator', $js_plugins.'jquery.payment'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
79
+			wp_enqueue_script('give-cc-validator');
80 80
 		}
81 81
 
82
-		wp_register_script( 'give-float-labels', $js_plugins . 'float-labels' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
83
-		wp_enqueue_script( 'give-float-labels' );
82
+		wp_register_script('give-float-labels', $js_plugins.'float-labels'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
83
+		wp_enqueue_script('give-float-labels');
84 84
 
85
-		wp_register_script( 'give-blockui', $js_plugins . 'jquery.blockUI' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
86
-		wp_enqueue_script( 'give-blockui' );
85
+		wp_register_script('give-blockui', $js_plugins.'jquery.blockUI'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
86
+		wp_enqueue_script('give-blockui');
87 87
 
88
-		wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
89
-		wp_enqueue_script( 'give-qtip' );
88
+		wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
89
+		wp_enqueue_script('give-qtip');
90 90
 
91
-		wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
92
-		wp_enqueue_script( 'give-accounting' );
91
+		wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
92
+		wp_enqueue_script('give-accounting');
93 93
 
94
-		wp_register_script( 'give-magnific', $js_plugins . 'jquery.magnific-popup' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
95
-		wp_enqueue_script( 'give-magnific' );
94
+		wp_register_script('give-magnific', $js_plugins.'jquery.magnific-popup'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
95
+		wp_enqueue_script('give-magnific');
96 96
 
97
-		wp_register_script( 'give-checkout-global', $js_dir . 'give-checkout-global' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
98
-		wp_enqueue_script( 'give-checkout-global' );
97
+		wp_register_script('give-checkout-global', $js_dir.'give-checkout-global'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
98
+		wp_enqueue_script('give-checkout-global');
99 99
 
100 100
 		// General scripts.
101
-		wp_register_script( 'give-scripts', $js_dir . 'give' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
102
-		wp_enqueue_script( 'give-scripts' );
101
+		wp_register_script('give-scripts', $js_dir.'give'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
102
+		wp_enqueue_script('give-scripts');
103 103
 
104 104
 		// Load AJAX scripts, if enabled.
105
-		wp_register_script( 'give-ajax', $js_dir . 'give-ajax' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
106
-		wp_enqueue_script( 'give-ajax' );
105
+		wp_register_script('give-ajax', $js_dir.'give-ajax'.$suffix.'.js', array('jquery'), GIVE_VERSION, $scripts_footer);
106
+		wp_enqueue_script('give-ajax');
107 107
 
108 108
 		// Localize / Pass AJAX vars from PHP,
109
-		wp_localize_script( 'give-checkout-global', 'give_global_vars', $localize_give_checkout );
110
-		wp_localize_script( 'give-ajax', 'give_scripts', $localize_give_ajax );
109
+		wp_localize_script('give-checkout-global', 'give_global_vars', $localize_give_checkout);
110
+		wp_localize_script('give-ajax', 'give_scripts', $localize_give_ajax);
111 111
 
112 112
 	} else {
113 113
 
114 114
 		// DEBUG is OFF (one JS file to rule them all!).
115
-		wp_register_script( 'give', $js_dir . 'give.all.min.js', array( 'jquery' ), GIVE_VERSION, $scripts_footer );
116
-		wp_enqueue_script( 'give' );
115
+		wp_register_script('give', $js_dir.'give.all.min.js', array('jquery'), GIVE_VERSION, $scripts_footer);
116
+		wp_enqueue_script('give');
117 117
 
118 118
 		// Localize / Pass AJAX vars from PHP.
119
-		wp_localize_script( 'give', 'give_global_vars', $localize_give_checkout );
120
-		wp_localize_script( 'give', 'give_scripts', $localize_give_ajax );
119
+		wp_localize_script('give', 'give_global_vars', $localize_give_checkout);
120
+		wp_localize_script('give', 'give_scripts', $localize_give_ajax);
121 121
 
122 122
 	}
123 123
 
124 124
 }
125 125
 
126
-add_action( 'wp_enqueue_scripts', 'give_load_scripts' );
126
+add_action('wp_enqueue_scripts', 'give_load_scripts');
127 127
 
128 128
 /**
129 129
  * Register styles.
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
  */
137 137
 function give_register_styles() {
138 138
 
139
-	if ( ! give_is_setting_enabled( give_get_option( 'css' ) ) ) {
139
+	if ( ! give_is_setting_enabled(give_get_option('css'))) {
140 140
 		return;
141 141
 	}
142 142
 
143
-	wp_register_style( 'give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all' );
144
-	wp_enqueue_style( 'give-styles' );
143
+	wp_register_style('give-styles', give_get_stylesheet_uri(), array(), GIVE_VERSION, 'all');
144
+	wp_enqueue_style('give-styles');
145 145
 
146 146
 }
147 147
 
148
-add_action( 'wp_enqueue_scripts', 'give_register_styles' );
148
+add_action('wp_enqueue_scripts', 'give_register_styles');
149 149
 
150 150
 
151 151
 /**
@@ -158,42 +158,42 @@  discard block
 block discarded – undo
158 158
 function give_get_stylesheet_uri() {
159 159
 
160 160
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
161
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
161
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
162 162
 
163 163
 	// LTR or RTL files.
164
-	$direction = ( is_rtl() ) ? '-rtl' : '';
164
+	$direction = (is_rtl()) ? '-rtl' : '';
165 165
 
166
-	$file          = 'give' . $direction . $suffix . '.css';
166
+	$file          = 'give'.$direction.$suffix.'.css';
167 167
 	$templates_dir = give_get_theme_template_dir_name();
168 168
 
169
-	$child_theme_style_sheet    = trailingslashit( get_stylesheet_directory() ) . $templates_dir . $file;
170
-	$child_theme_style_sheet_2  = trailingslashit( get_stylesheet_directory() ) . $templates_dir . 'give' . $direction . '.css';
171
-	$parent_theme_style_sheet   = trailingslashit( get_template_directory() ) . $templates_dir . $file;
172
-	$parent_theme_style_sheet_2 = trailingslashit( get_template_directory() ) . $templates_dir . 'give' . $direction . '.css';
173
-	$give_plugin_style_sheet    = trailingslashit( give_get_templates_dir() ) . $file;
169
+	$child_theme_style_sheet    = trailingslashit(get_stylesheet_directory()).$templates_dir.$file;
170
+	$child_theme_style_sheet_2  = trailingslashit(get_stylesheet_directory()).$templates_dir.'give'.$direction.'.css';
171
+	$parent_theme_style_sheet   = trailingslashit(get_template_directory()).$templates_dir.$file;
172
+	$parent_theme_style_sheet_2 = trailingslashit(get_template_directory()).$templates_dir.'give'.$direction.'.css';
173
+	$give_plugin_style_sheet    = trailingslashit(give_get_templates_dir()).$file;
174 174
 
175 175
 	$uri = false;
176 176
 
177 177
 	// Look in the child theme directory first, followed by the parent theme,
178 178
 	// followed by the Give core templates directory also look for the min version first, followed by non minified version, even if SCRIPT_DEBUG is not enabled.
179 179
 	// This allows users to copy just give.css to their theme.
180
-	if ( file_exists( $child_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $child_theme_style_sheet_2 ) ) ) ) {
181
-		if ( ! empty( $nonmin ) ) {
182
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
180
+	if (file_exists($child_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($child_theme_style_sheet_2)))) {
181
+		if ( ! empty($nonmin)) {
182
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.'give'.$direction.'.css';
183 183
 		} else {
184
-			$uri = trailingslashit( get_stylesheet_directory_uri() ) . $templates_dir . $file;
184
+			$uri = trailingslashit(get_stylesheet_directory_uri()).$templates_dir.$file;
185 185
 		}
186
-	} elseif ( file_exists( $parent_theme_style_sheet ) || ( ! empty( $suffix ) && ( $nonmin = file_exists( $parent_theme_style_sheet_2 ) ) ) ) {
187
-		if ( ! empty( $nonmin ) ) {
188
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . 'give' . $direction . '.css';
186
+	} elseif (file_exists($parent_theme_style_sheet) || ( ! empty($suffix) && ($nonmin = file_exists($parent_theme_style_sheet_2)))) {
187
+		if ( ! empty($nonmin)) {
188
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.'give'.$direction.'.css';
189 189
 		} else {
190
-			$uri = trailingslashit( get_template_directory_uri() ) . $templates_dir . $file;
190
+			$uri = trailingslashit(get_template_directory_uri()).$templates_dir.$file;
191 191
 		}
192
-	} elseif ( file_exists( $give_plugin_style_sheet ) || file_exists( $give_plugin_style_sheet ) ) {
193
-		$uri = trailingslashit( give_get_templates_url() ) . $file;
192
+	} elseif (file_exists($give_plugin_style_sheet) || file_exists($give_plugin_style_sheet)) {
193
+		$uri = trailingslashit(give_get_templates_url()).$file;
194 194
 	}
195 195
 
196
-	return apply_filters( 'give_get_stylesheet_uri', $uri );
196
+	return apply_filters('give_get_stylesheet_uri', $uri);
197 197
 
198 198
 }
199 199
 
@@ -210,73 +210,73 @@  discard block
 block discarded – undo
210 210
  *
211 211
  * @return void
212 212
  */
213
-function give_load_admin_scripts( $hook ) {
213
+function give_load_admin_scripts($hook) {
214 214
 
215 215
 	global $post, $post_type;
216 216
 
217 217
 	$give_options = give_get_settings();
218 218
 
219 219
 	// Directories of assets.
220
-	$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
221
-	$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
222
-	$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
220
+	$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
221
+	$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
222
+	$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
223 223
 
224 224
 	// Use minified libraries if SCRIPT_DEBUG is turned off.
225
-	$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
225
+	$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
226 226
 
227 227
 	// LTR or RTL files.
228
-	$direction = ( is_rtl() ) ? '-rtl' : '';
228
+	$direction = (is_rtl()) ? '-rtl' : '';
229 229
 
230 230
 	// Global Admin.
231
-	wp_register_style( 'give-admin-bar-notification', $css_dir . 'adminbar-style.css' );
232
-	wp_enqueue_style( 'give-admin-bar-notification' );
231
+	wp_register_style('give-admin-bar-notification', $css_dir.'adminbar-style.css');
232
+	wp_enqueue_style('give-admin-bar-notification');
233 233
 
234 234
 	// Give Admin Only.
235
-	if ( ! apply_filters( 'give_load_admin_scripts', give_is_admin_page(), $hook ) ) {
235
+	if ( ! apply_filters('give_load_admin_scripts', give_is_admin_page(), $hook)) {
236 236
 		return;
237 237
 	}
238 238
 
239 239
 	// CSS.
240
-	wp_register_style( 'jquery-ui-css', $css_dir . 'jquery-ui-fresh' . $suffix . '.css' );
241
-	wp_enqueue_style( 'jquery-ui-css' );
242
-	wp_register_style( 'give-admin', $css_dir . 'give-admin' . $direction . $suffix . '.css', GIVE_VERSION );
243
-	wp_enqueue_style( 'give-admin' );
244
-	wp_register_style( 'jquery-chosen', $css_dir . 'chosen' . $suffix . '.css', array(), GIVE_VERSION );
245
-	wp_enqueue_style( 'jquery-chosen' );
246
-	wp_enqueue_style( 'thickbox' );
240
+	wp_register_style('jquery-ui-css', $css_dir.'jquery-ui-fresh'.$suffix.'.css');
241
+	wp_enqueue_style('jquery-ui-css');
242
+	wp_register_style('give-admin', $css_dir.'give-admin'.$direction.$suffix.'.css', GIVE_VERSION);
243
+	wp_enqueue_style('give-admin');
244
+	wp_register_style('jquery-chosen', $css_dir.'chosen'.$suffix.'.css', array(), GIVE_VERSION);
245
+	wp_enqueue_style('jquery-chosen');
246
+	wp_enqueue_style('thickbox');
247 247
 
248 248
 	// JS.
249
-	wp_register_script( 'jquery-chosen', $js_plugins . 'chosen.jquery' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
250
-	wp_enqueue_script( 'jquery-chosen' );
249
+	wp_register_script('jquery-chosen', $js_plugins.'chosen.jquery'.$suffix.'.js', array('jquery'), GIVE_VERSION);
250
+	wp_enqueue_script('jquery-chosen');
251 251
 
252
-	wp_register_script( 'give-accounting', $js_plugins . 'accounting' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
253
-	wp_enqueue_script( 'give-accounting' );
252
+	wp_register_script('give-accounting', $js_plugins.'accounting'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
253
+	wp_enqueue_script('give-accounting');
254 254
 
255
-	wp_register_script( 'give-admin-scripts', $js_dir . 'admin-scripts' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
256
-	wp_enqueue_script( 'give-admin-scripts' );
255
+	wp_register_script('give-admin-scripts', $js_dir.'admin-scripts'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
256
+	wp_enqueue_script('give-admin-scripts');
257 257
 
258
-	wp_register_script( 'jquery-flot', $js_plugins . 'jquery.flot' . $suffix . '.js' );
259
-	wp_enqueue_script( 'jquery-flot' );
258
+	wp_register_script('jquery-flot', $js_plugins.'jquery.flot'.$suffix.'.js');
259
+	wp_enqueue_script('jquery-flot');
260 260
 
261
-	wp_register_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
262
-	wp_enqueue_script( 'give-qtip' );
261
+	wp_register_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
262
+	wp_enqueue_script('give-qtip');
263 263
 
264
-	wp_register_script( 'give-repeatable-fields', $js_plugins . 'repeatable-fields' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
265
-	wp_enqueue_script( 'give-repeatable-fields' );
264
+	wp_register_script('give-repeatable-fields', $js_plugins.'repeatable-fields'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
265
+	wp_enqueue_script('give-repeatable-fields');
266 266
 
267
-	wp_enqueue_script( 'jquery-ui-datepicker' );
268
-	wp_enqueue_script( 'thickbox' );
267
+	wp_enqueue_script('jquery-ui-datepicker');
268
+	wp_enqueue_script('thickbox');
269 269
 
270 270
 	// Forms CPT Script.
271
-	if ( $post_type === 'give_forms' ) {
272
-		wp_register_script( 'give-admin-forms-scripts', $js_dir . 'admin-forms' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
273
-		wp_enqueue_script( 'give-admin-forms-scripts' );
271
+	if ($post_type === 'give_forms') {
272
+		wp_register_script('give-admin-forms-scripts', $js_dir.'admin-forms'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
273
+		wp_enqueue_script('give-admin-forms-scripts');
274 274
 	}
275 275
 
276 276
 	// Settings Scripts.
277
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-settings' ) {
278
-		wp_register_script( 'give-admin-settings-scripts', $js_dir . 'admin-settings' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
279
-		wp_enqueue_script( 'give-admin-settings-scripts' );
277
+	if (isset($_GET['page']) && $_GET['page'] == 'give-settings') {
278
+		wp_register_script('give-admin-settings-scripts', $js_dir.'admin-settings'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
279
+		wp_enqueue_script('give-admin-settings-scripts');
280 280
 	}
281 281
 
282 282
 	// Price Separators.
@@ -284,42 +284,42 @@  discard block
 block discarded – undo
284 284
 	$decimal_separator  = give_get_price_decimal_separator();
285 285
 
286 286
 	// Localize strings & variables for JS.
287
-	wp_localize_script( 'give-admin-scripts', 'give_vars', array(
288
-		'post_id'                        => isset( $post->ID ) ? $post->ID : null,
287
+	wp_localize_script('give-admin-scripts', 'give_vars', array(
288
+		'post_id'                        => isset($post->ID) ? $post->ID : null,
289 289
 		'give_version'                   => GIVE_VERSION,
290 290
 		'thousands_separator'            => $thousand_separator,
291 291
 		'decimal_separator'              => $decimal_separator,
292
-		'quick_edit_warning'             => esc_html__( 'Not available for variable priced forms.', 'give' ),
293
-		'delete_payment'                 => esc_html__( 'Are you sure you wish to delete this payment?', 'give' ),
294
-		'delete_payment_note'            => esc_html__( 'Are you sure you wish to delete this note?', 'give' ),
295
-		'revoke_api_key'                 => esc_html__( 'Are you sure you wish to revoke this API key?', 'give' ),
296
-		'regenerate_api_key'             => esc_html__( 'Are you sure you wish to regenerate this API key?', 'give' ),
297
-		'resend_receipt'                 => esc_html__( 'Are you sure you wish to resend the donation receipt?', 'give' ),
298
-		'logo'                           => esc_html__( 'Logo', 'give' ),
299
-		'use_this_image'                 => esc_html__( 'Use this image', 'give' ),
300
-		'one_option'                     => esc_html__( 'Choose a form', 'give' ),
301
-		'one_or_more_option'             => esc_html__( 'Choose one or more forms', 'give' ),
302
-		'currency_sign'                  => give_currency_filter( '' ),
303
-		'currency_pos'                   => isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before',
304
-		'currency_decimals'              => give_currency_decimal_filter( give_get_price_decimals() ),
305
-		'batch_export_no_class'          => esc_html__( 'You must choose a method.', 'give' ),
306
-		'batch_export_no_reqs'           => esc_html__( 'Required fields not completed.', 'give' ),
307
-		'reset_stats_warn'               => __( 'Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give' ),
308
-		'price_format_guide'             => sprintf( esc_html__( 'Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give' ), $decimal_separator, $thousand_separator ),
292
+		'quick_edit_warning'             => esc_html__('Not available for variable priced forms.', 'give'),
293
+		'delete_payment'                 => esc_html__('Are you sure you wish to delete this payment?', 'give'),
294
+		'delete_payment_note'            => esc_html__('Are you sure you wish to delete this note?', 'give'),
295
+		'revoke_api_key'                 => esc_html__('Are you sure you wish to revoke this API key?', 'give'),
296
+		'regenerate_api_key'             => esc_html__('Are you sure you wish to regenerate this API key?', 'give'),
297
+		'resend_receipt'                 => esc_html__('Are you sure you wish to resend the donation receipt?', 'give'),
298
+		'logo'                           => esc_html__('Logo', 'give'),
299
+		'use_this_image'                 => esc_html__('Use this image', 'give'),
300
+		'one_option'                     => esc_html__('Choose a form', 'give'),
301
+		'one_or_more_option'             => esc_html__('Choose one or more forms', 'give'),
302
+		'currency_sign'                  => give_currency_filter(''),
303
+		'currency_pos'                   => isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before',
304
+		'currency_decimals'              => give_currency_decimal_filter(give_get_price_decimals()),
305
+		'batch_export_no_class'          => esc_html__('You must choose a method.', 'give'),
306
+		'batch_export_no_reqs'           => esc_html__('Required fields not completed.', 'give'),
307
+		'reset_stats_warn'               => __('Are you sure you want to reset Give? This process is <strong><em>not reversible</em></strong> and will delete all data regardless of test or live mode. Please be sure you have a recent backup before proceeding.', 'give'),
308
+		'price_format_guide'             => sprintf(esc_html__('Please enter amount in monetary decimal ( %1$s ) format without thousand separator ( %2$s ) .', 'give'), $decimal_separator, $thousand_separator),
309 309
 		/* translators : %s: Donation form options metabox */
310
-		'confirm_before_remove_row_text' => __( 'Do you want to delete this level?', 'give' ),
311
-		'matched_success_failure_page'   => __( 'You cannot set the success and failed pages to the same page', 'give' ),
312
-		'dismiss_notice_text'            => __( 'Dismiss this notice.', 'give' ),
313
-	) );
310
+		'confirm_before_remove_row_text' => __('Do you want to delete this level?', 'give'),
311
+		'matched_success_failure_page'   => __('You cannot set the success and failed pages to the same page', 'give'),
312
+		'dismiss_notice_text'            => __('Dismiss this notice.', 'give'),
313
+	));
314 314
 
315
-	if ( function_exists( 'wp_enqueue_media' ) && version_compare( get_bloginfo( 'version' ), '3.5', '>=' ) ) {
315
+	if (function_exists('wp_enqueue_media') && version_compare(get_bloginfo('version'), '3.5', '>=')) {
316 316
 		// call for new media manager.
317 317
 		wp_enqueue_media();
318 318
 	}
319 319
 
320 320
 }
321 321
 
322
-add_action( 'admin_enqueue_scripts', 'give_load_admin_scripts', 100 );
322
+add_action('admin_enqueue_scripts', 'give_load_admin_scripts', 100);
323 323
 
324 324
 /**
325 325
  * Admin Give Icon
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 	?>
335 335
 	<style type="text/css" media="screen">
336 336
 
337
-		<?php if ( version_compare( get_bloginfo( 'version' ), '3.8-RC', '>=' ) || version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { ?>
337
+		<?php if (version_compare(get_bloginfo('version'), '3.8-RC', '>=') || version_compare(get_bloginfo('version'), '3.8', '>=')) { ?>
338 338
 		@font-face {
339 339
 			font-family: 'give-icomoon';
340
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?-ngjl88'; ?>');
341
-			src: url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
342
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
343
-			url('<?php echo GIVE_PLUGIN_URL . '/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
340
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?-ngjl88'; ?>');
341
+			src: url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.eot?#iefix-ngjl88'?>') format('embedded-opentype'),
342
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.woff?-ngjl88'; ?>') format('woff'),
343
+			url('<?php echo GIVE_PLUGIN_URL.'/assets/fonts/icomoon.svg?-ngjl88#icomoon'; ?>') format('svg');
344 344
 			font-weight: normal;
345 345
 			font-style: normal;
346 346
 		}
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	<?php
360 360
 }
361 361
 
362
-add_action( 'admin_head', 'give_admin_icon' );
362
+add_action('admin_head', 'give_admin_icon');
363 363
 
364 364
 /**
365 365
  * Admin js code
@@ -389,4 +389,4 @@  discard block
 block discarded – undo
389 389
 	<?php
390 390
 }
391 391
 
392
-add_action( 'admin_head', 'give_admin_hide_notice_shortly_js' );
392
+add_action('admin_head', 'give_admin_hide_notice_shortly_js');
Please login to merge, or discard this patch.