Test Failed
Pull Request — master (#3170)
by Devin
06:00
created
includes/admin/shortcodes/shortcode-give-donation-grid.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly.
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 
26
-		$this->shortcode['title'] = esc_html__( 'Donation Form Grid', 'give' );
27
-		$this->shortcode['label'] = esc_html__( 'Donation Form Grid', 'give' );
26
+		$this->shortcode['title'] = esc_html__('Donation Form Grid', 'give');
27
+		$this->shortcode['label'] = esc_html__('Donation Form Grid', 'give');
28 28
 
29
-		parent::__construct( 'give_form_grid' );
29
+		parent::__construct('give_form_grid');
30 30
 	}
31 31
 
32 32
 	/**
@@ -39,73 +39,73 @@  discard block
 block discarded – undo
39 39
 		return array(
40 40
 			array(
41 41
 				'type' => 'container',
42
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
42
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
43 43
 			),
44 44
 			array(
45 45
 				'type'        => 'textbox',
46 46
 				'name'        => 'ids',
47
-				'label'       => esc_attr__( 'Form IDs:', 'give' ),
48
-				'tooltip'     => esc_attr__( 'Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give' ),
49
-				'placeholder' => esc_html__( 'All Forms', 'give' )
47
+				'label'       => esc_attr__('Form IDs:', 'give'),
48
+				'tooltip'     => esc_attr__('Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give'),
49
+				'placeholder' => esc_html__('All Forms', 'give')
50 50
 			),
51 51
 			array(
52 52
 				'type'        => 'listbox',
53 53
 				'name'        => 'columns',
54
-				'label'       => esc_attr__( 'Columns:', 'give' ),
55
-				'tooltip'     => esc_attr__( 'Sets the number of donations per row.', 'give' ),
54
+				'label'       => esc_attr__('Columns:', 'give'),
55
+				'tooltip'     => esc_attr__('Sets the number of donations per row.', 'give'),
56 56
 				'options'     => array(
57
-					'1' => esc_html__( '1', 'give' ),
58
-					'2' => esc_html__( '2', 'give' ),
59
-					'3' => esc_html__( '3', 'give' ),
60
-					'4' => esc_html__( '4', 'give' ),
57
+					'1' => esc_html__('1', 'give'),
58
+					'2' => esc_html__('2', 'give'),
59
+					'3' => esc_html__('3', 'give'),
60
+					'4' => esc_html__('4', 'give'),
61 61
 				),
62
-				'placeholder' => esc_html__( 'Best Fit', 'give' )
62
+				'placeholder' => esc_html__('Best Fit', 'give')
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_goal',
67
-				'label'   => esc_attr__( 'Show Goal:', 'give' ),
68
-				'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ),
67
+				'label'   => esc_attr__('Show Goal:', 'give'),
68
+				'tooltip' => __('Do you want to display the goal\'s progress bar?', '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_excerpt',
77
-				'label'   => esc_attr__( 'Show Excerpt:', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ),
77
+				'label'   => esc_attr__('Show Excerpt:', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the excerpt?', '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_featured_image',
87
-				'label'   => esc_attr__( 'Show Featured Image:', 'give' ),
88
-				'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ),
87
+				'label'   => esc_attr__('Show Featured Image:', 'give'),
88
+				'tooltip' => esc_attr__('Do you want to display the featured image?', 'give'),
89 89
 				'options' => array(
90
-					'true'  => esc_html__( 'Show', 'give' ),
91
-					'false' => esc_html__( 'Hide', 'give' ),
90
+					'true'  => esc_html__('Show', 'give'),
91
+					'false' => esc_html__('Hide', 'give'),
92 92
 				),
93 93
 			),
94 94
 			array(
95 95
 				'type'    => 'listbox',
96 96
 				'name'    => 'display_style',
97
-				'label'   => esc_attr__( 'Display Style:', 'give' ),
98
-				'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ),
97
+				'label'   => esc_attr__('Display Style:', 'give'),
98
+				'tooltip' => esc_attr__('Show form as modal window or redirect to a new page?', 'give'),
99 99
 				'options' => array(
100
-					'redirect'     => esc_html__( 'Redirect', 'give' ),
101
-					'modal_reveal' => esc_html__( 'Modal', 'give' ),
100
+					'redirect'     => esc_html__('Redirect', 'give'),
101
+					'modal_reveal' => esc_html__('Modal', 'give'),
102 102
 				),
103 103
 			),
104 104
 			array(
105 105
 				'type'    => 'textbox',
106 106
 				'name'    => 'forms_per_page',
107
-				'label'   => esc_attr__( 'Forms Per Page:', 'give' ),
108
-				'tooltip' => esc_attr__( 'Sets the number of donations form per row.', 'give' ),
107
+				'label'   => esc_attr__('Forms Per Page:', 'give'),
108
+				'tooltip' => esc_attr__('Sets the number of donations form per row.', 'give'),
109 109
 				'value'   => 12,
110 110
 			),
111 111
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/abstract-shortcode-generator.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 
13 13
 // Exit if accessed directly.
14
-if ( ! defined( 'ABSPATH' ) ) {
14
+if ( ! defined('ABSPATH')) {
15 15
 	exit;
16 16
 }
17 17
 
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @since 1.0
64 64
 	 */
65
-	public function __construct( $shortcode ) {
65
+	public function __construct($shortcode) {
66 66
 
67 67
 		$this->shortcode_tag = $shortcode;
68 68
 
69
-		add_action( 'admin_init', array( $this, 'init' ) );
69
+		add_action('admin_init', array($this, 'init'));
70 70
 
71 71
 	}
72 72
 
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	public function init() {
79 79
 
80
-		if ( $this->shortcode_tag ) {
80
+		if ($this->shortcode_tag) {
81 81
 
82
-			$this->self = get_class( $this );
82
+			$this->self = get_class($this);
83 83
 
84 84
 			$this->errors   = array();
85 85
 			$this->required = array();
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 			$fields = $this->get_fields();
89 89
 
90 90
 			$defaults = array(
91
-				'btn_close' => esc_html__( 'Close', 'give' ),
92
-				'btn_okay'  => esc_html__( 'Insert Shortcode', 'give' ),
91
+				'btn_close' => esc_html__('Close', 'give'),
92
+				'btn_okay'  => esc_html__('Insert Shortcode', 'give'),
93 93
 				'errors'    => $this->errors,
94 94
 				'fields'    => $fields,
95
-				'label'     => '[' . $this->shortcode_tag . ']',
95
+				'label'     => '['.$this->shortcode_tag.']',
96 96
 				'required'  => $this->required,
97
-				'title'     => esc_html__( 'Insert Shortcode', 'give' ),
97
+				'title'     => esc_html__('Insert Shortcode', 'give'),
98 98
 			);
99 99
 
100
-			if ( user_can_richedit() ) {
100
+			if (user_can_richedit()) {
101 101
 
102
-				Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults );
102
+				Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);
103 103
 
104 104
 			}
105 105
 		}
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 	 *
129 129
 	 * @since 1.0
130 130
 	 */
131
-	protected function generate_fields( $defined_fields ) {
131
+	protected function generate_fields($defined_fields) {
132 132
 
133 133
 		$fields = array();
134 134
 
135
-		if ( is_array( $defined_fields ) ) {
135
+		if (is_array($defined_fields)) {
136 136
 
137
-			foreach ( $defined_fields as $field ) {
137
+			foreach ($defined_fields as $field) {
138 138
 
139 139
 				$defaults = array(
140 140
 					'label'       => false,
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 					'type'        => '',
146 146
 				);
147 147
 
148
-				$field  = wp_parse_args( (array) $field, $defaults );
149
-				$method = 'generate_' . strtolower( $field['type'] );
148
+				$field  = wp_parse_args((array) $field, $defaults);
149
+				$method = 'generate_'.strtolower($field['type']);
150 150
 
151
-				if ( method_exists( $this, $method ) ) {
151
+				if (method_exists($this, $method)) {
152 152
 
153
-					$field = call_user_func( array( $this, $method ), $field );
153
+					$field = call_user_func(array($this, $method), $field);
154 154
 
155
-					if ( $field ) {
155
+					if ($field) {
156 156
 						$fields[] = $field;
157 157
 					}
158 158
 				}
@@ -172,23 +172,23 @@  discard block
 block discarded – undo
172 172
 	protected function get_fields() {
173 173
 
174 174
 		$defined_fields   = $this->define_fields();
175
-		$generated_fields = $this->generate_fields( $defined_fields );
175
+		$generated_fields = $this->generate_fields($defined_fields);
176 176
 
177 177
 		$errors = array();
178 178
 
179
-		if ( ! empty( $this->errors ) ) {
180
-			foreach ( $this->required as $name => $alert ) {
179
+		if ( ! empty($this->errors)) {
180
+			foreach ($this->required as $name => $alert) {
181 181
 				// Using WordPress function in place of array_column wp_list_pluck as it support older version as well.
182
-				if ( false === array_search( $name, give_list_pluck( $generated_fields, 'name' ) ) ) {
182
+				if (false === array_search($name, give_list_pluck($generated_fields, 'name'))) {
183 183
 
184
-					$errors[] = $this->errors[ $name ];
184
+					$errors[] = $this->errors[$name];
185 185
 				}
186 186
 			}
187 187
 
188 188
 			$this->errors = $errors;
189 189
 		}
190 190
 
191
-		if ( ! empty( $errors ) ) {
191
+		if ( ! empty($errors)) {
192 192
 
193 193
 			return $errors;
194 194
 		}
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @since 1.0
207 207
 	 */
208
-	protected function generate_container( $field ) {
208
+	protected function generate_container($field) {
209 209
 
210
-		if ( array_key_exists( 'html', $field ) ) {
210
+		if (array_key_exists('html', $field)) {
211 211
 
212 212
 			return array(
213 213
 				'type' => $field['type'],
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @since 1.0
229 229
 	 */
230
-	protected function generate_listbox( $field ) {
230
+	protected function generate_listbox($field) {
231 231
 
232
-		$listbox = shortcode_atts( array(
232
+		$listbox = shortcode_atts(array(
233 233
 			'label'    => '',
234 234
 			'minWidth' => '',
235 235
 			'name'     => false,
@@ -237,27 +237,27 @@  discard block
 block discarded – undo
237 237
 			'type'     => '',
238 238
 			'value'    => '',
239 239
 			'classes'  => ''
240
-		), $field );
240
+		), $field);
241 241
 
242
-		if ( $this->validate( $field ) ) {
242
+		if ($this->validate($field)) {
243 243
 
244 244
 			$new_listbox = array();
245 245
 
246
-			foreach ( $listbox as $key => $value ) {
246
+			foreach ($listbox as $key => $value) {
247 247
 
248
-				if ( $key == 'value' && empty( $value ) ) {
249
-					$new_listbox[ $key ] = $listbox['name'];
250
-				} else if ( $value ) {
251
-					$new_listbox[ $key ] = $value;
248
+				if ($key == 'value' && empty($value)) {
249
+					$new_listbox[$key] = $listbox['name'];
250
+				} else if ($value) {
251
+					$new_listbox[$key] = $value;
252 252
 				}
253 253
 			}
254 254
 
255 255
 			// do not reindex array!
256 256
 			$field['options'] = array(
257
-				                    '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),
257
+				                    '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')),
258 258
 			                    ) + $field['options'];
259 259
 
260
-			foreach ( $field['options'] as $value => $text ) {
260
+			foreach ($field['options'] as $value => $text) {
261 261
 				$new_listbox['values'][] = array(
262 262
 					'text'  => $text,
263 263
 					'value' => $value,
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @since 1.0
281 281
 	 */
282
-	protected function generate_post( $field ) {
282
+	protected function generate_post($field) {
283 283
 
284 284
 		$args = array(
285 285
 			'post_type'      => 'post',
@@ -288,26 +288,26 @@  discard block
 block discarded – undo
288 288
 			'posts_per_page' => 30,
289 289
 		);
290 290
 
291
-		$args    = wp_parse_args( (array) $field['query_args'], $args );
292
-		$posts   = new WP_Query( $args );
291
+		$args    = wp_parse_args((array) $field['query_args'], $args);
292
+		$posts   = new WP_Query($args);
293 293
 		$options = array();
294 294
 
295
-		if ( $posts->have_posts() ) {
296
-			while ( $posts->have_posts() ) {
295
+		if ($posts->have_posts()) {
296
+			while ($posts->have_posts()) {
297 297
 				$posts->the_post();
298 298
 				$post_title = get_the_title();
299 299
 				$post_id = get_the_ID();
300
-				$options[ absint( $post_id ) ] = ( empty( $post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $post_id ) : $post_title );
300
+				$options[absint($post_id)] = (empty($post_title) ? sprintf(__('Untitled (#%s)', 'give'), $post_id) : $post_title);
301 301
 			}
302 302
 
303 303
 			$field['type']    = 'listbox';
304 304
 			$field['options'] = $options;
305 305
 
306
-			return $this->generate_listbox( $field );
306
+			return $this->generate_listbox($field);
307 307
 		}
308 308
 
309 309
 		// perform validation here before returning false
310
-		$this->validate( $field );
310
+		$this->validate($field);
311 311
 
312 312
 		return false;
313 313
 	}
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @since 1.0
323 323
 	 */
324
-	protected function generate_textbox( $field ) {
324
+	protected function generate_textbox($field) {
325 325
 
326
-		$textbox = shortcode_atts( array(
326
+		$textbox = shortcode_atts(array(
327 327
 			'label'       => '',
328 328
 			'maxLength'   => '',
329 329
 			'minHeight'   => '',
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 			'value'       => '',
336 336
 			'classes'     => '',
337 337
 			'placeholder' => ''
338
-		), $field );
338
+		), $field);
339 339
 
340
-		if ( $this->validate( $field ) ) {
341
-			return array_filter( $textbox, array( $this, 'return_textbox_value' ) );
340
+		if ($this->validate($field)) {
341
+			return array_filter($textbox, array($this, 'return_textbox_value'));
342 342
 		}
343 343
 
344 344
 		return false;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @return bool
353 353
 	 */
354
-	function return_textbox_value( $value ) {
354
+	function return_textbox_value($value) {
355 355
 		return $value !== '';
356 356
 	}
357 357
 
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
 	 *
368 368
 	 * @since 1.0
369 369
 	 */
370
-	protected function validate( $field ) {
370
+	protected function validate($field) {
371 371
 
372
-		extract( shortcode_atts(
372
+		extract(shortcode_atts(
373 373
 				array(
374 374
 					'name'     => false,
375 375
 					'required' => false,
@@ -377,36 +377,36 @@  discard block
 block discarded – undo
377 377
 				), $field )
378 378
 		);
379 379
 
380
-		if ( $name ) {
380
+		if ($name) {
381 381
 
382
-			if ( isset( $required['error'] ) ) {
382
+			if (isset($required['error'])) {
383 383
 
384 384
 				$error = array(
385 385
 					'type' => 'container',
386 386
 					'html' => $required['error'],
387 387
 				);
388 388
 
389
-				$this->errors[ $name ] = $this->generate_container( $error );
389
+				$this->errors[$name] = $this->generate_container($error);
390 390
 			}
391 391
 
392
-			if ( ! ! $required || is_array( $required ) ) {
392
+			if ( ! ! $required || is_array($required)) {
393 393
 
394
-				$alert = esc_html__( 'Some of the shortcode options are required.', 'give' );
394
+				$alert = esc_html__('Some of the shortcode options are required.', 'give');
395 395
 
396
-				if ( isset( $required['alert'] ) ) {
396
+				if (isset($required['alert'])) {
397 397
 
398 398
 					$alert = $required['alert'];
399 399
 
400
-				} else if ( ! empty( $label ) ) {
400
+				} else if ( ! empty($label)) {
401 401
 
402 402
 					$alert = sprintf(
403 403
 					/* translators: %s: option label */
404
-						esc_html__( 'The "%s" option is required.', 'give' ),
405
-						str_replace( ':', '', $label )
404
+						esc_html__('The "%s" option is required.', 'give'),
405
+						str_replace(':', '', $label)
406 406
 					);
407 407
 				}
408 408
 
409
-				$this->required[ $name ] = $alert;
409
+				$this->required[$name] = $alert;
410 410
 			}
411 411
 
412 412
 			return true;
Please login to merge, or discard this patch.
includes/admin/upgrades/class-give-updates.php 1 patch
Spacing   +247 added lines, -254 removed lines patch added patch discarded remove patch
@@ -80,34 +80,34 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param array $args
82 82
 	 */
83
-	public function register( $args ) {
83
+	public function register($args) {
84 84
 		$args_default = array(
85 85
 			'id'       => '',
86 86
 			'version'  => '',
87 87
 			'callback' => '',
88 88
 		);
89 89
 
90
-		$args = wp_parse_args( $args, $args_default );
90
+		$args = wp_parse_args($args, $args_default);
91 91
 
92 92
 		// You can only register database upgrade.
93 93
 		$args['type'] = 'database';
94 94
 
95 95
 		// Bailout.
96 96
 		if (
97
-			empty( $args['id'] ) ||
98
-			empty( $args['version'] ) ||
99
-			empty( $args['callback'] ) ||
100
-			! is_callable( $args['callback'] )
97
+			empty($args['id']) ||
98
+			empty($args['version']) ||
99
+			empty($args['callback']) ||
100
+			! is_callable($args['callback'])
101 101
 		) {
102 102
 			return;
103 103
 		}
104 104
 
105 105
 		// Change depend param to array.
106
-		if ( isset( $args['depend'] ) && is_string( $args['depend'] ) ) {
107
-			$args['depend'] = array( $args['depend'] );
106
+		if (isset($args['depend']) && is_string($args['depend'])) {
107
+			$args['depend'] = array($args['depend']);
108 108
 		}
109 109
 
110
-		$this->updates[ $args['type'] ][] = $args;
110
+		$this->updates[$args['type']][] = $args;
111 111
 	}
112 112
 
113 113
 	/**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @return static
119 119
 	 */
120 120
 	static function get_instance() {
121
-		if ( is_null( self::$instance ) ) {
121
+		if (is_null(self::$instance)) {
122 122
 			self::$instance = new self();
123 123
 		}
124 124
 
@@ -136,27 +136,27 @@  discard block
 block discarded – undo
136 136
 		/**
137 137
 		 * Load file
138 138
 		 */
139
-		require_once GIVE_PLUGIN_DIR . 'includes/class-give-background-updater.php';
140
-		require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
139
+		require_once GIVE_PLUGIN_DIR.'includes/class-give-background-updater.php';
140
+		require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
141 141
 
142 142
 		self::$background_updater = new Give_Background_Updater();
143 143
 
144 144
 		/**
145 145
 		 * Setup hooks.
146 146
 		 */
147
-		add_action( 'init', array( $this, '__register_upgrade' ), 9999 );
148
-		add_action( 'give_set_upgrade_completed', array( $this, '__flush_resume_updates' ), 9999 );
149
-		add_action( 'wp_ajax_give_db_updates_info', array( $this, '__give_db_updates_info' ) );
150
-		add_action( 'wp_ajax_give_run_db_updates', array( $this, '__give_start_updating' ) );
151
-		add_action( 'admin_init', array( $this, '__redirect_admin' ) );
152
-		add_action( 'admin_init', array( $this, '__pause_db_update' ), - 1 );
153
-		add_action( 'admin_init', array( $this, '__restart_db_update' ), - 1 );
154
-		add_action( 'admin_notices', array( $this, '__show_notice' ) );
155
-		add_action( 'give_restart_db_upgrade', array( $this, '__health_background_update' ) );
156
-
157
-		if ( is_admin() ) {
158
-			add_action( 'admin_init', array( $this, '__change_donations_label' ), 9999 );
159
-			add_action( 'admin_menu', array( $this, '__register_menu' ), 9999 );
147
+		add_action('init', array($this, '__register_upgrade'), 9999);
148
+		add_action('give_set_upgrade_completed', array($this, '__flush_resume_updates'), 9999);
149
+		add_action('wp_ajax_give_db_updates_info', array($this, '__give_db_updates_info'));
150
+		add_action('wp_ajax_give_run_db_updates', array($this, '__give_start_updating'));
151
+		add_action('admin_init', array($this, '__redirect_admin'));
152
+		add_action('admin_init', array($this, '__pause_db_update'), - 1);
153
+		add_action('admin_init', array($this, '__restart_db_update'), - 1);
154
+		add_action('admin_notices', array($this, '__show_notice'));
155
+		add_action('give_restart_db_upgrade', array($this, '__health_background_update'));
156
+
157
+		if (is_admin()) {
158
+			add_action('admin_init', array($this, '__change_donations_label'), 9999);
159
+			add_action('admin_menu', array($this, '__register_menu'), 9999);
160 160
 		}
161 161
 	}
162 162
 
@@ -170,12 +170,12 @@  discard block
 block discarded – undo
170 170
 		$addons         = give_get_plugins();
171 171
 		$plugin_updates = get_plugin_updates();
172 172
 
173
-		foreach ( $addons as $key => $info ) {
174
-			if ( 'active' != $info['Status'] || 'add-on' != $info['Type'] || empty( $plugin_updates[ $key ] ) ) {
173
+		foreach ($addons as $key => $info) {
174
+			if ('active' != $info['Status'] || 'add-on' != $info['Type'] || empty($plugin_updates[$key])) {
175 175
 				continue;
176 176
 			}
177 177
 
178
-			$this->updates['plugin'][] = array_merge( $info, (array) $plugin_updates[ $key ] );
178
+			$this->updates['plugin'][] = array_merge($info, (array) $plugin_updates[$key]);
179 179
 		}
180 180
 	}
181 181
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @access public
188 188
 	 */
189 189
 	public function __register_upgrade() {
190
-		if ( ! is_admin() ) {
190
+		if ( ! is_admin()) {
191 191
 			return;
192 192
 		}
193 193
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		 *
197 197
 		 * @since 1.8.12
198 198
 		 */
199
-		do_action( 'give_register_updates', $this );
199
+		do_action('give_register_updates', $this);
200 200
 	}
201 201
 
202 202
 	/**
@@ -209,23 +209,22 @@  discard block
 block discarded – undo
209 209
 		global $menu;
210 210
 
211 211
 		// Bailout.
212
-		if ( empty( $menu ) || ! $this->get_total_update_count() ) {
212
+		if (empty($menu) || ! $this->get_total_update_count()) {
213 213
 			return;
214 214
 		}
215 215
 
216
-		$is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() );
216
+		$is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process());
217 217
 
218
-		foreach ( $menu as $index => $menu_item ) {
219
-			if ( 'edit.php?post_type=give_forms' !== $menu_item[2] ) {
218
+		foreach ($menu as $index => $menu_item) {
219
+			if ('edit.php?post_type=give_forms' !== $menu_item[2]) {
220 220
 				continue;
221 221
 			}
222 222
 
223
-			$menu[ $index ][0] = sprintf(
223
+			$menu[$index][0] = sprintf(
224 224
 				'%1$s <span class="update-plugins"><span class="plugin-count give-update-progress-count">%2$s%3$s</span></span>',
225
-				__( 'Donations', 'give' ),
225
+				__('Donations', 'give'),
226 226
 				$is_update ?
227
-					$this->get_db_update_processing_percentage() :
228
-					$this->get_total_update_count(),
227
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
229 228
 				$is_update ? '%' : ''
230 229
 			);
231 230
 
@@ -244,41 +243,40 @@  discard block
 block discarded – undo
244 243
 		$this->__register_plugin_addon_updates();
245 244
 
246 245
 		// Bailout.
247
-		if ( ! $this->get_total_update_count() ) {
246
+		if ( ! $this->get_total_update_count()) {
248 247
 			// Show complete update message if still on update setting page.
249
-			if ( isset( $_GET['page'] ) && 'give-updates' === $_GET['page'] ) {
248
+			if (isset($_GET['page']) && 'give-updates' === $_GET['page']) {
250 249
 				// Upgrades
251 250
 				add_submenu_page(
252 251
 					'edit.php?post_type=give_forms',
253
-					esc_html__( 'Give Updates Complete', 'give' ),
254
-					__( 'Updates', 'give' ),
252
+					esc_html__('Give Updates Complete', 'give'),
253
+					__('Updates', 'give'),
255 254
 					'manage_give_settings',
256 255
 					'give-updates',
257
-					array( $this, 'render_complete_page' )
256
+					array($this, 'render_complete_page')
258 257
 				);
259 258
 			}
260 259
 
261 260
 			return;
262 261
 		}
263 262
 
264
-		$is_update = ( $this->is_doing_updates() && ! self::$background_updater->is_paused_process() );
263
+		$is_update = ($this->is_doing_updates() && ! self::$background_updater->is_paused_process());
265 264
 
266 265
 		// Upgrades
267 266
 		add_submenu_page(
268 267
 			'edit.php?post_type=give_forms',
269
-			esc_html__( 'Give Updates', 'give' ),
268
+			esc_html__('Give Updates', 'give'),
270 269
 			sprintf(
271 270
 				'%1$s <span class="update-plugins"%2$s><span class="plugin-count give-update-progress-count">%3$s%4$s</span></span>',
272
-				__( 'Updates', 'give' ),
273
-				isset( $_GET['give-pause-db-upgrades'] ) ? ' style="display:none;"' : '',
271
+				__('Updates', 'give'),
272
+				isset($_GET['give-pause-db-upgrades']) ? ' style="display:none;"' : '',
274 273
 				$is_update ?
275
-					$this->get_db_update_processing_percentage() :
276
-					$this->get_total_update_count(),
274
+					$this->get_db_update_processing_percentage() : $this->get_total_update_count(),
277 275
 				$is_update ? '%' : ''
278 276
 			),
279 277
 			'manage_give_settings',
280 278
 			'give-updates',
281
-			array( $this, 'render_page' )
279
+			array($this, 'render_page')
282 280
 		);
283 281
 	}
284 282
 
@@ -293,13 +291,13 @@  discard block
 block discarded – undo
293 291
 		// Show db upgrade completed notice.
294 292
 		if (
295 293
 			! wp_doing_ajax() &&
296
-			current_user_can( 'manage_give_settings' ) &&
297
-			get_option( 'give_show_db_upgrade_complete_notice' ) &&
298
-			! isset( $_GET['give-db-update-completed'] )
294
+			current_user_can('manage_give_settings') &&
295
+			get_option('give_show_db_upgrade_complete_notice') &&
296
+			! isset($_GET['give-db-update-completed'])
299 297
 		) {
300
-			delete_option( 'give_show_db_upgrade_complete_notice' );
298
+			delete_option('give_show_db_upgrade_complete_notice');
301 299
 
302
-			wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed' ) );
300
+			wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-updates&give-db-update-completed=give_db_upgrade_completed'));
303 301
 			exit();
304 302
 		}
305 303
 	}
@@ -315,15 +313,15 @@  discard block
 block discarded – undo
315 313
 	 *
316 314
 	 * @return bool
317 315
 	 */
318
-	public function __pause_db_update( $force = false ) {
316
+	public function __pause_db_update($force = false) {
319 317
 		// Bailout.
320 318
 		if (
321 319
 			! $force &&
322 320
 			(
323 321
 				wp_doing_ajax() ||
324
-				! isset( $_GET['page'] ) ||
322
+				! isset($_GET['page']) ||
325 323
 				'give-updates' !== $_GET['page'] ||
326
-				! isset( $_GET['give-pause-db-upgrades'] ) ||
324
+				! isset($_GET['give-pause-db-upgrades']) ||
327 325
 				self::$background_updater->is_paused_process()
328 326
 			)
329 327
 
@@ -331,13 +329,13 @@  discard block
 block discarded – undo
331 329
 			return false;
332 330
 		}
333 331
 
334
-		delete_option( 'give_upgrade_error' );
332
+		delete_option('give_upgrade_error');
335 333
 
336
-		$this->__health_background_update( $this );
334
+		$this->__health_background_update($this);
337 335
 		$batch = self::$background_updater->get_all_batch();
338 336
 
339 337
 		// Bailout: if batch is empty
340
-		if ( empty( $batch->data ) ) {
338
+		if (empty($batch->data)) {
341 339
 			return false;
342 340
 		}
343 341
 
@@ -346,25 +344,25 @@  discard block
 block discarded – undo
346 344
 
347 345
 		// Do not stop background process immediately if task running.
348 346
 		// @see Give_Background_Updater::lock_process
349
-		if ( ! $force && self::$background_updater->is_process_running() ) {
350
-			update_option( 'give_pause_upgrade', 1 );
347
+		if ( ! $force && self::$background_updater->is_process_running()) {
348
+			update_option('give_pause_upgrade', 1);
351 349
 
352 350
 			return true;
353 351
 		}
354 352
 
355
-		update_option( 'give_paused_batches', $batch, 'no' );
356
-		delete_option( $batch->key );
357
-		delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' );
358
-		wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() );
353
+		update_option('give_paused_batches', $batch, 'no');
354
+		delete_option($batch->key);
355
+		delete_site_transient(self::$background_updater->get_identifier().'_process_lock');
356
+		wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier());
359 357
 
360
-		Give()->logs->add( 'Update Pause', print_r( $batch, true ), 0, 'update' );
358
+		Give()->logs->add('Update Pause', print_r($batch, true), 0, 'update');
361 359
 
362 360
 		/**
363 361
 		 * Fire action when pause db updates
364 362
 		 *
365 363
 		 * @since 2.0.1
366 364
 		 */
367
-		do_action( 'give_pause_db_upgrade', $this );
365
+		do_action('give_pause_db_upgrade', $this);
368 366
 
369 367
 		return true;
370 368
 	}
@@ -381,31 +379,31 @@  discard block
 block discarded – undo
381 379
 		// Bailout.
382 380
 		if (
383 381
 			wp_doing_ajax() ||
384
-			! isset( $_GET['page'] ) ||
382
+			! isset($_GET['page']) ||
385 383
 			'give-updates' !== $_GET['page'] ||
386
-			! isset( $_GET['give-restart-db-upgrades'] ) ||
384
+			! isset($_GET['give-restart-db-upgrades']) ||
387 385
 			! self::$background_updater->is_paused_process()
388 386
 		) {
389 387
 			return false;
390 388
 		}
391 389
 
392 390
 		Give_Background_Updater::flush_cache();
393
-		$batch = get_option( 'give_paused_batches' );
391
+		$batch = get_option('give_paused_batches');
394 392
 
395
-		if ( ! empty( $batch ) ) {
396
-			wp_cache_delete( $batch->key, 'options' );
397
-			update_option( $batch->key, $batch->data );
393
+		if ( ! empty($batch)) {
394
+			wp_cache_delete($batch->key, 'options');
395
+			update_option($batch->key, $batch->data);
398 396
 
399
-			delete_option( 'give_paused_batches' );
397
+			delete_option('give_paused_batches');
400 398
 
401
-			Give()->logs->add( 'Update Restart', print_r( $batch, true ), 0, 'update' );
399
+			Give()->logs->add('Update Restart', print_r($batch, true), 0, 'update');
402 400
 
403 401
 
404 402
 			/** Fire action when restart db updates
405 403
 			 *
406 404
 			 * @since 2.0.1
407 405
 			 */
408
-			do_action( 'give_restart_db_upgrade', $this );
406
+			do_action('give_restart_db_upgrade', $this);
409 407
 
410 408
 			self::$background_updater->dispatch();
411 409
 		}
@@ -421,53 +419,53 @@  discard block
 block discarded – undo
421 419
 	 *
422 420
 	 * @param Give_Updates $give_updates
423 421
 	 */
424
-	public function __health_background_update( $give_updates ) {
425
-		if ( ! $this->is_doing_updates() ) {
422
+	public function __health_background_update($give_updates) {
423
+		if ( ! $this->is_doing_updates()) {
426 424
 			return;
427 425
 		}
428 426
 
429 427
 		Give_Background_Updater::flush_cache();
430 428
 
431 429
 		$batch                = Give_Updates::$background_updater->get_all_batch();
432
-		$batch_data_count     = count( $batch->data );
433
-		$all_updates          = $give_updates->get_updates( 'database', 'all' );
434
-		$all_update_ids       = wp_list_pluck( $all_updates, 'id' );
435
-		$all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array();
430
+		$batch_data_count     = count($batch->data);
431
+		$all_updates          = $give_updates->get_updates('database', 'all');
432
+		$all_update_ids       = wp_list_pluck($all_updates, 'id');
433
+		$all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array();
436 434
 		$log_data             = '';
437
-		$doing_upgrade_args   = get_option( 'give_doing_upgrade' );
435
+		$doing_upgrade_args   = get_option('give_doing_upgrade');
438 436
 
439
-		if ( ! empty( $doing_upgrade_args ) ) {
440
-			$log_data .= 'Doing update:' . "\n";
441
-			$log_data .= print_r( $doing_upgrade_args, true ) . "\n";
437
+		if ( ! empty($doing_upgrade_args)) {
438
+			$log_data .= 'Doing update:'."\n";
439
+			$log_data .= print_r($doing_upgrade_args, true)."\n";
442 440
 		}
443 441
 
444 442
 		/**
445 443
 		 * Add remove upgrade from batch
446 444
 		 */
447
-		if ( ! empty( $batch->data ) ) {
445
+		if ( ! empty($batch->data)) {
448 446
 
449
-			foreach ( $batch->data as $index => $update ) {
450
-				$log_data = print_r( $update, true ) . "\n";
447
+			foreach ($batch->data as $index => $update) {
448
+				$log_data = print_r($update, true)."\n";
451 449
 
452
-				if ( ! is_callable( $update['callback'] ) ) {
453
-					$log_data .= 'Removing missing callback update: ' . "{$update['id']}\n";
454
-					unset( $batch->data[ $index ] );
455
-				} elseif ( give_has_upgrade_completed( $update['id'] ) ) {
456
-					$log_data .= 'Removing already completed update: ' . "{$update['id']}\n";
457
-					unset( $batch->data[ $index ] );
450
+				if ( ! is_callable($update['callback'])) {
451
+					$log_data .= 'Removing missing callback update: '."{$update['id']}\n";
452
+					unset($batch->data[$index]);
453
+				} elseif (give_has_upgrade_completed($update['id'])) {
454
+					$log_data .= 'Removing already completed update: '."{$update['id']}\n";
455
+					unset($batch->data[$index]);
458 456
 				}
459 457
 
460
-				if ( ! empty( $update['depend'] ) ) {
458
+				if ( ! empty($update['depend'])) {
461 459
 
462
-					foreach ( $update['depend'] as $depend ) {
463
-						if ( give_has_upgrade_completed( $depend ) ) {
464
-							$log_data .= 'Completed update: ' . "{$depend}\n";
460
+					foreach ($update['depend'] as $depend) {
461
+						if (give_has_upgrade_completed($depend)) {
462
+							$log_data .= 'Completed update: '."{$depend}\n";
465 463
 							continue;
466 464
 						}
467 465
 
468
-						if ( in_array( $depend, $all_update_ids ) && ! in_array( $depend, $all_batch_update_ids ) ) {
469
-							$log_data .= 'Adding missing update: ' . "{$depend}\n";
470
-							array_unshift( $batch->data, $all_updates[ array_search( $depend, $all_update_ids ) ] );
466
+						if (in_array($depend, $all_update_ids) && ! in_array($depend, $all_batch_update_ids)) {
467
+							$log_data .= 'Adding missing update: '."{$depend}\n";
468
+							array_unshift($batch->data, $all_updates[array_search($depend, $all_update_ids)]);
471 469
 						}
472 470
 					}
473 471
 				}
@@ -477,52 +475,52 @@  discard block
 block discarded – undo
477 475
 		/**
478 476
 		 * Add new upgrade to batch
479 477
 		 */
480
-		if ( $new_updates = $this->get_updates( 'database', 'new' ) ) {
481
-			$all_batch_update_ids = ! empty( $batch->data ) ? wp_list_pluck( $batch->data, 'id' ) : array();
478
+		if ($new_updates = $this->get_updates('database', 'new')) {
479
+			$all_batch_update_ids = ! empty($batch->data) ? wp_list_pluck($batch->data, 'id') : array();
482 480
 
483
-			foreach ( $new_updates as $index => $new_update ) {
484
-				if ( give_has_upgrade_completed( $new_update['id'] ) || in_array( $new_update['id'], $all_batch_update_ids ) ) {
485
-					unset( $new_updates[ $index ] );
481
+			foreach ($new_updates as $index => $new_update) {
482
+				if (give_has_upgrade_completed($new_update['id']) || in_array($new_update['id'], $all_batch_update_ids)) {
483
+					unset($new_updates[$index]);
486 484
 				}
487 485
 			}
488 486
 
489
-			if ( ! empty( $new_updates ) ) {
490
-				$log_data .= 'Adding new update: ' . "\n";
491
-				$log_data .= print_r( $new_updates, true ) . "\n";
487
+			if ( ! empty($new_updates)) {
488
+				$log_data .= 'Adding new update: '."\n";
489
+				$log_data .= print_r($new_updates, true)."\n";
492 490
 
493
-				$batch->data = array_merge( (array) $batch->data, $new_updates );
494
-				update_option( 'give_db_update_count', ( absint( get_option( 'give_db_update_count' ) ) + count( $new_updates ) ) );
491
+				$batch->data = array_merge((array) $batch->data, $new_updates);
492
+				update_option('give_db_update_count', (absint(get_option('give_db_update_count')) + count($new_updates)));
495 493
 			}
496 494
 		}
497 495
 
498 496
 		/**
499 497
 		 * Fix batch
500 498
 		 */
501
-		if ( empty( $batch->data ) ) {
499
+		if (empty($batch->data)) {
502 500
 			// Complete batch if do not have any data to process.
503
-			self::$background_updater->delete( $batch->key );
501
+			self::$background_updater->delete($batch->key);
504 502
 
505
-			if ( self::$background_updater->has_queue() ) {
506
-				$this->__health_background_update( $this );
503
+			if (self::$background_updater->has_queue()) {
504
+				$this->__health_background_update($this);
507 505
 			} else {
508
-				delete_site_transient( self::$background_updater->get_identifier() . '_process_lock' );
509
-				wp_clear_scheduled_hook( self::$background_updater->get_cron_identifier() );
506
+				delete_site_transient(self::$background_updater->get_identifier().'_process_lock');
507
+				wp_clear_scheduled_hook(self::$background_updater->get_cron_identifier());
510 508
 
511 509
 				self::$background_updater->complete();
512 510
 			}
513 511
 
514
-		} elseif ( $batch_data_count !== count( $batch->data ) ) {
512
+		} elseif ($batch_data_count !== count($batch->data)) {
515 513
 
516
-			$log_data .= 'Updating batch' . "\n";
517
-			$log_data .= print_r( $batch, true );
514
+			$log_data .= 'Updating batch'."\n";
515
+			$log_data .= print_r($batch, true);
518 516
 
519
-			if ( ! empty( $batch->key ) ) {
520
-				wp_cache_delete( $batch->key, 'options' );
521
-				update_option( $batch->key, $batch->data );
517
+			if ( ! empty($batch->key)) {
518
+				wp_cache_delete($batch->key, 'options');
519
+				update_option($batch->key, $batch->data);
522 520
 			} else {
523 521
 
524
-				foreach ( $batch->data as $data ) {
525
-					Give_Updates::$background_updater->push_to_queue( $data );
522
+				foreach ($batch->data as $data) {
523
+					Give_Updates::$background_updater->push_to_queue($data);
526 524
 				}
527 525
 
528 526
 				Give_Updates::$background_updater->save();
@@ -533,31 +531,31 @@  discard block
 block discarded – undo
533 531
 		/**
534 532
 		 * Fix give_doing_upgrade option
535 533
 		 */
536
-		if( $fresh_new_db_count = $this->get_total_new_db_update_count( true ) ) {
537
-			update_option( 'give_db_update_count', $fresh_new_db_count );
534
+		if ($fresh_new_db_count = $this->get_total_new_db_update_count(true)) {
535
+			update_option('give_db_update_count', $fresh_new_db_count);
538 536
 		}
539 537
 
540 538
 		$doing_upgrade_args['update']           = 1;
541
-		$doing_upgrade_args['heading']          = sprintf( 'Update %s of %s', 1, $fresh_new_db_count );
542
-		$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage( true );
539
+		$doing_upgrade_args['heading']          = sprintf('Update %s of %s', 1, $fresh_new_db_count);
540
+		$doing_upgrade_args['total_percentage'] = $this->get_db_update_processing_percentage(true);
543 541
 
544 542
 		// Remove already completed update from info.
545 543
 		if (
546
-			empty( $doing_upgrade_args['update_info'] )
547
-			|| give_has_upgrade_completed( $doing_upgrade_args['update_info']['id'] )
544
+			empty($doing_upgrade_args['update_info'])
545
+			|| give_has_upgrade_completed($doing_upgrade_args['update_info']['id'])
548 546
 		) {
549
-			$doing_upgrade_args['update_info'] = current( array_values( $batch->data ) );
547
+			$doing_upgrade_args['update_info'] = current(array_values($batch->data));
550 548
 			$doing_upgrade_args['step']        = 1;
551 549
 		}
552 550
 
553 551
 		// Check if dependency completed or not.
554
-		if ( isset( $doing_upgrade_args['update_info']['depend'] ) ) {
555
-			foreach ( $doing_upgrade_args['update_info']['depend'] as $depend ) {
556
-				if ( give_has_upgrade_completed( $depend ) ) {
552
+		if (isset($doing_upgrade_args['update_info']['depend'])) {
553
+			foreach ($doing_upgrade_args['update_info']['depend'] as $depend) {
554
+				if (give_has_upgrade_completed($depend)) {
557 555
 					continue;
558 556
 				}
559 557
 
560
-				$doing_upgrade_args['update_info']      = $all_updates[ array_search( $depend, $all_update_ids ) ];
558
+				$doing_upgrade_args['update_info']      = $all_updates[array_search($depend, $all_update_ids)];
561 559
 				$doing_upgrade_args['step']             = 1;
562 560
 				$doing_upgrade_args['percentage']       = 0;
563 561
 				$doing_upgrade_args['total_percentage'] = 0;
@@ -566,14 +564,14 @@  discard block
 block discarded – undo
566 564
 			}
567 565
 		}
568 566
 
569
-		if( ! empty( $doing_upgrade_args['update_info'] ) ) {
570
-			update_option( 'give_doing_upgrade', $doing_upgrade_args );
567
+		if ( ! empty($doing_upgrade_args['update_info'])) {
568
+			update_option('give_doing_upgrade', $doing_upgrade_args);
571 569
 
572
-			$log_data .= 'Updated doing update:' . "\n";
573
-			$log_data .= print_r( $doing_upgrade_args, true ) . "\n";
570
+			$log_data .= 'Updated doing update:'."\n";
571
+			$log_data .= print_r($doing_upgrade_args, true)."\n";
574 572
 		}
575 573
 
576
-		Give()->logs->add( 'Update Health Check', $log_data, 0, 'update' );
574
+		Give()->logs->add('Update Health Check', $log_data, 0, 'update');
577 575
 	}
578 576
 
579 577
 
@@ -587,61 +585,61 @@  discard block
 block discarded – undo
587 585
 		$current_screen = get_current_screen();
588 586
 
589 587
 		// Bailout.
590
-		if ( ! current_user_can( 'manage_give_settings' ) ) {
588
+		if ( ! current_user_can('manage_give_settings')) {
591 589
 			return;
592 590
 		}
593 591
 
594 592
 		// Run DB updates.
595
-		if ( ! empty( $_GET['give-run-db-update'] ) ) {
593
+		if ( ! empty($_GET['give-run-db-update'])) {
596 594
 			$this->run_db_update();
597 595
 		}
598 596
 
599 597
 
600 598
 		// Bailout.
601
-		if ( in_array( $current_screen->base, array( 'give_forms_page_give-updates', 'update-core' ) ) ) {
599
+		if (in_array($current_screen->base, array('give_forms_page_give-updates', 'update-core'))) {
602 600
 			return;
603 601
 		}
604 602
 
605 603
 		// Show notice if upgrade paused.
606
-		if ( self::$background_updater->is_paused_process() ) {
604
+		if (self::$background_updater->is_paused_process()) {
607 605
 			ob_start();
608 606
 
609
-			$upgrade_error = get_option( 'give_upgrade_error' );
610
-			if ( ! $upgrade_error ) : ?>
611
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
612
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give' ); ?>
607
+			$upgrade_error = get_option('give_upgrade_error');
608
+			if ( ! $upgrade_error) : ?>
609
+				<strong><?php _e('Database Update', 'give'); ?></strong>
610
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a backup before proceeding.', 'give'); ?>
613 611
 				<br>
614 612
 				<br>
615
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-restart-db-upgrades' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-restart-updater-btn">
616
-					<?php _e( 'Restart the updater', 'give' ); ?>
613
+				<a href="<?php echo esc_url(add_query_arg(array('give-restart-db-upgrades' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-restart-updater-btn">
614
+					<?php _e('Restart the updater', 'give'); ?>
617 615
 				</a>
618 616
 			<?php else: ?>
619
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
620
-				&nbsp;&#8211;&nbsp;<?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?>
617
+				<strong><?php _e('Database Update', 'give'); ?></strong>
618
+				&nbsp;&#8211;&nbsp;<?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?>
621 619
 			<?php
622 620
 			endif;
623 621
 			$desc_html = ob_get_clean();
624 622
 
625
-			Give()->notices->register_notice( array(
623
+			Give()->notices->register_notice(array(
626 624
 				'id'          => 'give_upgrade_db',
627 625
 				'type'        => 'error',
628 626
 				'dismissible' => false,
629 627
 				'description' => $desc_html,
630
-			) );
628
+			));
631 629
 		}
632 630
 
633 631
 		// Bailout if doing upgrades.
634
-		if ( $this->is_doing_updates() ) {
632
+		if ($this->is_doing_updates()) {
635 633
 			return;
636 634
 		}
637 635
 
638 636
 		// Show notice if ajax is not working.
639
-		if ( ! give_test_ajax_works() ) {
637
+		if ( ! give_test_ajax_works()) {
640 638
 			Give()->notices->register_notice(
641 639
 				array(
642 640
 					'id'          => 'give_db_upgrade_ajax_inaccessible',
643 641
 					'type'        => 'error',
644
-					'description' => sprintf( '%1$s <a href="%2$s" target="_blank">%3$s</a>', __( 'Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give' ), 'http://docs.givewp.com/admin-ajax-error', __( 'Read More', 'give' ) . ' &raquo;' ),
642
+					'description' => sprintf('%1$s <a href="%2$s" target="_blank">%3$s</a>', __('Give needs to upgrade the database but cannot because AJAX does not appear accessible. This could be because your website is password protected, in maintenance mode, or has a specific hosting configuration or plugin active that is preventing access.', 'give'), 'http://docs.givewp.com/admin-ajax-error', __('Read More', 'give').' &raquo;'),
645 643
 					'show'        => true,
646 644
 				)
647 645
 			);
@@ -650,40 +648,40 @@  discard block
 block discarded – undo
650 648
 		}
651 649
 
652 650
 		// Show db upgrade completed notice.
653
-		if ( ! empty( $_GET['give-db-update-completed'] ) ) {
654
-			Give()->notices->register_notice( array(
651
+		if ( ! empty($_GET['give-db-update-completed'])) {
652
+			Give()->notices->register_notice(array(
655 653
 				'id'          => 'give_db_upgrade_completed',
656 654
 				'type'        => 'updated',
657
-				'description' => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
655
+				'description' => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
658 656
 				'show'        => true,
659
-			) );
657
+			));
660 658
 
661 659
 			// Start update.
662
-		} elseif ( ! empty( $_GET['give-run-db-update'] ) ) {
660
+		} elseif ( ! empty($_GET['give-run-db-update'])) {
663 661
 			$this->run_db_update();
664 662
 
665 663
 			// Show run the update notice.
666
-		} elseif ( $this->get_total_new_db_update_count() ) {
664
+		} elseif ($this->get_total_new_db_update_count()) {
667 665
 			ob_start();
668 666
 			?>
669 667
 			<p>
670
-				<strong><?php _e( 'Database Update', 'give' ); ?></strong>
671
-				&nbsp;&#8211;&nbsp;<?php _e( 'GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give' ); ?>
668
+				<strong><?php _e('Database Update', 'give'); ?></strong>
669
+				&nbsp;&#8211;&nbsp;<?php _e('GiveWP needs to update your database to the latest version. The following process will make updates to your site\'s database. Please create a complete backup before proceeding.', 'give'); ?>
672 670
 			</p>
673 671
 			<p class="submit">
674
-				<a href="<?php echo esc_url( add_query_arg( array( 'give-run-db-update' => 1 ), admin_url( 'edit.php?post_type=give_forms&page=give-updates' ) ) ); ?>" class="button button-primary give-run-update-now">
675
-					<?php _e( 'Run the updater', 'give' ); ?>
672
+				<a href="<?php echo esc_url(add_query_arg(array('give-run-db-update' => 1), admin_url('edit.php?post_type=give_forms&page=give-updates'))); ?>" class="button button-primary give-run-update-now">
673
+					<?php _e('Run the updater', 'give'); ?>
676 674
 				</a>
677 675
 			</p>
678 676
 			<?php
679 677
 			$desc_html = ob_get_clean();
680 678
 
681
-			Give()->notices->register_notice( array(
679
+			Give()->notices->register_notice(array(
682 680
 				'id'          => 'give_upgrade_db',
683 681
 				'type'        => 'updated',
684 682
 				'dismissible' => false,
685 683
 				'description' => $desc_html,
686
-			) );
684
+			));
687 685
 		}
688 686
 	}
689 687
 
@@ -694,7 +692,7 @@  discard block
 block discarded – undo
694 692
 	 * @access public
695 693
 	 */
696 694
 	public function render_complete_page() {
697
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades-complete.php';
695
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades-complete.php';
698 696
 	}
699 697
 
700 698
 	/**
@@ -704,7 +702,7 @@  discard block
 block discarded – undo
704 702
 	 * @access public
705 703
 	 */
706 704
 	public function render_page() {
707
-		include_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/upgrades.php';
705
+		include_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/upgrades.php';
708 706
 	}
709 707
 
710 708
 	/**
@@ -715,26 +713,26 @@  discard block
 block discarded – undo
715 713
 	 */
716 714
 	private function run_db_update() {
717 715
 		// Bailout.
718
-		if ( $this->is_doing_updates() || ! $this->get_total_new_db_update_count() ) {
716
+		if ($this->is_doing_updates() || ! $this->get_total_new_db_update_count()) {
719 717
 			return;
720 718
 		}
721 719
 
722
-		$updates = $this->get_updates( 'database', 'new' );
720
+		$updates = $this->get_updates('database', 'new');
723 721
 
724
-		foreach ( $updates as $update ) {
725
-			self::$background_updater->push_to_queue( $update );
722
+		foreach ($updates as $update) {
723
+			self::$background_updater->push_to_queue($update);
726 724
 		}
727 725
 
728
-		add_option( 'give_db_update_count', count( $updates ), '', 'no' );
726
+		add_option('give_db_update_count', count($updates), '', 'no');
729 727
 
730
-		add_option( 'give_doing_upgrade', array(
728
+		add_option('give_doing_upgrade', array(
731 729
 			'update_info'      => $updates[0],
732 730
 			'step'             => 1,
733 731
 			'update'           => 1,
734
-			'heading'          => sprintf( 'Update %s of %s', 1, count( $updates ) ),
732
+			'heading'          => sprintf('Update %s of %s', 1, count($updates)),
735 733
 			'percentage'       => 0,
736 734
 			'total_percentage' => 0,
737
-		), '', 'no' );
735
+		), '', 'no');
738 736
 
739 737
 		self::$background_updater->save()->dispatch();
740 738
 	}
@@ -748,14 +746,13 @@  discard block
 block discarded – undo
748 746
 	 */
749 747
 	public function __flush_resume_updates() {
750 748
 		//delete_option( 'give_doing_upgrade' );
751
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
749
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
752 750
 
753 751
 		// Reset counter.
754 752
 		$this->step = $this->percentage = 0;
755 753
 
756
-		$this->update = ( $this->get_total_db_update_count() > $this->update ) ?
757
-			( $this->update + 1 ) :
758
-			$this->update;
754
+		$this->update = ($this->get_total_db_update_count() > $this->update) ?
755
+			($this->update + 1) : $this->update;
759 756
 	}
760 757
 
761 758
 
@@ -770,7 +767,7 @@  discard block
 block discarded – undo
770 767
 	public function __give_start_updating() {
771 768
 		// Check permission.
772 769
 		if (
773
-			! current_user_can( 'manage_give_settings' ) ||
770
+			! current_user_can('manage_give_settings') ||
774 771
 			$this->is_doing_updates()
775 772
 		) {
776 773
 			wp_send_json_error();
@@ -778,7 +775,7 @@  discard block
 block discarded – undo
778 775
 
779 776
 		// @todo: validate nonce
780 777
 		// @todo: set http method to post
781
-		if ( empty( $_POST['run_db_update'] ) ) {
778
+		if (empty($_POST['run_db_update'])) {
782 779
 			wp_send_json_error();
783 780
 		}
784 781
 
@@ -797,34 +794,34 @@  discard block
 block discarded – undo
797 794
 	 * @return string
798 795
 	 */
799 796
 	public function __give_db_updates_info() {
800
-		$update_info   = get_option( 'give_doing_upgrade' );
797
+		$update_info   = get_option('give_doing_upgrade');
801 798
 		$response_type = '';
802 799
 
803
-		if ( self::$background_updater->is_paused_process() ) {
800
+		if (self::$background_updater->is_paused_process()) {
804 801
 			$update_info = array(
805
-				'message'    => __( 'The updates have been paused.', 'give' ),
802
+				'message'    => __('The updates have been paused.', 'give'),
806 803
 				'heading'    => '',
807 804
 				'percentage' => 0,
808 805
 			);
809 806
 
810
-			if ( get_option( 'give_upgrade_error' ) ) {
811
-				$update_info['message'] = __( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' );
807
+			if (get_option('give_upgrade_error')) {
808
+				$update_info['message'] = __('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give');
812 809
 			}
813 810
 
814 811
 			$response_type = 'error';
815 812
 
816
-		} elseif ( empty( $update_info ) || ! $this->get_total_new_db_update_count( true ) ) {
813
+		} elseif (empty($update_info) || ! $this->get_total_new_db_update_count(true)) {
817 814
 			$update_info   = array(
818
-				'message'    => __( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ),
819
-				'heading'    => __( 'Updates Completed.', 'give' ),
815
+				'message'    => __('Give database updates completed successfully. Thank you for updating to the latest version!', 'give'),
816
+				'heading'    => __('Updates Completed.', 'give'),
820 817
 				'percentage' => 0,
821 818
 			);
822 819
 			$response_type = 'success';
823 820
 
824
-			delete_option( 'give_show_db_upgrade_complete_notice' );
821
+			delete_option('give_show_db_upgrade_complete_notice');
825 822
 		}
826 823
 
827
-		$this->send_ajax_response( $update_info, $response_type );
824
+		$this->send_ajax_response($update_info, $response_type);
828 825
 	}
829 826
 
830 827
 	/**
@@ -836,7 +833,7 @@  discard block
 block discarded – undo
836 833
 	 * @param        $data
837 834
 	 * @param string $type
838 835
 	 */
839
-	public function send_ajax_response( $data, $type = '' ) {
836
+	public function send_ajax_response($data, $type = '') {
840 837
 		$default = array(
841 838
 			'message'    => '',
842 839
 			'heading'    => '',
@@ -846,24 +843,24 @@  discard block
 block discarded – undo
846 843
 		);
847 844
 
848 845
 		// Set data.
849
-		$data = wp_parse_args( $data, $default );
846
+		$data = wp_parse_args($data, $default);
850 847
 
851 848
 		// Enable cache.
852 849
 		Give_Cache::enable();
853 850
 
854
-		switch ( $type ) {
851
+		switch ($type) {
855 852
 			case 'success':
856
-				wp_send_json_success( $data );
853
+				wp_send_json_success($data);
857 854
 				break;
858 855
 
859 856
 			case 'error':
860
-				wp_send_json_error( $data );
857
+				wp_send_json_error($data);
861 858
 				break;
862 859
 
863 860
 			default:
864
-				wp_send_json( array(
861
+				wp_send_json(array(
865 862
 					'data' => $data,
866
-				) );
863
+				));
867 864
 				break;
868 865
 		}
869 866
 	}
@@ -877,12 +874,12 @@  discard block
 block discarded – undo
877 874
 	 * @param $total
878 875
 	 * @param $current_total
879 876
 	 */
880
-	public function set_percentage( $total, $current_total ) {
877
+	public function set_percentage($total, $current_total) {
881 878
 		// Set percentage.
882
-		$this->percentage = $total ? ( ( $current_total ) / $total ) * 100 : 0;
879
+		$this->percentage = $total ? (($current_total) / $total) * 100 : 0;
883 880
 
884 881
 		// Verify percentage.
885
-		$this->percentage = ( 100 < $this->percentage ) ? 100 : $this->percentage;
882
+		$this->percentage = (100 < $this->percentage) ? 100 : $this->percentage;
886 883
 	}
887 884
 
888 885
 	/**
@@ -895,22 +892,22 @@  discard block
 block discarded – undo
895 892
 	 *
896 893
 	 * @return bool|null
897 894
 	 */
898
-	public function is_parent_updates_completed( $update ) {
895
+	public function is_parent_updates_completed($update) {
899 896
 		// Bailout.
900
-		if ( empty( $update['depend'] ) ) {
897
+		if (empty($update['depend'])) {
901 898
 			return true;
902 899
 		}
903 900
 
904 901
 		// Check if dependency is valid or not.
905
-		if ( ! $this->has_valid_dependency( $update ) ) {
902
+		if ( ! $this->has_valid_dependency($update)) {
906 903
 			return null;
907 904
 		}
908 905
 
909 906
 		$is_dependency_completed = true;
910 907
 
911
-		foreach ( $update['depend'] as $depend ) {
908
+		foreach ($update['depend'] as $depend) {
912 909
 
913
-			if ( ! give_has_upgrade_completed( $depend ) ) {
910
+			if ( ! give_has_upgrade_completed($depend)) {
914 911
 				$is_dependency_completed = false;
915 912
 				break;
916 913
 			}
@@ -927,7 +924,7 @@  discard block
 block discarded – undo
927 924
 	 * @return bool
928 925
 	 */
929 926
 	public function is_doing_updates() {
930
-		return (bool) get_option( 'give_doing_upgrade' );
927
+		return (bool) get_option('give_doing_upgrade');
931 928
 	}
932 929
 
933 930
 
@@ -941,7 +938,7 @@  discard block
 block discarded – undo
941 938
 	 *
942 939
 	 * @return bool
943 940
 	 */
944
-	public function has_valid_dependency( $update ) {
941
+	public function has_valid_dependency($update) {
945 942
 		$is_valid_dependency = true;
946 943
 		// $update_ids          = wp_list_pluck( $this->get_updates( 'database', 'all' ), 'id' );
947 944
 		//
@@ -967,33 +964,33 @@  discard block
 block discarded – undo
967 964
 	 *
968 965
 	 * @return array
969 966
 	 */
970
-	public function get_updates( $update_type = '', $status = 'all' ) {
967
+	public function get_updates($update_type = '', $status = 'all') {
971 968
 		// return all updates.
972
-		if ( empty( $update_type ) ) {
969
+		if (empty($update_type)) {
973 970
 			return $this->updates;
974 971
 		}
975 972
 
976 973
 		// Get specific update.
977
-		$updates = ! empty( $this->updates[ $update_type ] ) ? $this->updates[ $update_type ] : array();
974
+		$updates = ! empty($this->updates[$update_type]) ? $this->updates[$update_type] : array();
978 975
 
979 976
 		// Bailout.
980
-		if ( empty( $updates ) ) {
977
+		if (empty($updates)) {
981 978
 			return $updates;
982 979
 		}
983 980
 
984
-		switch ( $status ) {
981
+		switch ($status) {
985 982
 			case 'new':
986 983
 				// Remove already completed updates.
987
-				wp_cache_delete( 'give_completed_upgrades', 'options' );
984
+				wp_cache_delete('give_completed_upgrades', 'options');
988 985
 				$completed_updates = give_get_completed_upgrades();
989 986
 
990
-				if ( ! empty( $completed_updates ) ) {
991
-					foreach ( $updates as $index => $update ) {
992
-						if ( in_array( $update['id'], $completed_updates ) ) {
993
-							unset( $updates[ $index ] );
987
+				if ( ! empty($completed_updates)) {
988
+					foreach ($updates as $index => $update) {
989
+						if (in_array($update['id'], $completed_updates)) {
990
+							unset($updates[$index]);
994 991
 						}
995 992
 					}
996
-					$updates = array_values( $updates );
993
+					$updates = array_values($updates);
997 994
 				}
998 995
 
999 996
 				break;
@@ -1010,7 +1007,7 @@  discard block
 block discarded – undo
1010 1007
 	 * @return int
1011 1008
 	 */
1012 1009
 	public function get_total_plugin_update_count() {
1013
-		return count( $this->get_updates( 'plugin' ) );
1010
+		return count($this->get_updates('plugin'));
1014 1011
 	}
1015 1012
 
1016 1013
 	/**
@@ -1025,7 +1022,7 @@  discard block
 block discarded – undo
1025 1022
 		$db_update_count     = $this->get_pending_db_update_count();
1026 1023
 		$plugin_update_count = $this->get_total_plugin_update_count();
1027 1024
 
1028
-		return ( $db_update_count + $plugin_update_count );
1025
+		return ($db_update_count + $plugin_update_count);
1029 1026
 	}
1030 1027
 
1031 1028
 	/**
@@ -1037,7 +1034,7 @@  discard block
 block discarded – undo
1037 1034
 	 * @return int
1038 1035
 	 */
1039 1036
 	public function get_pending_db_update_count() {
1040
-		return count( $this->get_updates( 'database', 'new' ) );
1037
+		return count($this->get_updates('database', 'new'));
1041 1038
 	}
1042 1039
 
1043 1040
 	/**
@@ -1049,7 +1046,7 @@  discard block
 block discarded – undo
1049 1046
 	 * @return int
1050 1047
 	 */
1051 1048
 	public function get_total_db_update_count() {
1052
-		return count( $this->get_updates( 'database', 'all' ) );
1049
+		return count($this->get_updates('database', 'all'));
1053 1050
 	}
1054 1051
 
1055 1052
 	/**
@@ -1062,10 +1059,9 @@  discard block
 block discarded – undo
1062 1059
 	 *
1063 1060
 	 * @return int
1064 1061
 	 */
1065
-	public function get_total_new_db_update_count( $refresh = false ) {
1062
+	public function get_total_new_db_update_count($refresh = false) {
1066 1063
 		$update_count = $this->is_doing_updates() && ! $refresh ?
1067
-			get_option( 'give_db_update_count' ) :
1068
-			$this->get_pending_db_update_count();
1064
+			get_option('give_db_update_count') : $this->get_pending_db_update_count();
1069 1065
 
1070 1066
 		return $update_count;
1071 1067
 	}
@@ -1080,11 +1076,11 @@  discard block
 block discarded – undo
1080 1076
 	 *
1081 1077
 	 * @return int
1082 1078
 	 */
1083
-	public function get_running_db_update( $refresh = false ) {
1079
+	public function get_running_db_update($refresh = false) {
1084 1080
 		$current_update = 1;
1085 1081
 
1086
-		if ( $this->is_doing_updates() && ! $refresh ) {
1087
-			$current_update = get_option( 'give_doing_upgrade' );
1082
+		if ($this->is_doing_updates() && ! $refresh) {
1083
+			$current_update = get_option('give_doing_upgrade');
1088 1084
 			$current_update = $current_update['update'];
1089 1085
 		}
1090 1086
 
@@ -1101,25 +1097,23 @@  discard block
 block discarded – undo
1101 1097
 	 *
1102 1098
 	 * @return float|int
1103 1099
 	 */
1104
-	public function get_db_update_processing_percentage( $refresh = false ) {
1100
+	public function get_db_update_processing_percentage($refresh = false) {
1105 1101
 		// Bailout.
1106
-		if ( ! $this->get_total_new_db_update_count( $refresh ) ) {
1102
+		if ( ! $this->get_total_new_db_update_count($refresh)) {
1107 1103
 			return 0;
1108 1104
 		}
1109 1105
 
1110
-		$resume_update            = get_option( 'give_doing_upgrade' );
1111
-		$update_count_percentages = ( ( $this->get_running_db_update( $refresh ) - 1 ) / $this->get_total_new_db_update_count( $refresh ) ) * 100;
1112
-		$update_percentage_share  = ( 1 / $this->get_total_new_db_update_count() ) * 100;
1113
-		$upgrade_percentage       = ( ( $resume_update['percentage'] * $update_percentage_share ) / 100 );
1106
+		$resume_update            = get_option('give_doing_upgrade');
1107
+		$update_count_percentages = (($this->get_running_db_update($refresh) - 1) / $this->get_total_new_db_update_count($refresh)) * 100;
1108
+		$update_percentage_share  = (1 / $this->get_total_new_db_update_count()) * 100;
1109
+		$upgrade_percentage       = (($resume_update['percentage'] * $update_percentage_share) / 100);
1114 1110
 
1115 1111
 		$final_percentage = $update_count_percentages + $upgrade_percentage;
1116 1112
 
1117 1113
 		return $this->is_doing_updates() ?
1118
-			( absint( $final_percentage ) ?
1119
-				absint( $final_percentage ) :
1120
-				round( $final_percentage, 2 )
1121
-			) :
1122
-			0;
1114
+			(absint($final_percentage) ?
1115
+				absint($final_percentage) : round($final_percentage, 2)
1116
+			) : 0;
1123 1117
 	}
1124 1118
 
1125 1119
 
@@ -1131,8 +1125,8 @@  discard block
 block discarded – undo
1131 1125
 	 * @return array
1132 1126
 	 */
1133 1127
 	public function get_update_ids() {
1134
-		$all_updates    = $this->get_updates( 'database', 'all' );
1135
-		$all_update_ids = wp_list_pluck( $all_updates, 'id' );
1128
+		$all_updates    = $this->get_updates('database', 'all');
1129
+		$all_update_ids = wp_list_pluck($all_updates, 'id');
1136 1130
 
1137 1131
 		return $all_update_ids;
1138 1132
 	}
@@ -1147,10 +1141,9 @@  discard block
 block discarded – undo
1147 1141
 	 *
1148 1142
 	 * @return float|int
1149 1143
 	 */
1150
-	public function get_offset( $process_item_count ) {
1151
-		return ( 1 === $this->step ) ?
1152
-			0 :
1153
-			( $this->step - 1 ) * $process_item_count;
1144
+	public function get_offset($process_item_count) {
1145
+		return (1 === $this->step) ?
1146
+			0 : ($this->step - 1) * $process_item_count;
1154 1147
 	}
1155 1148
 }
1156 1149
 
Please login to merge, or discard this patch.
includes/class-give-donate-form.php 1 patch
Spacing   +136 added lines, -136 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
 
@@ -348,11 +348,11 @@  discard block
 block discarded – undo
348 348
 	 * @param  int|bool $_id   Post id. Default is false.
349 349
 	 * @param  array    $_args Arguments passed.
350 350
 	 */
351
-	public function __construct( $_id = false, $_args = array() ) {
351
+	public function __construct($_id = false, $_args = array()) {
352 352
 
353
-		$donation_form = WP_Post::get_instance( $_id );
353
+		$donation_form = WP_Post::get_instance($_id);
354 354
 
355
-		return $this->setup_donation_form( $donation_form );
355
+		return $this->setup_donation_form($donation_form);
356 356
 	}
357 357
 
358 358
 	/**
@@ -365,23 +365,23 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @return bool                   If the setup was successful or not.
367 367
 	 */
368
-	private function setup_donation_form( $donation_form ) {
368
+	private function setup_donation_form($donation_form) {
369 369
 
370
-		if ( ! is_object( $donation_form ) ) {
370
+		if ( ! is_object($donation_form)) {
371 371
 			return false;
372 372
 		}
373 373
 
374
-		if ( ! is_a( $donation_form, 'WP_Post' ) ) {
374
+		if ( ! is_a($donation_form, 'WP_Post')) {
375 375
 			return false;
376 376
 		}
377 377
 
378
-		if ( 'give_forms' !== $donation_form->post_type ) {
378
+		if ('give_forms' !== $donation_form->post_type) {
379 379
 			return false;
380 380
 		}
381 381
 
382
-		foreach ( $donation_form as $key => $value ) {
382
+		foreach ($donation_form as $key => $value) {
383 383
 
384
-			switch ( $key ) {
384
+			switch ($key) {
385 385
 
386 386
 				default:
387 387
 					$this->$key = $value;
@@ -405,16 +405,16 @@  discard block
 block discarded – undo
405 405
 	 *
406 406
 	 * @return mixed
407 407
 	 */
408
-	public function __get( $key ) {
408
+	public function __get($key) {
409 409
 
410
-		if ( method_exists( $this, 'get_' . $key ) ) {
410
+		if (method_exists($this, 'get_'.$key)) {
411 411
 
412
-			return call_user_func( array( $this, 'get_' . $key ) );
412
+			return call_user_func(array($this, 'get_'.$key));
413 413
 
414 414
 		} else {
415 415
 
416 416
 			/* translators: %s: property key */
417
-			return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) );
417
+			return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key));
418 418
 
419 419
 		}
420 420
 
@@ -430,30 +430,30 @@  discard block
 block discarded – undo
430 430
 	 *
431 431
 	 * @return bool|int    False if data isn't passed and class not instantiated for creation, or New Form ID.
432 432
 	 */
433
-	public function create( $data = array() ) {
433
+	public function create($data = array()) {
434 434
 
435
-		if ( $this->id != 0 ) {
435
+		if ($this->id != 0) {
436 436
 			return false;
437 437
 		}
438 438
 
439 439
 		$defaults = array(
440 440
 			'post_type'   => 'give_forms',
441 441
 			'post_status' => 'draft',
442
-			'post_title'  => __( 'New Donation Form', 'give' ),
442
+			'post_title'  => __('New Donation Form', 'give'),
443 443
 		);
444 444
 
445
-		$args = wp_parse_args( $data, $defaults );
445
+		$args = wp_parse_args($data, $defaults);
446 446
 
447 447
 		/**
448 448
 		 * Fired before a donation form is created
449 449
 		 *
450 450
 		 * @param array $args The post object arguments used for creation.
451 451
 		 */
452
-		do_action( 'give_form_pre_create', $args );
452
+		do_action('give_form_pre_create', $args);
453 453
 
454
-		$id = wp_insert_post( $args, true );
454
+		$id = wp_insert_post($args, true);
455 455
 
456
-		$donation_form = WP_Post::get_instance( $id );
456
+		$donation_form = WP_Post::get_instance($id);
457 457
 
458 458
 		/**
459 459
 		 * Fired after a donation form is created
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 		 * @param int   $id   The post ID of the created item.
462 462
 		 * @param array $args The post object arguments used for creation.
463 463
 		 */
464
-		do_action( 'give_form_post_create', $id, $args );
464
+		do_action('give_form_post_create', $id, $args);
465 465
 
466
-		return $this->setup_donation_form( $donation_form );
466
+		return $this->setup_donation_form($donation_form);
467 467
 
468 468
 	}
469 469
 
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 	 * @return string Donation form name.
489 489
 	 */
490 490
 	public function get_name() {
491
-		return get_the_title( $this->ID );
491
+		return get_the_title($this->ID);
492 492
 	}
493 493
 
494 494
 	/**
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	 */
502 502
 	public function get_price() {
503 503
 
504
-		if ( ! isset( $this->price ) ) {
504
+		if ( ! isset($this->price)) {
505 505
 
506 506
 			$this->price = give_maybe_sanitize_amount(
507 507
 				give_get_meta(
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 				)
512 512
 			);
513 513
 
514
-			if ( ! $this->price ) {
514
+			if ( ! $this->price) {
515 515
 				$this->price = 0;
516 516
 			}
517 517
 
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 		 * @param string     $price The donation form price.
526 526
 		 * @param string|int $id    The form ID.
527 527
 		 */
528
-		return apply_filters( 'give_get_set_price', $this->price, $this->ID );
528
+		return apply_filters('give_get_set_price', $this->price, $this->ID);
529 529
 	}
530 530
 
531 531
 	/**
@@ -538,22 +538,22 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	public function get_minimum_price() {
540 540
 
541
-		if ( ! isset( $this->minimum_price ) ) {
541
+		if ( ! isset($this->minimum_price)) {
542 542
 
543
-			$this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_range_minimum', true );
543
+			$this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_range_minimum', true);
544 544
 
545 545
 			// Give backward < 2.1
546
-			if ( empty( $this->minimum_price ) ) {
547
-				$this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true );
546
+			if (empty($this->minimum_price)) {
547
+				$this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true);
548 548
 			}
549 549
 
550
-			if ( ! $this->is_custom_price_mode() ) {
551
-				$this->minimum_price = give_get_lowest_price_option( $this->ID );
550
+			if ( ! $this->is_custom_price_mode()) {
551
+				$this->minimum_price = give_get_lowest_price_option($this->ID);
552 552
 			}
553 553
 
554 554
 		}
555 555
 
556
-		return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID );
556
+		return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID);
557 557
 	}
558 558
 
559 559
 	/**
@@ -566,15 +566,15 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	public function get_maximum_price() {
568 568
 
569
-		if ( ! isset( $this->maximum_price ) ) {
570
-			$this->maximum_price = give_get_meta( $this->ID, '_give_custom_amount_range_maximum', true, 999999.99 );
569
+		if ( ! isset($this->maximum_price)) {
570
+			$this->maximum_price = give_get_meta($this->ID, '_give_custom_amount_range_maximum', true, 999999.99);
571 571
 
572
-			if ( ! $this->is_custom_price_mode() ) {
572
+			if ( ! $this->is_custom_price_mode()) {
573 573
 				$this->maximum_price = give_get_highest_price_option();
574 574
 			}
575 575
 		}
576 576
 
577
-		return apply_filters( 'give_get_set_maximum_price', $this->maximum_price, $this->ID );
577
+		return apply_filters('give_get_set_maximum_price', $this->maximum_price, $this->ID);
578 578
 	}
579 579
 
580 580
 	/**
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
 	 */
588 588
 	public function get_prices() {
589 589
 
590
-		if ( ! isset( $this->prices ) ) {
590
+		if ( ! isset($this->prices)) {
591 591
 
592
-			$this->prices = give_get_meta( $this->ID, '_give_donation_levels', true );
592
+			$this->prices = give_get_meta($this->ID, '_give_donation_levels', true);
593 593
 
594 594
 		}
595 595
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		 * @param array      $prices The array of mulit-level prices.
602 602
 		 * @param int|string $ID     The ID of the form.
603 603
 		 */
604
-		return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID );
604
+		return apply_filters('give_get_donation_levels', $this->prices, $this->ID);
605 605
 
606 606
 	}
607 607
 
@@ -615,18 +615,18 @@  discard block
 block discarded – undo
615 615
 	 *
616 616
 	 * @return array|null
617 617
 	 */
618
-	public function get_level_info( $price_id ) {
618
+	public function get_level_info($price_id) {
619 619
 		$level_info = array();
620 620
 
621 621
 		// Bailout.
622
-		if ( 'multi' !== $this->get_type() ) {
622
+		if ('multi' !== $this->get_type()) {
623 623
 			return null;
624
-		} elseif ( ! ( $levels = $this->get_prices() ) ) {
624
+		} elseif ( ! ($levels = $this->get_prices())) {
625 625
 			return $level_info;
626 626
 		}
627 627
 
628
-		foreach ( $levels as $level ) {
629
-			if ( $price_id === $level['_give_id']['level_id'] ) {
628
+		foreach ($levels as $level) {
629
+			if ($price_id === $level['_give_id']['level_id']) {
630 630
 				$level_info = $level;
631 631
 				break;
632 632
 			}
@@ -646,25 +646,25 @@  discard block
 block discarded – undo
646 646
 	 */
647 647
 	public function get_goal() {
648 648
 
649
-		if ( ! isset( $this->goal ) ) {
649
+		if ( ! isset($this->goal)) {
650 650
 
651
-			$goal_format = give_get_form_goal_format( $this->ID );
651
+			$goal_format = give_get_form_goal_format($this->ID);
652 652
 
653
-			if ( 'donation' === $goal_format ) {
654
-				$this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true );
655
-			} elseif ( 'donors' === $goal_format ) {
656
-				$this->goal = give_get_meta( $this->ID, '_give_number_of_donor_goal', true );
653
+			if ('donation' === $goal_format) {
654
+				$this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true);
655
+			} elseif ('donors' === $goal_format) {
656
+				$this->goal = give_get_meta($this->ID, '_give_number_of_donor_goal', true);
657 657
 			} else {
658
-				$this->goal = give_get_meta( $this->ID, '_give_set_goal', true );
658
+				$this->goal = give_get_meta($this->ID, '_give_set_goal', true);
659 659
 			}
660 660
 
661
-			if ( ! $this->goal ) {
661
+			if ( ! $this->goal) {
662 662
 				$this->goal = 0;
663 663
 			}
664 664
 
665 665
 		}
666 666
 
667
-		return apply_filters( 'give_get_set_goal', $this->goal, $this->ID );
667
+		return apply_filters('give_get_set_goal', $this->goal, $this->ID);
668 668
 
669 669
 	}
670 670
 
@@ -678,10 +678,10 @@  discard block
 block discarded – undo
678 678
 	 */
679 679
 	public function is_single_price_mode() {
680 680
 
681
-		$option = give_get_meta( $this->ID, '_give_price_option', true );
681
+		$option = give_get_meta($this->ID, '_give_price_option', true);
682 682
 		$ret    = 0;
683 683
 
684
-		if ( empty( $option ) || $option === 'set' ) {
684
+		if (empty($option) || $option === 'set') {
685 685
 			$ret = 1;
686 686
 		}
687 687
 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 		 * @param bool       $ret Is donation form in single price mode?
694 694
 		 * @param int|string $ID  The ID of the donation form.
695 695
 		 */
696
-		return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID );
696
+		return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID);
697 697
 
698 698
 	}
699 699
 
@@ -707,10 +707,10 @@  discard block
 block discarded – undo
707 707
 	 */
708 708
 	public function is_custom_price_mode() {
709 709
 
710
-		$option = give_get_meta( $this->ID, '_give_custom_amount', true );
710
+		$option = give_get_meta($this->ID, '_give_custom_amount', true);
711 711
 		$ret    = 0;
712 712
 
713
-		if ( give_is_setting_enabled( $option ) ) {
713
+		if (give_is_setting_enabled($option)) {
714 714
 			$ret = 1;
715 715
 		}
716 716
 
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 		 * @param bool       $ret Is donation form in custom price mode?
723 723
 		 * @param int|string $ID  The ID of the donation form.
724 724
 		 */
725
-		return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID );
725
+		return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID);
726 726
 
727 727
 	}
728 728
 
@@ -736,20 +736,20 @@  discard block
 block discarded – undo
736 736
 	 *
737 737
 	 * @return bool
738 738
 	 */
739
-	public function is_custom_price( $amount ) {
739
+	public function is_custom_price($amount) {
740 740
 		$result = false;
741
-		$amount = give_maybe_sanitize_amount( $amount );
741
+		$amount = give_maybe_sanitize_amount($amount);
742 742
 
743
-		if ( $this->is_custom_price_mode() ) {
743
+		if ($this->is_custom_price_mode()) {
744 744
 
745
-			if ( 'set' === $this->get_type() ) {
746
-				if ( $amount !== $this->get_price() ) {
745
+			if ('set' === $this->get_type()) {
746
+				if ($amount !== $this->get_price()) {
747 747
 					$result = true;
748 748
 				}
749 749
 
750
-			} elseif ( 'multi' === $this->get_type() ) {
751
-				$level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) );
752
-				$result        = ! in_array( $amount, $level_amounts );
750
+			} elseif ('multi' === $this->get_type()) {
751
+				$level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount'));
752
+				$result        = ! in_array($amount, $level_amounts);
753 753
 			}
754 754
 		}
755 755
 
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
 		 *
763 763
 		 * @since 1.8.18
764 764
 		 */
765
-		return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID );
765
+		return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID);
766 766
 	}
767 767
 
768 768
 	/**
@@ -777,10 +777,10 @@  discard block
 block discarded – undo
777 777
 	 */
778 778
 	public function has_variable_prices() {
779 779
 
780
-		$option = give_get_meta( $this->ID, '_give_price_option', true );
780
+		$option = give_get_meta($this->ID, '_give_price_option', true);
781 781
 		$ret    = 0;
782 782
 
783
-		if ( $option === 'multi' ) {
783
+		if ($option === 'multi') {
784 784
 			$ret = 1;
785 785
 		}
786 786
 
@@ -790,7 +790,7 @@  discard block
 block discarded – undo
790 790
 		 * @param bool       $ret Does donation form have variable prices?
791 791
 		 * @param int|string $ID  The ID of the donation form.
792 792
 		 */
793
-		return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID );
793
+		return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID);
794 794
 
795 795
 	}
796 796
 
@@ -804,17 +804,17 @@  discard block
 block discarded – undo
804 804
 	 */
805 805
 	public function get_type() {
806 806
 
807
-		if ( ! isset( $this->type ) ) {
807
+		if ( ! isset($this->type)) {
808 808
 
809
-			$this->type = give_get_meta( $this->ID, '_give_price_option', true );
809
+			$this->type = give_get_meta($this->ID, '_give_price_option', true);
810 810
 
811
-			if ( empty( $this->type ) ) {
811
+			if (empty($this->type)) {
812 812
 				$this->type = 'set';
813 813
 			}
814 814
 
815 815
 		}
816 816
 
817
-		return apply_filters( 'give_get_form_type', $this->type, $this->ID );
817
+		return apply_filters('give_get_form_type', $this->type, $this->ID);
818 818
 
819 819
 	}
820 820
 
@@ -830,23 +830,23 @@  discard block
 block discarded – undo
830 830
 	 *
831 831
 	 * @return string
832 832
 	 */
833
-	public function get_form_classes( $args ) {
833
+	public function get_form_classes($args) {
834 834
 
835
-		$float_labels_option = give_is_float_labels_enabled( $args )
835
+		$float_labels_option = give_is_float_labels_enabled($args)
836 836
 			? 'float-labels-enabled'
837 837
 			: '';
838 838
 
839
-		$form_classes_array = apply_filters( 'give_form_classes', array(
839
+		$form_classes_array = apply_filters('give_form_classes', array(
840 840
 			'give-form',
841
-			'give-form-' . $this->ID,
842
-			'give-form-type-' . $this->get_type(),
841
+			'give-form-'.$this->ID,
842
+			'give-form-type-'.$this->get_type(),
843 843
 			$float_labels_option,
844
-		), $this->ID, $args );
844
+		), $this->ID, $args);
845 845
 
846 846
 		// Remove empty class names.
847
-		$form_classes_array = array_filter( $form_classes_array );
847
+		$form_classes_array = array_filter($form_classes_array);
848 848
 
849
-		return implode( ' ', $form_classes_array );
849
+		return implode(' ', $form_classes_array);
850 850
 
851 851
 	}
852 852
 
@@ -861,22 +861,22 @@  discard block
 block discarded – undo
861 861
 	 *
862 862
 	 * @return string
863 863
 	 */
864
-	public function get_form_wrap_classes( $args ) {
864
+	public function get_form_wrap_classes($args) {
865 865
 		$custom_class = array(
866 866
 			'give-form-wrap',
867 867
 		);
868 868
 
869
-		if ( $this->is_close_donation_form() ) {
869
+		if ($this->is_close_donation_form()) {
870 870
 			$custom_class[] = 'give-form-closed';
871 871
 		} else {
872
-			$display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) )
872
+			$display_option = (isset($args['display_style']) && ! empty($args['display_style']))
873 873
 				? $args['display_style']
874
-				: give_get_meta( $this->ID, '_give_payment_display', true );
874
+				: give_get_meta($this->ID, '_give_payment_display', true);
875 875
 
876 876
 			$custom_class[] = "give-display-{$display_option}";
877 877
 
878 878
 			// If admin want to show only button for form then user inbuilt modal functionality.
879
-			if ( 'button' === $display_option ) {
879
+			if ('button' === $display_option) {
880 880
 				$custom_class[] = 'give-display-button-only';
881 881
 			}
882 882
 		}
@@ -887,10 +887,10 @@  discard block
 block discarded – undo
887 887
 		 *
888 888
 		 * @since 1.0
889 889
 		 */
890
-		$form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args );
890
+		$form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args);
891 891
 
892 892
 
893
-		return implode( ' ', $form_wrap_classes_array );
893
+		return implode(' ', $form_wrap_classes_array);
894 894
 
895 895
 	}
896 896
 
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 	public function is_set_type_donation_form() {
906 906
 		$form_type = $this->get_type();
907 907
 
908
-		return ( 'set' === $form_type ? true : false );
908
+		return ('set' === $form_type ? true : false);
909 909
 	}
910 910
 
911 911
 	/**
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 	public function is_multi_type_donation_form() {
920 920
 		$form_type = $this->get_type();
921 921
 
922
-		return ( 'multi' === $form_type ? true : false );
922
+		return ('multi' === $form_type ? true : false);
923 923
 
924 924
 	}
925 925
 
@@ -933,15 +933,15 @@  discard block
 block discarded – undo
933 933
 	 */
934 934
 	public function get_sales() {
935 935
 
936
-		if ( ! isset( $this->sales ) ) {
936
+		if ( ! isset($this->sales)) {
937 937
 
938
-			if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) {
939
-				add_post_meta( $this->ID, '_give_form_sales', 0 );
938
+			if ('' == give_get_meta($this->ID, '_give_form_sales', true)) {
939
+				add_post_meta($this->ID, '_give_form_sales', 0);
940 940
 			} // End if
941 941
 
942
-			$this->sales = give_get_meta( $this->ID, '_give_form_sales', true );
942
+			$this->sales = give_get_meta($this->ID, '_give_form_sales', true);
943 943
 
944
-			if ( $this->sales < 0 ) {
944
+			if ($this->sales < 0) {
945 945
 				// Never let sales be less than zero.
946 946
 				$this->sales = 0;
947 947
 			}
@@ -962,13 +962,13 @@  discard block
 block discarded – undo
962 962
 	 *
963 963
 	 * @return int|false     New number of total sales.
964 964
 	 */
965
-	public function increase_sales( $quantity = 1 ) {
965
+	public function increase_sales($quantity = 1) {
966 966
 
967
-		$sales       = give_get_form_sales_stats( $this->ID );
968
-		$quantity    = absint( $quantity );
967
+		$sales       = give_get_form_sales_stats($this->ID);
968
+		$quantity    = absint($quantity);
969 969
 		$total_sales = $sales + $quantity;
970 970
 
971
-		if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
971
+		if ($this->update_meta('_give_form_sales', $total_sales)) {
972 972
 
973 973
 			$this->sales = $total_sales;
974 974
 
@@ -989,17 +989,17 @@  discard block
 block discarded – undo
989 989
 	 *
990 990
 	 * @return int|false     New number of total sales.
991 991
 	 */
992
-	public function decrease_sales( $quantity = 1 ) {
992
+	public function decrease_sales($quantity = 1) {
993 993
 
994
-		$sales = give_get_form_sales_stats( $this->ID );
994
+		$sales = give_get_form_sales_stats($this->ID);
995 995
 
996 996
 		// Only decrease if not already zero
997
-		if ( $sales > 0 ) {
997
+		if ($sales > 0) {
998 998
 
999
-			$quantity    = absint( $quantity );
999
+			$quantity    = absint($quantity);
1000 1000
 			$total_sales = $sales - $quantity;
1001 1001
 
1002
-			if ( $this->update_meta( '_give_form_sales', $total_sales ) ) {
1002
+			if ($this->update_meta('_give_form_sales', $total_sales)) {
1003 1003
 
1004 1004
 				$this->sales = $sales;
1005 1005
 
@@ -1023,15 +1023,15 @@  discard block
 block discarded – undo
1023 1023
 	 */
1024 1024
 	public function get_earnings() {
1025 1025
 
1026
-		if ( ! isset( $this->earnings ) ) {
1026
+		if ( ! isset($this->earnings)) {
1027 1027
 
1028
-			if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) {
1029
-				add_post_meta( $this->ID, '_give_form_earnings', 0 );
1028
+			if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) {
1029
+				add_post_meta($this->ID, '_give_form_earnings', 0);
1030 1030
 			}
1031 1031
 
1032
-			$this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true );
1032
+			$this->earnings = give_get_meta($this->ID, '_give_form_earnings', true);
1033 1033
 
1034
-			if ( $this->earnings < 0 ) {
1034
+			if ($this->earnings < 0) {
1035 1035
 				// Never let earnings be less than zero
1036 1036
 				$this->earnings = 0;
1037 1037
 			}
@@ -1055,9 +1055,9 @@  discard block
 block discarded – undo
1055 1055
 	 *
1056 1056
 	 * @return float|false
1057 1057
 	 */
1058
-	public function increase_earnings( $amount = 0, $payment_id = 0 ) {
1058
+	public function increase_earnings($amount = 0, $payment_id = 0) {
1059 1059
 
1060
-		$earnings   = give_get_form_earnings_stats( $this->ID );
1060
+		$earnings = give_get_form_earnings_stats($this->ID);
1061 1061
 
1062 1062
 		/**
1063 1063
 		 * Modify the earning amount when increasing.
@@ -1068,11 +1068,11 @@  discard block
 block discarded – undo
1068 1068
 		 * @param int   $form_id    Donation form ID.
1069 1069
 		 * @param int   $payment_id Donation ID.
1070 1070
 		 */
1071
-		$amount = apply_filters( 'give_increase_form_earnings_amount', $amount, $this->ID, $payment_id );
1071
+		$amount = apply_filters('give_increase_form_earnings_amount', $amount, $this->ID, $payment_id);
1072 1072
 
1073 1073
 		$new_amount = $earnings + (float) $amount;
1074 1074
 
1075
-		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
1075
+		if ($this->update_meta('_give_form_earnings', $new_amount)) {
1076 1076
 
1077 1077
 			$this->earnings = $new_amount;
1078 1078
 
@@ -1095,11 +1095,11 @@  discard block
 block discarded – undo
1095 1095
 	 *
1096 1096
 	 * @return float|false
1097 1097
 	 */
1098
-	public function decrease_earnings( $amount, $payment_id = 0 ) {
1098
+	public function decrease_earnings($amount, $payment_id = 0) {
1099 1099
 
1100
-		$earnings = give_get_form_earnings_stats( $this->ID );
1100
+		$earnings = give_get_form_earnings_stats($this->ID);
1101 1101
 
1102
-		if ( $earnings > 0 ) {
1102
+		if ($earnings > 0) {
1103 1103
 
1104 1104
 			/**
1105 1105
 			 * Modify the earning value when decreasing it.
@@ -1110,12 +1110,12 @@  discard block
 block discarded – undo
1110 1110
 			 * @param int   $form_id    Donation Form ID.
1111 1111
 			 * @param int   $payment_id Donation ID.
1112 1112
 			 */
1113
-			$amount = apply_filters( 'give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id );
1113
+			$amount = apply_filters('give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id);
1114 1114
 
1115 1115
 			// Only decrease if greater than zero
1116 1116
 			$new_amount = $earnings - (float) $amount;
1117 1117
 
1118
-			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
1118
+			if ($this->update_meta('_give_form_earnings', $new_amount)) {
1119 1119
 				$this->earnings = $new_amount;
1120 1120
 
1121 1121
 				return $this->earnings;
@@ -1141,10 +1141,10 @@  discard block
 block discarded – undo
1141 1141
 	 * @return bool
1142 1142
 	 */
1143 1143
 	public function is_close_donation_form() {
1144
-		$is_closed = ( 'closed' === give_get_meta( $this->ID, '_give_form_status', true, 'open' ) );
1144
+		$is_closed = ('closed' === give_get_meta($this->ID, '_give_form_status', true, 'open'));
1145 1145
 
1146 1146
 		// If manual upgrade not completed, proceed with backward compatible code.
1147
-		if ( ! give_has_upgrade_completed( 'v210_verify_form_status_upgrades' ) ) {
1147
+		if ( ! give_has_upgrade_completed('v210_verify_form_status_upgrades')) {
1148 1148
 
1149 1149
 			// Check for backward compatibility.
1150 1150
 			$is_closed = $this->bc_210_is_close_donation_form();
@@ -1174,17 +1174,17 @@  discard block
 block discarded – undo
1174 1174
 	 *
1175 1175
 	 * @return bool                            The result of the update query.
1176 1176
 	 */
1177
-	private function update_meta( $meta_key = '', $meta_value = '' ) {
1177
+	private function update_meta($meta_key = '', $meta_value = '') {
1178 1178
 
1179 1179
 		/* @var WPDB $wpdb */
1180 1180
 		global $wpdb;
1181 1181
 
1182 1182
 		// Bailout.
1183
-		if ( empty( $meta_key ) ) {
1183
+		if (empty($meta_key)) {
1184 1184
 			return false;
1185 1185
 		}
1186 1186
 
1187
-		if ( give_update_meta( $this->ID, $meta_key, $meta_value ) ) {
1187
+		if (give_update_meta($this->ID, $meta_key, $meta_value)) {
1188 1188
 			return true;
1189 1189
 		}
1190 1190
 
@@ -1201,33 +1201,33 @@  discard block
 block discarded – undo
1201 1201
 	private function bc_210_is_close_donation_form() {
1202 1202
 
1203 1203
 		$close_form      = false;
1204
-		$is_goal_enabled = give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true, 'disabled' ) );
1204
+		$is_goal_enabled = give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true, 'disabled'));
1205 1205
 
1206 1206
 		// Proceed, if the form goal is enabled.
1207
-		if ( $is_goal_enabled ) {
1207
+		if ($is_goal_enabled) {
1208 1208
 
1209
-			$close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true, 'disabled' ) );
1209
+			$close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true, 'disabled'));
1210 1210
 
1211 1211
 			// Proceed, if close form when goal achieved option is enabled.
1212
-			if ( $close_form_when_goal_achieved ) {
1212
+			if ($close_form_when_goal_achieved) {
1213 1213
 
1214
-				$form        = new Give_Donate_Form( $this->ID );
1215
-				$goal_format = give_get_form_goal_format( $this->ID );
1214
+				$form        = new Give_Donate_Form($this->ID);
1215
+				$goal_format = give_get_form_goal_format($this->ID);
1216 1216
 
1217 1217
 				// Verify whether the form is closed or not after processing data based on goal format.
1218
-				switch ( $goal_format ) {
1218
+				switch ($goal_format) {
1219 1219
 					case 'donation':
1220 1220
 						$closed = $form->get_goal() <= $form->get_sales();
1221 1221
 						break;
1222 1222
 					case 'donors':
1223
-						$closed = $form->get_goal() <= give_get_form_donor_count( $this->ID );
1223
+						$closed = $form->get_goal() <= give_get_form_donor_count($this->ID);
1224 1224
 						break;
1225 1225
 					default :
1226 1226
 						$closed = $form->get_goal() <= $form->get_earnings();
1227 1227
 						break;
1228 1228
 				}
1229 1229
 
1230
-				if ( $closed ) {
1230
+				if ($closed) {
1231 1231
 					$close_form = true;
1232 1232
 				}
1233 1233
 
Please login to merge, or discard this patch.
includes/class-give-stats.php 1 patch
Spacing   +106 added lines, -106 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
 
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function get_predefined_dates() {
95 95
 		$predefined = array(
96
-			'today'        => esc_html__( 'Today', 'give' ),
97
-			'yesterday'    => esc_html__( 'Yesterday', 'give' ),
98
-			'this_week'    => esc_html__( 'This Week', 'give' ),
99
-			'last_week'    => esc_html__( 'Last Week', 'give' ),
100
-			'this_month'   => esc_html__( 'This Month', 'give' ),
101
-			'last_month'   => esc_html__( 'Last Month', 'give' ),
102
-			'this_quarter' => esc_html__( 'This Quarter', 'give' ),
103
-			'last_quarter' => esc_html__( 'Last Quarter', 'give' ),
104
-			'this_year'    => esc_html__( 'This Year', 'give' ),
105
-			'last_year'    => esc_html__( 'Last Year', 'give' ),
96
+			'today'        => esc_html__('Today', 'give'),
97
+			'yesterday'    => esc_html__('Yesterday', 'give'),
98
+			'this_week'    => esc_html__('This Week', 'give'),
99
+			'last_week'    => esc_html__('Last Week', 'give'),
100
+			'this_month'   => esc_html__('This Month', 'give'),
101
+			'last_month'   => esc_html__('Last Month', 'give'),
102
+			'this_quarter' => esc_html__('This Quarter', 'give'),
103
+			'last_quarter' => esc_html__('Last Quarter', 'give'),
104
+			'this_year'    => esc_html__('This Year', 'give'),
105
+			'last_year'    => esc_html__('Last Year', 'give'),
106 106
 		);
107 107
 
108
-		return apply_filters( 'give_stats_predefined_dates', $predefined );
108
+		return apply_filters('give_stats_predefined_dates', $predefined);
109 109
 	}
110 110
 
111 111
 	/**
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @return void
123 123
 	 */
124
-	public function setup_dates( $_start_date = 'this_month', $_end_date = false ) {
124
+	public function setup_dates($_start_date = 'this_month', $_end_date = false) {
125 125
 
126
-		if ( empty( $_start_date ) ) {
126
+		if (empty($_start_date)) {
127 127
 			$_start_date = 'this_month';
128 128
 		}
129 129
 
130
-		if ( empty( $_end_date ) ) {
130
+		if (empty($_end_date)) {
131 131
 			$_end_date = $_start_date;
132 132
 		}
133 133
 
134
-		$this->start_date = $this->convert_date( $_start_date );
135
-		$this->end_date   = $this->convert_date( $_end_date, true );
134
+		$this->start_date = $this->convert_date($_start_date);
135
+		$this->end_date   = $this->convert_date($_end_date, true);
136 136
 	}
137 137
 
138 138
 	/**
@@ -148,26 +148,26 @@  discard block
 block discarded – undo
148 148
 	 *
149 149
 	 * @return array|WP_Error   If the date is invalid, a WP_Error object will be returned.
150 150
 	 */
151
-	public function convert_date( $date, $end_date = false ) {
151
+	public function convert_date($date, $end_date = false) {
152 152
 
153 153
 		$this->timestamp = false;
154 154
 		$second          = $end_date ? 59 : 0;
155 155
 		$minute          = $end_date ? 59 : 0;
156 156
 		$hour            = $end_date ? 23 : 0;
157 157
 		$day             = 1;
158
-		$month           = date( 'n', current_time( 'timestamp' ) );
159
-		$year            = date( 'Y', current_time( 'timestamp' ) );
158
+		$month           = date('n', current_time('timestamp'));
159
+		$year            = date('Y', current_time('timestamp'));
160 160
 
161
-		if ( array_key_exists( (string) $date, $this->get_predefined_dates() ) ) {
161
+		if (array_key_exists((string) $date, $this->get_predefined_dates())) {
162 162
 
163 163
 			// This is a predefined date rate, such as last_week
164
-			switch ( $date ) {
164
+			switch ($date) {
165 165
 
166 166
 				case 'this_month' :
167 167
 
168
-					if ( $end_date ) {
168
+					if ($end_date) {
169 169
 
170
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
170
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
171 171
 						$hour   = 23;
172 172
 						$minute = 59;
173 173
 						$second = 59;
@@ -177,28 +177,28 @@  discard block
 block discarded – undo
177 177
 
178 178
 				case 'last_month' :
179 179
 
180
-					if ( $month == 1 ) {
180
+					if ($month == 1) {
181 181
 
182 182
 						$month = 12;
183
-						$year --;
183
+						$year--;
184 184
 
185 185
 					} else {
186 186
 
187
-						$month --;
187
+						$month--;
188 188
 
189 189
 					}
190 190
 
191
-					if ( $end_date ) {
192
-						$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
191
+					if ($end_date) {
192
+						$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
193 193
 					}
194 194
 
195 195
 					break;
196 196
 
197 197
 				case 'today' :
198 198
 
199
-					$day = date( 'd', current_time( 'timestamp' ) );
199
+					$day = date('d', current_time('timestamp'));
200 200
 
201
-					if ( $end_date ) {
201
+					if ($end_date) {
202 202
 						$hour   = 23;
203 203
 						$minute = 59;
204 204
 						$second = 59;
@@ -208,23 +208,23 @@  discard block
 block discarded – undo
208 208
 
209 209
 				case 'yesterday' :
210 210
 
211
-					$day = date( 'd', current_time( 'timestamp' ) ) - 1;
211
+					$day = date('d', current_time('timestamp')) - 1;
212 212
 
213 213
 					// Check if Today is the first day of the month (meaning subtracting one will get us 0)
214
-					if ( $day < 1 ) {
214
+					if ($day < 1) {
215 215
 
216 216
 						// If current month is 1
217
-						if ( 1 == $month ) {
217
+						if (1 == $month) {
218 218
 
219 219
 							$year -= 1; // Today is January 1, so skip back to last day of December
220 220
 							$month = 12;
221
-							$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
221
+							$day   = cal_days_in_month(CAL_GREGORIAN, $month, $year);
222 222
 
223 223
 						} else {
224 224
 
225 225
 							// Go back one month and get the last day of the month
226 226
 							$month -= 1;
227
-							$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
227
+							$day = cal_days_in_month(CAL_GREGORIAN, $month, $year);
228 228
 
229 229
 						}
230 230
 					}
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 
234 234
 				case 'this_week' :
235 235
 
236
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
237
-					$today              = date( 'j', current_time( 'timestamp' ) ) * 60 * 60 * 24;
236
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
237
+					$today              = date('j', current_time('timestamp')) * 60 * 60 * 24;
238 238
 
239
-					if ( $today <= $days_to_week_start ) {
239
+					if ($today <= $days_to_week_start) {
240 240
 
241
-						if ( $month > 1 ) {
241
+						if ($month > 1) {
242 242
 							$month -= 1;
243 243
 						} else {
244 244
 							$month = 12;
@@ -246,19 +246,19 @@  discard block
 block discarded – undo
246 246
 
247 247
 					}
248 248
 
249
-					if ( ! $end_date ) {
249
+					if ( ! $end_date) {
250 250
 
251 251
 						// Getting the start day
252 252
 
253
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
254
-						$day += get_option( 'start_of_week' );
253
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
254
+						$day += get_option('start_of_week');
255 255
 
256 256
 					} else {
257 257
 
258 258
 						// Getting the end day
259 259
 
260
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1;
261
-						$day += get_option( 'start_of_week' ) + 6;
260
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 1;
261
+						$day += get_option('start_of_week') + 6;
262 262
 
263 263
 					}
264 264
 
@@ -266,12 +266,12 @@  discard block
 block discarded – undo
266 266
 
267 267
 				case 'last_week' :
268 268
 
269
-					$days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24;
270
-					$today              = date( 'j', current_time( 'timestamp' ) ) * 60 * 60 * 24;
269
+					$days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24;
270
+					$today              = date('j', current_time('timestamp')) * 60 * 60 * 24;
271 271
 
272
-					if ( $today <= $days_to_week_start ) {
272
+					if ($today <= $days_to_week_start) {
273 273
 
274
-						if ( $month > 1 ) {
274
+						if ($month > 1) {
275 275
 							$month -= 1;
276 276
 						} else {
277 277
 							$month = 12;
@@ -279,19 +279,19 @@  discard block
 block discarded – undo
279 279
 
280 280
 					}
281 281
 
282
-					if ( ! $end_date ) {
282
+					if ( ! $end_date) {
283 283
 
284 284
 						// Getting the start day
285 285
 
286
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
287
-						$day += get_option( 'start_of_week' );
286
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
287
+						$day += get_option('start_of_week');
288 288
 
289 289
 					} else {
290 290
 
291 291
 						// Getting the end day
292 292
 
293
-						$day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8;
294
-						$day += get_option( 'start_of_week' ) + 6;
293
+						$day = date('d', current_time('timestamp') - $days_to_week_start) - 8;
294
+						$day += get_option('start_of_week') + 6;
295 295
 
296 296
 					}
297 297
 
@@ -299,39 +299,39 @@  discard block
 block discarded – undo
299 299
 
300 300
 				case 'this_quarter' :
301 301
 
302
-					$month_now = date( 'n', current_time( 'timestamp' ) );
302
+					$month_now = date('n', current_time('timestamp'));
303 303
 
304
-					if ( $month_now <= 3 ) {
304
+					if ($month_now <= 3) {
305 305
 
306
-						if ( ! $end_date ) {
306
+						if ( ! $end_date) {
307 307
 							$month = 1;
308 308
 						} else {
309 309
 							$month  = 3;
310
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
310
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
311 311
 							$hour   = 23;
312 312
 							$minute = 59;
313 313
 							$second = 59;
314 314
 						}
315 315
 
316
-					} else if ( $month_now <= 6 ) {
316
+					} else if ($month_now <= 6) {
317 317
 
318
-						if ( ! $end_date ) {
318
+						if ( ! $end_date) {
319 319
 							$month = 4;
320 320
 						} else {
321 321
 							$month  = 6;
322
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
322
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
323 323
 							$hour   = 23;
324 324
 							$minute = 59;
325 325
 							$second = 59;
326 326
 						}
327 327
 
328
-					} else if ( $month_now <= 9 ) {
328
+					} else if ($month_now <= 9) {
329 329
 
330
-						if ( ! $end_date ) {
330
+						if ( ! $end_date) {
331 331
 							$month = 7;
332 332
 						} else {
333 333
 							$month  = 9;
334
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
334
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
335 335
 							$hour   = 23;
336 336
 							$minute = 59;
337 337
 							$second = 59;
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
 
340 340
 					} else {
341 341
 
342
-						if ( ! $end_date ) {
342
+						if ( ! $end_date) {
343 343
 							$month = 10;
344 344
 						} else {
345 345
 							$month  = 12;
346
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
346
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
347 347
 							$hour   = 23;
348 348
 							$minute = 59;
349 349
 							$second = 59;
@@ -355,40 +355,40 @@  discard block
 block discarded – undo
355 355
 
356 356
 				case 'last_quarter' :
357 357
 
358
-					$month_now = date( 'n', current_time( 'timestamp' ) );
358
+					$month_now = date('n', current_time('timestamp'));
359 359
 
360
-					if ( $month_now <= 3 ) {
360
+					if ($month_now <= 3) {
361 361
 
362
-						if ( ! $end_date ) {
362
+						if ( ! $end_date) {
363 363
 							$month = 10;
364 364
 						} else {
365 365
 							$year -= 1;
366 366
 							$month  = 12;
367
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
367
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
368 368
 							$hour   = 23;
369 369
 							$minute = 59;
370 370
 							$second = 59;
371 371
 						}
372 372
 
373
-					} else if ( $month_now <= 6 ) {
373
+					} else if ($month_now <= 6) {
374 374
 
375
-						if ( ! $end_date ) {
375
+						if ( ! $end_date) {
376 376
 							$month = 1;
377 377
 						} else {
378 378
 							$month  = 3;
379
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
379
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
380 380
 							$hour   = 23;
381 381
 							$minute = 59;
382 382
 							$second = 59;
383 383
 						}
384 384
 
385
-					} else if ( $month_now <= 9 ) {
385
+					} else if ($month_now <= 9) {
386 386
 
387
-						if ( ! $end_date ) {
387
+						if ( ! $end_date) {
388 388
 							$month = 4;
389 389
 						} else {
390 390
 							$month  = 6;
391
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
391
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
392 392
 							$hour   = 23;
393 393
 							$minute = 59;
394 394
 							$second = 59;
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
 
397 397
 					} else {
398 398
 
399
-						if ( ! $end_date ) {
399
+						if ( ! $end_date) {
400 400
 							$month = 7;
401 401
 						} else {
402 402
 							$month  = 9;
403
-							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
403
+							$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
404 404
 							$hour   = 23;
405 405
 							$minute = 59;
406 406
 							$second = 59;
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 				case 'this_year' :
414 414
 
415
-					if ( ! $end_date ) {
415
+					if ( ! $end_date) {
416 416
 						$month = 1;
417 417
 					} else {
418 418
 						$month  = 12;
419
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
419
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
420 420
 						$hour   = 23;
421 421
 						$minute = 59;
422 422
 						$second = 59;
@@ -427,11 +427,11 @@  discard block
 block discarded – undo
427 427
 				case 'last_year' :
428 428
 
429 429
 					$year -= 1;
430
-					if ( ! $end_date ) {
430
+					if ( ! $end_date) {
431 431
 						$month = 1;
432 432
 					} else {
433 433
 						$month  = 12;
434
-						$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
434
+						$day    = cal_days_in_month(CAL_GREGORIAN, $month, $year);
435 435
 						$hour   = 23;
436 436
 						$minute = 59;
437 437
 						$second = 59;
@@ -442,30 +442,30 @@  discard block
 block discarded – undo
442 442
 			}
443 443
 
444 444
 
445
-		} else if ( is_numeric( $date ) ) {
445
+		} else if (is_numeric($date)) {
446 446
 
447 447
 			// return $date unchanged since it is a timestamp
448 448
 			$this->timestamp = true;
449 449
 
450
-		} else if ( false !== strtotime( $date ) ) {
450
+		} else if (false !== strtotime($date)) {
451 451
 
452
-			$date  = strtotime( $date, current_time( 'timestamp' ) );
453
-			$year  = date( 'Y', $date );
454
-			$month = date( 'm', $date );
455
-			$day   = date( 'd', $date );
452
+			$date  = strtotime($date, current_time('timestamp'));
453
+			$year  = date('Y', $date);
454
+			$month = date('m', $date);
455
+			$day   = date('d', $date);
456 456
 
457 457
 		} else {
458 458
 
459
-			return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) );
459
+			return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give'));
460 460
 
461 461
 		}
462 462
 
463
-		if ( false === $this->timestamp ) {
463
+		if (false === $this->timestamp) {
464 464
 			// Create an exact timestamp
465
-			$date = mktime( $hour, $minute, $second, $month, $day, $year );
465
+			$date = mktime($hour, $minute, $second, $month, $day, $year);
466 466
 		}
467 467
 
468
-		return apply_filters( 'give_stats_date', $date, $end_date, $this );
468
+		return apply_filters('give_stats_date', $date, $end_date, $this);
469 469
 
470 470
 	}
471 471
 
@@ -481,33 +481,33 @@  discard block
 block discarded – undo
481 481
 	 * 
482 482
 	 * @return string
483 483
 	 */
484
-	public function count_where( $where = '' ) {
484
+	public function count_where($where = '') {
485 485
 		// Only get payments in our date range
486 486
 
487 487
 		$start_where = '';
488 488
 		$end_where   = '';
489 489
 
490
-		if ( $this->start_date ) {
490
+		if ($this->start_date) {
491 491
 
492
-			if ( $this->timestamp ) {
492
+			if ($this->timestamp) {
493 493
 				$format = 'Y-m-d H:i:s';
494 494
 			} else {
495 495
 				$format = 'Y-m-d 00:00:00';
496 496
 			}
497 497
 
498
-			$start_date  = date( $format, $this->start_date );
498
+			$start_date  = date($format, $this->start_date);
499 499
 			$start_where = " AND p.post_date >= '{$start_date}'";
500 500
 		}
501 501
 
502
-		if ( $this->end_date ) {
502
+		if ($this->end_date) {
503 503
 
504
-			if ( $this->timestamp ) {
504
+			if ($this->timestamp) {
505 505
 				$format = 'Y-m-d H:i:s';
506 506
 			} else {
507 507
 				$format = 'Y-m-d 23:59:59';
508 508
 			}
509 509
 
510
-			$end_date = date( $format, $this->end_date );
510
+			$end_date = date($format, $this->end_date);
511 511
 
512 512
 			$end_where = " AND p.post_date <= '{$end_date}'";
513 513
 		}
@@ -529,34 +529,34 @@  discard block
 block discarded – undo
529 529
 	 *
530 530
 	 * @return string
531 531
 	 */
532
-	public function payments_where( $where = '' ) {
532
+	public function payments_where($where = '') {
533 533
 
534 534
 		global $wpdb;
535 535
 
536 536
 		$start_where = '';
537 537
 		$end_where   = '';
538 538
 
539
-		if ( ! is_wp_error( $this->start_date ) ) {
539
+		if ( ! is_wp_error($this->start_date)) {
540 540
 
541
-			if ( $this->timestamp ) {
541
+			if ($this->timestamp) {
542 542
 				$format = 'Y-m-d H:i:s';
543 543
 			} else {
544 544
 				$format = 'Y-m-d 00:00:00';
545 545
 			}
546 546
 
547
-			$start_date  = date( $format, $this->start_date );
547
+			$start_date  = date($format, $this->start_date);
548 548
 			$start_where = " AND $wpdb->posts.post_date >= '{$start_date}'";
549 549
 		}
550 550
 
551
-		if ( ! is_wp_error( $this->end_date ) ) {
551
+		if ( ! is_wp_error($this->end_date)) {
552 552
 
553
-			if ( $this->timestamp ) {
553
+			if ($this->timestamp) {
554 554
 				$format = 'Y-m-d H:i:s';
555 555
 			} else {
556 556
 				$format = 'Y-m-d 23:59:59';
557 557
 			}
558 558
 
559
-			$end_date = date( $format, $this->end_date );
559
+			$end_date = date($format, $this->end_date);
560 560
 
561 561
 			$end_where = " AND $wpdb->posts.post_date <= '{$end_date}'";
562 562
 		}
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
  */
40 40
 
41 41
 // Exit if accessed directly.
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if ( ! defined('ABSPATH')) {
43 43
 	exit;
44 44
 }
45 45
 
46
-if ( ! class_exists( 'Give' ) ) :
46
+if ( ! class_exists('Give')) :
47 47
 
48 48
 	/**
49 49
 	 * Main Give Class
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		 * @return    Give
262 262
 		 */
263 263
 		public static function instance() {
264
-			if ( is_null( self::$_instance ) ) {
264
+			if (is_null(self::$_instance)) {
265 265
 				self::$_instance = new self();
266 266
 			}
267 267
 
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
 		 */
274 274
 		public function __construct() {
275 275
 			// PHP version
276
-			if ( ! defined( 'GIVE_REQUIRED_PHP_VERSION' ) ) {
277
-				define( 'GIVE_REQUIRED_PHP_VERSION', '5.3' );
276
+			if ( ! defined('GIVE_REQUIRED_PHP_VERSION')) {
277
+				define('GIVE_REQUIRED_PHP_VERSION', '5.3');
278 278
 			}
279 279
 
280 280
 			// Bailout: Need minimum php version to load plugin.
281
-			if ( function_exists( 'phpversion' ) && version_compare( GIVE_REQUIRED_PHP_VERSION, phpversion(), '>' ) ) {
282
-				add_action( 'admin_notices', array( $this, 'minimum_phpversion_notice' ) );
281
+			if (function_exists('phpversion') && version_compare(GIVE_REQUIRED_PHP_VERSION, phpversion(), '>')) {
282
+				add_action('admin_notices', array($this, 'minimum_phpversion_notice'));
283 283
 
284 284
 				return;
285 285
 			}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			$this->includes();
289 289
 			$this->init_hooks();
290 290
 
291
-			do_action( 'give_loaded' );
291
+			do_action('give_loaded');
292 292
 		}
293 293
 
294 294
 		/**
@@ -297,11 +297,11 @@  discard block
 block discarded – undo
297 297
 		 * @since  1.8.9
298 298
 		 */
299 299
 		private function init_hooks() {
300
-			register_activation_hook( GIVE_PLUGIN_FILE, 'give_install' );
301
-			add_action( 'plugins_loaded', array( $this, 'init' ), 0 );
300
+			register_activation_hook(GIVE_PLUGIN_FILE, 'give_install');
301
+			add_action('plugins_loaded', array($this, 'init'), 0);
302 302
 
303 303
 			// Set up localization on init Hook.
304
-			add_action( 'init', array( $this, 'load_textdomain' ), 0 );
304
+			add_action('init', array($this, 'load_textdomain'), 0);
305 305
 		}
306 306
 
307 307
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 			 *
318 318
 			 * @since 1.8.9
319 319
 			 */
320
-			do_action( 'before_give_init' );
320
+			do_action('before_give_init');
321 321
 
322 322
 			// Set up localization.
323 323
 			$this->load_textdomain();
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			 *
351 351
 			 * @since 1.8.7
352 352
 			 */
353
-			do_action( 'give_init', $this );
353
+			do_action('give_init', $this);
354 354
 
355 355
 		}
356 356
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 		 */
368 368
 		public function __clone() {
369 369
 			// Cloning instances of the class is forbidden.
370
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
370
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
371 371
 		}
372 372
 
373 373
 		/**
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 		 */
381 381
 		public function __wakeup() {
382 382
 			// Unserializing instances of the class is forbidden.
383
-			give_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
383
+			give_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
384 384
 		}
385 385
 
386 386
 		/**
@@ -394,33 +394,33 @@  discard block
 block discarded – undo
394 394
 		private function setup_constants() {
395 395
 
396 396
 			// Plugin version
397
-			if ( ! defined( 'GIVE_VERSION' ) ) {
398
-				define( 'GIVE_VERSION', '2.1.1' );
397
+			if ( ! defined('GIVE_VERSION')) {
398
+				define('GIVE_VERSION', '2.1.1');
399 399
 			}
400 400
 
401 401
 			// Plugin Root File
402
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
403
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
402
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
403
+				define('GIVE_PLUGIN_FILE', __FILE__);
404 404
 			}
405 405
 
406 406
 			// Plugin Folder Path
407
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
408
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( GIVE_PLUGIN_FILE ) );
407
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
408
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(GIVE_PLUGIN_FILE));
409 409
 			}
410 410
 
411 411
 			// Plugin Folder URL
412
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
413
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( GIVE_PLUGIN_FILE ) );
412
+			if ( ! defined('GIVE_PLUGIN_URL')) {
413
+				define('GIVE_PLUGIN_URL', plugin_dir_url(GIVE_PLUGIN_FILE));
414 414
 			}
415 415
 
416 416
 			// Plugin Basename aka: "give/give.php"
417
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
418
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( GIVE_PLUGIN_FILE ) );
417
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
418
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(GIVE_PLUGIN_FILE));
419 419
 			}
420 420
 
421 421
 			// Make sure CAL_GREGORIAN is defined
422
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
423
-				define( 'CAL_GREGORIAN', 1 );
422
+			if ( ! defined('CAL_GREGORIAN')) {
423
+				define('CAL_GREGORIAN', 1);
424 424
 			}
425 425
 		}
426 426
 
@@ -438,160 +438,160 @@  discard block
 block discarded – undo
438 438
 			/**
439 439
 			 * Load libraries.
440 440
 			 */
441
-			if ( ! class_exists( 'WP_Async_Request' ) ) {
442
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-async-request.php' );
441
+			if ( ! class_exists('WP_Async_Request')) {
442
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-async-request.php');
443 443
 			}
444 444
 
445
-			if ( ! class_exists( 'WP_Background_Process' ) ) {
446
-				include_once( GIVE_PLUGIN_DIR . 'includes/libraries/wp-background-process.php' );
445
+			if ( ! class_exists('WP_Background_Process')) {
446
+				include_once(GIVE_PLUGIN_DIR.'includes/libraries/wp-background-process.php');
447 447
 			}
448 448
 
449 449
 			/**
450 450
 			 * Load plugin files
451 451
 			 */
452
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php';
453
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
452
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php';
453
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
454 454
 			$give_options = give_get_settings();
455 455
 
456
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
457
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-async-process.php';
458
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php';
459
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php';
460
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
461
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
462
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
463
-			require_once GIVE_PLUGIN_DIR . 'includes/filters.php';
464
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
465
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api-v2.php';
466
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-tooltips.php';
467
-			require_once GIVE_PLUGIN_DIR . 'includes/class-notices.php';
468
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-translation.php';
469
-
470
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-scripts.php';
471
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
472
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
473
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
474
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
475
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-meta.php';
476
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donors.php';
477
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-donor-meta.php';
478
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donor.php';
479
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
480
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
481
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
482
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
483
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
484
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
485
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-payment-meta.php';
486
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-form-meta.php';
487
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-sequential-ordering.php';
488
-
489
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
490
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
491
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
492
-			require_once GIVE_PLUGIN_DIR . 'includes/import-functions.php';
493
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
494
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
495
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
496
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
497
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
498
-			require_once GIVE_PLUGIN_DIR . 'includes/currency-functions.php';
499
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
500
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
501
-			require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php';
502
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
503
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
504
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
505
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-classes.php';
506
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php';
507
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php';
508
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php';
509
-
510
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/backward-compatibility.php';
511
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
512
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
513
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
514
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
515
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
516
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-sequential-donation-number.php';
517
-
518
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
519
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
520
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
521
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
522
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
523
-
524
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
525
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
526
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notifications.php';
527
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
528
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
529
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
530
-
531
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/class-give-donors-query.php';
532
-			require_once GIVE_PLUGIN_DIR . 'includes/donors/backward-compatibility.php';
533
-
534
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/class-give-updates.php';
535
-
536
-			require_once GIVE_PLUGIN_DIR . 'blocks/load.php';
537
-
538
-			if ( defined( 'WP_CLI' ) && WP_CLI ) {
539
-				require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php';
456
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
457
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-async-process.php';
458
+			require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php';
459
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php';
460
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
461
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
462
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
463
+			require_once GIVE_PLUGIN_DIR.'includes/filters.php';
464
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
465
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api-v2.php';
466
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-tooltips.php';
467
+			require_once GIVE_PLUGIN_DIR.'includes/class-notices.php';
468
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-translation.php';
469
+
470
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-scripts.php';
471
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
472
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
473
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
474
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
475
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-meta.php';
476
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donors.php';
477
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-donor-meta.php';
478
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donor.php';
479
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
480
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
481
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
482
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
483
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
484
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
485
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-payment-meta.php';
486
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-form-meta.php';
487
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-sequential-ordering.php';
488
+
489
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
490
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
491
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
492
+			require_once GIVE_PLUGIN_DIR.'includes/import-functions.php';
493
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
494
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
495
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
496
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
497
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
498
+			require_once GIVE_PLUGIN_DIR.'includes/currency-functions.php';
499
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
500
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
501
+			require_once GIVE_PLUGIN_DIR.'includes/process-donation.php';
502
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
503
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
504
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
505
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-classes.php';
506
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php';
507
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php';
508
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php';
509
+
510
+			require_once GIVE_PLUGIN_DIR.'includes/payments/backward-compatibility.php';
511
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
512
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
513
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
514
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
515
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
516
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-sequential-donation-number.php';
517
+
518
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
519
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
520
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
521
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
522
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
523
+
524
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
525
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
526
+			require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notifications.php';
527
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
528
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
529
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
530
+
531
+			require_once GIVE_PLUGIN_DIR.'includes/donors/class-give-donors-query.php';
532
+			require_once GIVE_PLUGIN_DIR.'includes/donors/backward-compatibility.php';
533
+
534
+			require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/class-give-updates.php';
535
+
536
+			require_once GIVE_PLUGIN_DIR.'blocks/load.php';
537
+
538
+			if (defined('WP_CLI') && WP_CLI) {
539
+				require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php';
540 540
 			}
541 541
 
542
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
543
-
544
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
545
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
546
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
547
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
548
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php';
549
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
550
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php';
551
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
552
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
553
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
554
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-blank-slate.php';
555
-
556
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
557
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
558
-
559
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donors.php';
560
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-functions.php';
561
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/donors/donor-actions.php';
562
-
563
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
564
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php';
565
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
566
-
567
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-functions.php';
568
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-export.php';
569
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/export-actions.php';
570
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/pdf-reports.php';
571
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/give-export-donations-functions.php';
572
-
573
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/reports.php';
574
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/class-give-graph.php';
575
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reports/graphing.php';
576
-
577
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php';
578
-
579
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/data/tools-actions.php';
580
-
581
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
582
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
583
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
584
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
585
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
586
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
587
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
588
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-grid.php';
589
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
590
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
591
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-totals.php';
542
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
543
+
544
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
545
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
546
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
547
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
548
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php';
549
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
550
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php';
551
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
552
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
553
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
554
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-blank-slate.php';
555
+
556
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
557
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
558
+
559
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donors.php';
560
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-functions.php';
561
+				require_once GIVE_PLUGIN_DIR.'includes/admin/donors/donor-actions.php';
562
+
563
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
564
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php';
565
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
566
+
567
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-functions.php';
568
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-export.php';
569
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/export-actions.php';
570
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/pdf-reports.php';
571
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/give-export-donations-functions.php';
572
+
573
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/reports.php';
574
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/class-give-graph.php';
575
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reports/graphing.php';
576
+
577
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php';
578
+
579
+				require_once GIVE_PLUGIN_DIR.'includes/admin/tools/data/tools-actions.php';
580
+
581
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
582
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
583
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
584
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
585
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
586
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
587
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
588
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-grid.php';
589
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
590
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
591
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-totals.php';
592 592
 			}// End if().
593 593
 
594
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
594
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
595 595
 
596 596
 		}
597 597
 
@@ -606,16 +606,16 @@  discard block
 block discarded – undo
606 606
 		public function load_textdomain() {
607 607
 
608 608
 			// Set filter for Give's languages directory
609
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
610
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
609
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
610
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
611 611
 
612 612
 			// Traditional WordPress plugin locale filter.
613
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
614
-			$locale = apply_filters( 'plugin_locale', $locale, 'give' );
613
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
614
+			$locale = apply_filters('plugin_locale', $locale, 'give');
615 615
 
616
-			unload_textdomain( 'give' );
617
-			load_textdomain( 'give', WP_LANG_DIR . '/give/give-' . $locale . '.mo' );
618
-			load_plugin_textdomain( 'give', false, $give_lang_dir );
616
+			unload_textdomain('give');
617
+			load_textdomain('give', WP_LANG_DIR.'/give/give-'.$locale.'.mo');
618
+			load_plugin_textdomain('give', false, $give_lang_dir);
619 619
 
620 620
 		}
621 621
 
@@ -628,21 +628,21 @@  discard block
 block discarded – undo
628 628
 		 */
629 629
 		public function minimum_phpversion_notice() {
630 630
 			// Bailout.
631
-			if ( ! is_admin() ) {
631
+			if ( ! is_admin()) {
632 632
 				return;
633 633
 			}
634 634
 
635
-			$notice_desc  = '<p><strong>' . __( 'Your site could be faster and more secure with a newer PHP version.', 'give' ) . '</strong></p>';
636
-			$notice_desc .= '<p>' . __( 'Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give' ) . '</p>';
637
-			$notice_desc .= '<p>' . __( 'Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give' ) . '</p>';
638
-			$notice_desc .= '<p><strong>' . __( 'To which version should I update?', 'give' ) . '</strong></p>';
639
-			$notice_desc .= '<p>' . __( 'You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give' ) . '</p>';
640
-			$notice_desc .= '<p><strong>' . __( 'Can\'t update? Ask your host!', 'give' ) . '</strong></p>';
641
-			$notice_desc .= '<p>' . sprintf( __( 'If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give' ), sprintf( '<a href="%1$s" target="_blank">', esc_url( 'https://wordpress.org/hosting/' ) ), '</a>' ) . '</p>';
635
+			$notice_desc  = '<p><strong>'.__('Your site could be faster and more secure with a newer PHP version.', 'give').'</strong></p>';
636
+			$notice_desc .= '<p>'.__('Hey, we\'ve noticed that you\'re running an outdated version of PHP. PHP is the programming language that WordPress and Give are built on. The version that is currently used for your site is no longer supported. Newer versions of PHP are both faster and more secure. In fact, your version of PHP no longer receives security updates, which is why we\'re sending you this notice.', 'give').'</p>';
637
+			$notice_desc .= '<p>'.__('Hosts have the ability to update your PHP version, but sometimes they don\'t dare to do that because they\'re afraid they\'ll break your site.', 'give').'</p>';
638
+			$notice_desc .= '<p><strong>'.__('To which version should I update?', 'give').'</strong></p>';
639
+			$notice_desc .= '<p>'.__('You should update your PHP version to either 5.6 or to 7.0 or 7.1. On a normal WordPress site, switching to PHP 5.6 should never cause issues. We would however actually recommend you switch to PHP7. There are some plugins that are not ready for PHP7 though, so do some testing first. PHP7 is much faster than PHP 5.6. It\'s also the only PHP version still in active development and therefore the better option for your site in the long run.', 'give').'</p>';
640
+			$notice_desc .= '<p><strong>'.__('Can\'t update? Ask your host!', 'give').'</strong></p>';
641
+			$notice_desc .= '<p>'.sprintf(__('If you cannot upgrade your PHP version yourself, you can send an email to your host. If they don\'t want to upgrade your PHP version, we would suggest you switch hosts. Have a look at one of the recommended %1$sWordPress hosting partners%2$s.', 'give'), sprintf('<a href="%1$s" target="_blank">', esc_url('https://wordpress.org/hosting/')), '</a>').'</p>';
642 642
 
643 643
 			echo sprintf(
644 644
 				'<div class="notice notice-error">%1$s</div>',
645
-				wp_kses_post( $notice_desc )
645
+				wp_kses_post($notice_desc)
646 646
 			);
647 647
 		}
648 648
 
Please login to merge, or discard this patch.