Test Failed
Push — master ( 21ce85...fda949 )
by Devin
06:42
created
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title'] = esc_html__( 'Register', 'give' );
25
-		$this->shortcode['label'] = esc_html__( 'Register', 'give' );
24
+		$this->shortcode['title'] = esc_html__('Register', 'give');
25
+		$this->shortcode['label'] = esc_html__('Register', 'give');
26 26
 
27
-		parent::__construct( 'give_register' );
27
+		parent::__construct('give_register');
28 28
 	}
29 29
 
30 30
 	/**
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 		return array(
38 38
 			array(
39 39
 				'type' => 'container',
40
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ),
40
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')),
41 41
 			),
42 42
 			array(
43 43
 				'type'     => 'textbox',
44 44
 				'name'     => 'redirect',
45 45
 				'minWidth' => 320,
46
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ),
46
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after registering.', 'give'),
47 47
 			),
48 48
 		);
49 49
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['label'] = esc_html__( 'Donation History', 'give' );
24
+		$this->shortcode['label'] = esc_html__('Donation History', 'give');
25 25
 
26
-		parent::__construct( 'donation_history' );
26
+		parent::__construct('donation_history');
27 27
 	}
28 28
 }
29 29
 
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 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
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	public function __construct() {
26 26
 
27
-		$this->shortcode['title'] = esc_html__( 'Donation Form', 'give' );
28
-		$this->shortcode['label'] = esc_html__( 'Donation Form', 'give' );
27
+		$this->shortcode['title'] = esc_html__('Donation Form', 'give');
28
+		$this->shortcode['label'] = esc_html__('Donation Form', 'give');
29 29
 
30
-		parent::__construct( 'give_form' );
30
+		parent::__construct('give_form');
31 31
 	}
32 32
 
33 33
 	/**
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 		$create_form_link = sprintf(
41 41
 		/* translators: %s: create new form URL */
42
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
43
-			admin_url( 'post-new.php?post_type=give_forms' )
42
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
43
+			admin_url('post-new.php?post_type=give_forms')
44 44
 		);
45 45
 
46 46
 		return array(
@@ -50,68 +50,68 @@  discard block
 block discarded – undo
50 50
 					'post_type' => 'give_forms',
51 51
 				),
52 52
 				'name'        => 'id',
53
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
54
-				'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
53
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
54
+				'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -',
55 55
 				'required'    => array(
56
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
57
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
56
+					'alert' => esc_html__('You must first select a Form!', 'give'),
57
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link),
58 58
 				),
59 59
 			),
60 60
 			array(
61 61
 				'type' => 'container',
62
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
62
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
63 63
 			),
64 64
 			array(
65 65
 				'type'    => 'listbox',
66 66
 				'name'    => 'show_title',
67
-				'label'   => esc_attr__( 'Show Title', 'give' ),
68
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
67
+				'label'   => esc_attr__('Show Title', 'give'),
68
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
69 69
 				'options' => array(
70
-					'true'  => esc_html__( 'Show', 'give' ),
71
-					'false' => esc_html__( 'Hide', 'give' ),
70
+					'true'  => esc_html__('Show', 'give'),
71
+					'false' => esc_html__('Hide', 'give'),
72 72
 				),
73 73
 			),
74 74
 			array(
75 75
 				'type'    => 'listbox',
76 76
 				'name'    => 'show_goal',
77
-				'label'   => esc_attr__( 'Show Goal', 'give' ),
78
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
77
+				'label'   => esc_attr__('Show Goal', 'give'),
78
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
79 79
 				'options' => array(
80
-					'true'  => esc_html__( 'Show', 'give' ),
81
-					'false' => esc_html__( 'Hide', 'give' ),
80
+					'true'  => esc_html__('Show', 'give'),
81
+					'false' => esc_html__('Hide', 'give'),
82 82
 				),
83 83
 			),
84 84
 			array(
85 85
 				'type'     => 'listbox',
86 86
 				'name'     => 'show_content',
87 87
 				'minWidth' => 240,
88
-				'label'    => esc_attr__( 'Display Content', 'give' ),
89
-				'tooltip'  => esc_attr__( 'Do you want to display the form content?', 'give' ),
88
+				'label'    => esc_attr__('Display Content', 'give'),
89
+				'tooltip'  => esc_attr__('Do you want to display the form content?', 'give'),
90 90
 				'options'  => array(
91
-					'none'  => esc_html__( 'No Content', 'give' ),
92
-					'above' => esc_html__( 'Display content ABOVE the fields', 'give' ),
93
-					'below' => esc_html__( 'Display content BELOW the fields', 'give' ),
91
+					'none'  => esc_html__('No Content', 'give'),
92
+					'above' => esc_html__('Display content ABOVE the fields', 'give'),
93
+					'below' => esc_html__('Display content BELOW the fields', 'give'),
94 94
 				),
95 95
 			),
96 96
 			array(
97 97
 				'type'    => 'listbox',
98 98
 				'name'    => 'display_style',
99 99
 				'classes' => 'give-display-style',
100
-				'label'   => esc_attr__( 'Display Options', 'give' ),
101
-				'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ),
100
+				'label'   => esc_attr__('Display Options', 'give'),
101
+				'tooltip' => esc_attr__('How would you like to display donation information?', 'give'),
102 102
 				'options' => array(
103
-					'onpage' => esc_html__( 'All Fields', 'give' ),
104
-					'modal'  => esc_html__( 'Modal', 'give' ),
105
-					'reveal' => esc_html__( 'Reveal', 'give' ),
106
-					'button' => esc_html__( 'Button', 'give' ),
103
+					'onpage' => esc_html__('All Fields', 'give'),
104
+					'modal'  => esc_html__('Modal', 'give'),
105
+					'reveal' => esc_html__('Reveal', 'give'),
106
+					'button' => esc_html__('Button', 'give'),
107 107
 				),
108 108
 			),
109 109
 			array(
110 110
 				'type'    => 'textbox',
111 111
 				'classes' => 'give-hidden give-continue-button-title',
112 112
 				'name'    => 'continue_button_title',
113
-				'label'   => esc_attr__( 'Button Text', 'give' ),
114
-				'tooltip' => esc_attr__( 'The button label for displaying the additional payment fields.', 'give' ),
113
+				'label'   => esc_attr__('Button Text', 'give'),
114
+				'tooltip' => esc_attr__('The button label for displaying the additional payment fields.', 'give'),
115 115
 			),
116 116
 		);
117 117
 	}
Please login to merge, or discard this patch.
includes/admin/tools/logs/class-sales-logs-list-table.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@
 block discarded – undo
157 157
 	 *
158 158
 	 * @access public
159 159
 	 * @since  1.0
160
-	 * @return string|bool string If search is present, false otherwise
160
+	 * @return string|false string If search is present, false otherwise
161 161
 	 */
162 162
 	public function get_search() {
163 163
 		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  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
 
16 16
 // Load WP_List_Table if not loaded.
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 		global $status, $page;
45 45
 
46 46
 		// Set parent defaults
47
-		parent::__construct( array(
48
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
49
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
50
-			'ajax'     => false,// Does this table support ajax?
51
-		) );
47
+		parent::__construct(array(
48
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
49
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
50
+			'ajax'     => false, // Does this table support ajax?
51
+		));
52 52
 
53
-		add_action( 'give_log_view_actions', array( $this, 'give_forms_filter' ) );
53
+		add_action('give_log_view_actions', array($this, 'give_forms_filter'));
54 54
 	}
55 55
 
56 56
 	/**
@@ -64,69 +64,69 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return string Column Name
66 66
 	 */
67
-	public function column_default( $item, $column_name ) {
67
+	public function column_default($item, $column_name) {
68 68
 
69 69
 		/* @var Give_Payment $payment */
70
-		$payment = give_get_payment_by( 'id', $item['payment_id'] );
70
+		$payment = give_get_payment_by('id', $item['payment_id']);
71 71
 
72
-		switch ( $column_name ) {
72
+		switch ($column_name) {
73 73
 			case 'form' :
74
-				$form_title = get_the_title( $item[ $column_name ] );
75
-				$form_title = empty( $form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $item[ $column_name ] ) : $form_title;
76
-				return '<a href="' . esc_url( add_query_arg( 'form', $item[ $column_name ] ) ) . '" >' . esc_html( $form_title ). '</a>';
74
+				$form_title = get_the_title($item[$column_name]);
75
+				$form_title = empty($form_title) ? sprintf(__('Untitled (#%s)', 'give'), $item[$column_name]) : $form_title;
76
+				return '<a href="'.esc_url(add_query_arg('form', $item[$column_name])).'" >'.esc_html($form_title).'</a>';
77 77
 
78 78
 			case 'amount' :
79
-				$value = give_currency_filter( give_format_amount( $item['amount'], array( 'sanitize' => false, 'donation_id' => $item['payment_id'] ) ), array( 'currency_code' => give_get_payment_currency_code( $item['payment_id'] ) ) );
80
-				$value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) );
79
+				$value = give_currency_filter(give_format_amount($item['amount'], array('sanitize' => false, 'donation_id' => $item['payment_id'])), array('currency_code' => give_get_payment_currency_code($item['payment_id'])));
80
+				$value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway));
81 81
 
82 82
 				return $value;
83 83
 
84 84
 			case 'status' :
85 85
 
86
-				$value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>';
86
+				$value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>';
87 87
 
88
-				if ( $payment->mode == 'test' ) {
89
-					$value .= Give()->tooltips->render_span( array(
90
-						'label'       => __( 'This donation was made in test mode.', 'give' ),
91
-						'tag_content' => __( 'Test', 'give' ),
88
+				if ($payment->mode == 'test') {
89
+					$value .= Give()->tooltips->render_span(array(
90
+						'label'       => __('This donation was made in test mode.', 'give'),
91
+						'tag_content' => __('Test', 'give'),
92 92
 						'attributes'  => array(
93 93
 							'class' => 'give-item-label give-item-label-orange give-test-mode-transactions-label',
94 94
 						),
95
-					) );
95
+					));
96 96
 				}
97 97
 
98 98
 				return $value;
99 99
 
100 100
 			case 'donation' :
101
-				$serial_code = Give()->seq_donation_number->get_serial_code( $payment );
102
-				$value = Give()->tooltips->render_link( array(
101
+				$serial_code = Give()->seq_donation_number->get_serial_code($payment);
102
+				$value = Give()->tooltips->render_link(array(
103 103
 					/* translators: %s Sequential Donation ID. */
104
-					'label'       => sprintf( __( 'View Donation %s', 'give' ), $serial_code ),
104
+					'label'       => sprintf(__('View Donation %s', 'give'), $serial_code),
105 105
 					'tag_content' => $serial_code,
106
-					'link'        => esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ),
107
-				) );
106
+					'link'        => esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))),
107
+				));
108 108
 
109
-				if ( ! empty( $item['donor_id'] ) ) {
110
-					$title_prefix = Give()->donor_meta->get_meta( $item['donor_id'], '_give_donor_title_prefix', true );
109
+				if ( ! empty($item['donor_id'])) {
110
+					$title_prefix = Give()->donor_meta->get_meta($item['donor_id'], '_give_donor_title_prefix', true);
111 111
 
112 112
 					$value .= sprintf(
113 113
 						'&nbsp;%1$s&nbsp;<a href="%2$s">%3$s</a><br>',
114
-						esc_html__( 'by', 'give' ),
115
-						admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . $item['donor_id'] ),
116
-						give_get_donor_name_with_title_prefixes( $title_prefix, $item['donor_name'] )
114
+						esc_html__('by', 'give'),
115
+						admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.$item['donor_id']),
116
+						give_get_donor_name_with_title_prefixes($title_prefix, $item['donor_name'])
117 117
 					);
118 118
 				} else {
119 119
 					$value .= sprintf(
120 120
 						'&nbsp;%1$s&nbsp;%2$s<br>',
121
-						esc_html__( 'by', 'give' ),
122
-						__( 'No donor attached', 'give' )
121
+						esc_html__('by', 'give'),
122
+						__('No donor attached', 'give')
123 123
 					);
124 124
 				}
125 125
 
126 126
 				return $value;
127 127
 
128 128
 			default:
129
-				return $item[ $column_name ];
129
+				return $item[$column_name];
130 130
 		} // End switch().
131 131
 	}
132 132
 
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public function get_columns() {
141 141
 		$columns = array(
142
-			'ID'       => __( 'Log ID', 'give' ),
143
-			'donation' => __( 'Donation', 'give' ),
144
-			'form'     => __( 'Form', 'give' ),
145
-			'status'   => __( 'Status', 'give' ),
146
-			'amount'   => __( 'Donation Amount', 'give' ),
147
-			'date'     => __( 'Date', 'give' ),
142
+			'ID'       => __('Log ID', 'give'),
143
+			'donation' => __('Donation', 'give'),
144
+			'form'     => __('Form', 'give'),
145
+			'status'   => __('Status', 'give'),
146
+			'amount'   => __('Donation Amount', 'give'),
147
+			'date'     => __('Date', 'give'),
148 148
 		);
149 149
 
150 150
 		return $columns;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @return int Current page number
159 159
 	 */
160 160
 	public function get_paged() {
161
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
161
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
162 162
 	}
163 163
 
164 164
 	/**
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @return mixed int If User ID, string If Email/Login
170 170
 	 */
171 171
 	public function get_filtered_user() {
172
-		return isset( $_GET['user'] ) ? absint( $_GET['user'] ) : false;
172
+		return isset($_GET['user']) ? absint($_GET['user']) : false;
173 173
 	}
174 174
 
175 175
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 * @return int Download ID
181 181
 	 */
182 182
 	public function get_filtered_give_form() {
183
-		return ! empty( $_GET['form'] ) ? absint( $_GET['form'] ) : false;
183
+		return ! empty($_GET['form']) ? absint($_GET['form']) : false;
184 184
 	}
185 185
 
186 186
 	/**
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 * @return string|bool string If search is present, false otherwise
192 192
 	 */
193 193
 	public function get_search() {
194
-		return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false;
194
+		return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false;
195 195
 	}
196 196
 
197 197
 
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $which
209 209
 	 */
210
-	protected function display_tablenav( $which ) {
210
+	protected function display_tablenav($which) {
211 211
 		?>
212
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
212
+		<div class="tablenav <?php echo esc_attr($which); ?>">
213 213
 
214
-			<?php if ( 'top' === $which ) : ?>
214
+			<?php if ('top' === $which) : ?>
215 215
 				<div class="alignleft actions bulkactions">
216
-					<?php $this->bulk_actions( $which ); ?>
216
+					<?php $this->bulk_actions($which); ?>
217 217
 				</div>
218 218
 			<?php endif; ?>
219 219
 
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 		$meta_query = array();
246 246
 
247
-		if ( $user ) {
247
+		if ($user) {
248 248
 			// Show only logs from a specific user.
249 249
 			$meta_query[] = array(
250 250
 				'key'   => '_give_log_user_id',
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			);
253 253
 		}
254 254
 
255
-		if ( $give_form ) {
255
+		if ($give_form) {
256 256
 			$meta_query[] = array(
257 257
 				'key'   => '_give_log_form_id',
258 258
 				'value' => $give_form,
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 		}
261 261
 
262 262
 		$search = $this->get_search();
263
-		if ( $search ) {
264
-			if ( is_email( $search ) ) {
263
+		if ($search) {
264
+			if (is_email($search)) {
265 265
 				// This is an email search. We use this to ensure it works for guest users and logged-in users.
266 266
 				$key     = '_give_log_user_info';
267 267
 				$compare = 'LIKE';
@@ -270,32 +270,32 @@  discard block
 block discarded – undo
270 270
 				$key     = '_give_log_user_id';
271 271
 				$compare = 'LIKE';
272 272
 
273
-				if ( ! is_numeric( $search ) ) {
273
+				if ( ! is_numeric($search)) {
274 274
 					// Searching for user by username
275
-					$user = get_user_by( 'login', $search );
275
+					$user = get_user_by('login', $search);
276 276
 
277
-					if ( $user ) {
277
+					if ($user) {
278 278
 						// Found one, set meta value to user's ID.
279 279
 						$search = $user->ID;
280 280
 					} else {
281 281
 						// No user found so let's do a real search query.
282
-						$users = new WP_User_Query( array(
282
+						$users = new WP_User_Query(array(
283 283
 							'search'         => $search,
284
-							'search_columns' => array( 'user_url', 'user_nicename' ),
284
+							'search_columns' => array('user_url', 'user_nicename'),
285 285
 							'number'         => 1,
286 286
 							'fields'         => 'ids',
287
-						) );
287
+						));
288 288
 
289 289
 						$found_user = $users->get_results();
290 290
 
291
-						if ( $found_user ) {
291
+						if ($found_user) {
292 292
 							$search = $found_user[0];
293 293
 						}
294 294
 					}
295 295
 				}
296 296
 			}
297 297
 
298
-			if ( ! $this->file_search ) {
298
+			if ( ! $this->file_search) {
299 299
 				// Meta query only works for non file name search.
300 300
 				$meta_query[] = array(
301 301
 					'key'     => $key,
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	 * @param string $which
318 318
 	 * @return void
319 319
 	 */
320
-	function bulk_actions( $which = '' ) {
320
+	function bulk_actions($which = '') {
321 321
 		give_log_views();
322 322
 	}
323 323
 
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
 	 * @return void
330 330
 	 */
331 331
 	public function give_forms_filter() {
332
-		echo Give()->html->forms_dropdown( array(
332
+		echo Give()->html->forms_dropdown(array(
333 333
 			'selected' => $this->get_filtered_give_form(),
334 334
 			'name'   => 'form',
335 335
 			'id'     => 'give-log-form-filter',
336 336
 			'chosen' => true,
337
-		) );
337
+		));
338 338
 	}
339 339
 
340 340
 	/**
@@ -348,22 +348,22 @@  discard block
 block discarded – undo
348 348
 	public function get_logs() {
349 349
 		$logs_data = array();
350 350
 		$log_query = $this->get_query_params();
351
-		$logs = Give()->logs->get_connected_logs( $log_query );
351
+		$logs = Give()->logs->get_connected_logs($log_query);
352 352
 
353
-		if ( $logs ) {
354
-			foreach ( $logs as $log ) {
353
+		if ($logs) {
354
+			foreach ($logs as $log) {
355 355
 				/* @var Give_payment $payment */
356
-				$payment = new Give_Payment( $log->log_parent );
356
+				$payment = new Give_Payment($log->log_parent);
357 357
 
358 358
 				// Make sure this payment hasn't been deleted
359
-				if ( get_post( $payment->ID ) ) :
359
+				if (get_post($payment->ID)) :
360 360
 					$logs_data[] = array(
361
-						'ID'         => '<span class="give-item-label give-item-label-gray">' . $log->ID . '</span>',
361
+						'ID'         => '<span class="give-item-label give-item-label-gray">'.$log->ID.'</span>',
362 362
 						'payment_id' => $payment->ID,
363 363
 						'form'       => $payment->form_id,
364 364
 						'amount'     => $payment->total,
365 365
 						'donor_id'    => $payment->customer_id,
366
-						'donor_name' => trim( "{$payment->first_name} $payment->last_name" ),
366
+						'donor_name' => trim("{$payment->first_name} $payment->last_name"),
367 367
 						'date'       => $payment->date,
368 368
 					);
369 369
 
@@ -391,15 +391,15 @@  discard block
 block discarded – undo
391 391
 		$columns               = $this->get_columns();
392 392
 		$hidden                = array();
393 393
 		$sortable              = $this->get_sortable_columns();
394
-		$this->_column_headers = array( $columns, $hidden, $sortable );
394
+		$this->_column_headers = array($columns, $hidden, $sortable);
395 395
 		$current_page          = $this->get_pagenum();
396 396
 		$this->items           = $this->get_logs();
397
-		$total_items           = Give()->logs->get_log_count( 0, 'sale', $this->get_meta_query() );
397
+		$total_items           = Give()->logs->get_log_count(0, 'sale', $this->get_meta_query());
398 398
 
399
-		$this->set_pagination_args( array(
399
+		$this->set_pagination_args(array(
400 400
 				'total_items' => $total_items,
401 401
 				'per_page'    => $this->per_page,
402
-				'total_pages' => ceil( $total_items / $this->per_page ),
402
+				'total_pages' => ceil($total_items / $this->per_page),
403 403
 			)
404 404
 		);
405 405
 	}
Please login to merge, or discard this patch.
includes/admin/tools/export/class-batch-export-forms.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 
14 14
 // Exit if accessed directly.
15
-if ( ! defined( 'ABSPATH' ) ) {
15
+if ( ! defined('ABSPATH')) {
16 16
 	exit;
17 17
 }
18 18
 
@@ -41,20 +41,20 @@  discard block
 block discarded – undo
41 41
 	public function csv_cols() {
42 42
 
43 43
 		$cols = array(
44
-			'ID'                      => __( 'ID', 'give' ),
45
-			'post_name'               => __( 'Slug', 'give' ),
46
-			'post_title'              => __( 'Name', 'give' ),
47
-			'post_date'               => __( 'Date Created', 'give' ),
48
-			'post_author'             => __( 'Author', 'give' ),
49
-			'post_content'            => __( 'Description', 'give' ),
50
-			'post_excerpt'            => __( 'Excerpt', 'give' ),
51
-			'post_status'             => __( 'Status', 'give' ),
52
-			'categories'              => __( 'Categories', 'give' ),
53
-			'tags'                    => __( 'Tags', 'give' ),
54
-			'give_price'              => __( 'Price', 'give' ),
55
-			'_thumbnail_id'           => __( 'Featured Image', 'give' ),
56
-			'_give_form_sales'        => __( 'Donations', 'give' ),
57
-			'_give_download_earnings' => __( 'Income', 'give' ),
44
+			'ID'                      => __('ID', 'give'),
45
+			'post_name'               => __('Slug', 'give'),
46
+			'post_title'              => __('Name', 'give'),
47
+			'post_date'               => __('Date Created', 'give'),
48
+			'post_author'             => __('Author', 'give'),
49
+			'post_content'            => __('Description', 'give'),
50
+			'post_excerpt'            => __('Excerpt', 'give'),
51
+			'post_status'             => __('Status', 'give'),
52
+			'categories'              => __('Categories', 'give'),
53
+			'tags'                    => __('Tags', 'give'),
54
+			'give_price'              => __('Price', 'give'),
55
+			'_thumbnail_id'           => __('Featured Image', 'give'),
56
+			'_give_form_sales'        => __('Donations', 'give'),
57
+			'_give_download_earnings' => __('Income', 'give'),
58 58
 		);
59 59
 
60 60
 		return $cols;
@@ -84,43 +84,43 @@  discard block
 block discarded – undo
84 84
 			'paged'          => $this->step
85 85
 		);
86 86
 
87
-		$forms = new WP_Query( $args );
87
+		$forms = new WP_Query($args);
88 88
 
89
-		if ( $forms->posts ) {
90
-			foreach ( $forms->posts as $form ) {
89
+		if ($forms->posts) {
90
+			foreach ($forms->posts as $form) {
91 91
 
92 92
 				$row = [];
93 93
 
94
-				foreach ( $this->csv_cols() as $key => $value ) {
94
+				foreach ($this->csv_cols() as $key => $value) {
95 95
 
96 96
 					// Setup default value/
97
-					$row[ $key ] = '';
97
+					$row[$key] = '';
98 98
 
99
-					if ( in_array( $key, $meta ) ) {
99
+					if (in_array($key, $meta)) {
100 100
 
101
-						switch ( $key ) {
101
+						switch ($key) {
102 102
 
103 103
 							case '_thumbnail_id' :
104 104
 
105
-								$image_id    = get_post_thumbnail_id( $form->ID );
106
-								$row[ $key ] = wp_get_attachment_url( $image_id );
105
+								$image_id    = get_post_thumbnail_id($form->ID);
106
+								$row[$key] = wp_get_attachment_url($image_id);
107 107
 
108 108
 								break;
109 109
 
110 110
 							case 'give_price' :
111 111
 
112
-								if ( give_has_variable_prices( $form->ID ) ) {
112
+								if (give_has_variable_prices($form->ID)) {
113 113
 
114 114
 									$prices = [];
115
-									foreach ( give_get_variable_prices( $form->ID ) as $price ) {
116
-										$prices[] = $price['name'] . ': ' . $price['amount'];
115
+									foreach (give_get_variable_prices($form->ID) as $price) {
116
+										$prices[] = $price['name'].': '.$price['amount'];
117 117
 									}
118 118
 
119
-									$row[ $key ] = implode( ' | ', $prices );
119
+									$row[$key] = implode(' | ', $prices);
120 120
 
121 121
 								} else {
122 122
 
123
-									$row[ $key ] = give_get_form_price( $form->ID );
123
+									$row[$key] = give_get_form_price($form->ID);
124 124
 
125 125
 								}
126 126
 
@@ -128,44 +128,44 @@  discard block
 block discarded – undo
128 128
 
129 129
 							default :
130 130
 
131
-								$row[ $key ] = give_get_meta( $form->ID, $key, TRUE );
131
+								$row[$key] = give_get_meta($form->ID, $key, TRUE);
132 132
 
133 133
 								break;
134 134
 
135 135
 						}
136 136
 
137
-					} elseif ( isset( $form->$key ) ) {
137
+					} elseif (isset($form->$key)) {
138 138
 
139
-						switch ( $key ) {
139
+						switch ($key) {
140 140
 
141 141
 							case 'post_author' :
142 142
 
143
-								$row[ $key ] = get_the_author_meta( 'user_login', $form->post_author );
143
+								$row[$key] = get_the_author_meta('user_login', $form->post_author);
144 144
 
145 145
 								break;
146 146
 
147 147
 							default :
148 148
 
149
-								$row[ $key ] = $form->$key;
149
+								$row[$key] = $form->$key;
150 150
 
151 151
 								break;
152 152
 						}
153 153
 
154
-					} elseif ( 'tags' == $key ) {
154
+					} elseif ('tags' == $key) {
155 155
 
156
-						$terms = get_the_terms( $form->ID, 'form_tag' );
157
-						if ( $terms ) {
158
-							$terms       = wp_list_pluck( $terms, 'name' );
159
-							$row[ $key ] = implode( ' | ', $terms );
156
+						$terms = get_the_terms($form->ID, 'form_tag');
157
+						if ($terms) {
158
+							$terms       = wp_list_pluck($terms, 'name');
159
+							$row[$key] = implode(' | ', $terms);
160 160
 						}
161 161
 
162 162
 
163
-					} elseif ( 'categories' == $key ) {
163
+					} elseif ('categories' == $key) {
164 164
 
165
-						$terms = get_the_terms( $form->ID, 'form_category' );
166
-						if ( $terms ) {
167
-							$terms       = wp_list_pluck( $terms, 'name' );
168
-							$row[ $key ] = implode( ' | ', $terms );
165
+						$terms = get_the_terms($form->ID, 'form_category');
166
+						if ($terms) {
167
+							$terms       = wp_list_pluck($terms, 'name');
168
+							$row[$key] = implode(' | ', $terms);
169 169
 						}
170 170
 
171 171
 					}
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 
177 177
 			}
178 178
 
179
-			$data = apply_filters( 'give_export_get_data', $data );
180
-			$data = apply_filters( "give_export_get_data_{$this->export_type}", $data );
179
+			$data = apply_filters('give_export_get_data', $data);
180
+			$data = apply_filters("give_export_get_data_{$this->export_type}", $data);
181 181
 
182 182
 			return $data;
183 183
 
@@ -197,20 +197,20 @@  discard block
 block discarded – undo
197 197
 
198 198
 		$args = array(
199 199
 			'post_type'      => 'give_forms',
200
-			'posts_per_page' => - 1,
200
+			'posts_per_page' => -1,
201 201
 			'post_status'    => 'any',
202 202
 			'fields'         => 'ids',
203 203
 		);
204 204
 
205
-		$forms  = new WP_Query( $args );
205
+		$forms = new WP_Query($args);
206 206
 		$total      = (int) $forms->post_count;
207 207
 		$percentage = 100;
208 208
 
209
-		if ( $total > 0 ) {
210
-			$percentage = ( ( 30 * $this->step ) / $total ) * 100;
209
+		if ($total > 0) {
210
+			$percentage = ((30 * $this->step) / $total) * 100;
211 211
 		}
212 212
 
213
-		if ( $percentage > 100 ) {
213
+		if ($percentage > 100) {
214 214
 			$percentage = 100;
215 215
 		}
216 216
 
Please login to merge, or discard this patch.
includes/class-give-license-handler.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 		 * @access private
704 704
 		 * @since  1.7
705 705
 		 *
706
-		 * @return bool
706
+		 * @return false|null
707 707
 		 */
708 708
 		private function __remove_license_key_from_subscriptions() {
709 709
 			$subscriptions = get_option( 'give_subscriptions', array() );
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 		 * @param $plugin_data
737 737
 		 * @param $status
738 738
 		 *
739
-		 * @return bool
739
+		 * @return false|null
740 740
 		 */
741 741
 		public function plugin_page_notices( $plugin_file, $plugin_data, $status ) {
742 742
 			// Bailout.
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		 *
759 759
 		 * @since  1.8.7
760 760
 		 * @access public
761
-		 * @return array
761
+		 * @return string
762 762
 		 */
763 763
 		public function license_state_message() {
764 764
 			$message_data = array();
Please login to merge, or discard this patch.
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'Give_License' ) ) :
17
+if ( ! class_exists('Give_License')) :
18 18
 
19 19
 	/**
20 20
 	 * Give_License Class
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 
169 169
 			$this->file             = $_file;
170 170
 			$this->item_name        = $_item_name;
171
-			$this->item_shortname   = self::get_short_name( $this->item_name );
171
+			$this->item_shortname   = self::get_short_name($this->item_name);
172 172
 			$this->version          = $_version;
173
-			$this->license          = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : '';
174
-			$this->license_data     = __give_get_active_license_info( $this->item_shortname );
173
+			$this->license          = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : '';
174
+			$this->license_data     = __give_get_active_license_info($this->item_shortname);
175 175
 			$this->author           = $_author;
176
-			$this->api_url          = is_null( $_api_url ) ? $this->api_url : $_api_url;
177
-			$this->checkout_url     = is_null( $_checkout_url ) ? $this->checkout_url : $_checkout_url;
178
-			$this->account_url      = is_null( $_account_url ) ? $this->account_url : $_account_url;
176
+			$this->api_url          = is_null($_api_url) ? $this->api_url : $_api_url;
177
+			$this->checkout_url     = is_null($_checkout_url) ? $this->checkout_url : $_checkout_url;
178
+			$this->account_url      = is_null($_account_url) ? $this->account_url : $_account_url;
179 179
 			$this->auto_updater_obj = null;
180 180
 
181 181
 			// Add Setting for Give Add-on activation status.
182
-			$is_addon_activated = get_option( 'give_is_addon_activated' );
183
-			if ( ! $is_addon_activated && is_object( $this ) ) {
184
-				update_option( 'give_is_addon_activated', true, false );
185
-				Give_Cache::set( 'give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS );
182
+			$is_addon_activated = get_option('give_is_addon_activated');
183
+			if ( ! $is_addon_activated && is_object($this)) {
184
+				update_option('give_is_addon_activated', true, false);
185
+				Give_Cache::set('give_cache_hide_license_notice_after_activation', true, DAY_IN_SECONDS);
186 186
 			}
187 187
 
188 188
 			// Add plugin to registered licenses list.
189
-			array_push( self::$licensed_addons, plugin_basename( $this->file ) );
189
+			array_push(self::$licensed_addons, plugin_basename($this->file));
190 190
 
191 191
 			// Setup hooks
192 192
 			$this->includes();
@@ -205,9 +205,9 @@  discard block
 block discarded – undo
205 205
 		 *
206 206
 		 * @return string
207 207
 		 */
208
-		public static function get_short_name( $plugin_name ) {
209
-			$plugin_name = trim( str_replace( 'Give - ', '', $plugin_name ) );
210
-			$plugin_name = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) );
208
+		public static function get_short_name($plugin_name) {
209
+			$plugin_name = trim(str_replace('Give - ', '', $plugin_name));
210
+			$plugin_name = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name)));
211 211
 
212 212
 			return $plugin_name;
213 213
 		}
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		 */
225 225
 		private function includes() {
226 226
 
227
-			if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
227
+			if ( ! class_exists('EDD_SL_Plugin_Updater')) {
228 228
 				require_once 'admin/EDD_SL_Plugin_Updater.php';
229 229
 			}
230 230
 		}
@@ -242,28 +242,28 @@  discard block
 block discarded – undo
242 242
 		private function hooks() {
243 243
 
244 244
 			// Register settings.
245
-			add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 );
245
+			add_filter('give_settings_licenses', array($this, 'settings'), 1);
246 246
 
247 247
 			// Activate license key on settings save.
248
-			add_action( 'admin_init', array( $this, 'activate_license' ), 10 );
248
+			add_action('admin_init', array($this, 'activate_license'), 10);
249 249
 
250 250
 			// Deactivate license key.
251
-			add_action( 'admin_init', array( $this, 'deactivate_license' ), 11 );
251
+			add_action('admin_init', array($this, 'deactivate_license'), 11);
252 252
 
253 253
 			// Updater.
254
-			add_action( 'admin_init', array( $this, 'auto_updater' ), 0 );
255
-			add_action( 'admin_notices', array( $this, 'notices' ) );
254
+			add_action('admin_init', array($this, 'auto_updater'), 0);
255
+			add_action('admin_notices', array($this, 'notices'));
256 256
 
257 257
 			// Check license weekly.
258
-			Give_Cron::add_weekly_event( array( $this, 'weekly_license_check' ) );
258
+			Give_Cron::add_weekly_event(array($this, 'weekly_license_check'));
259 259
 
260 260
 			// Check subscription weekly.
261
-			Give_Cron::add_weekly_event( array( $this, 'weekly_subscription_check' ) );
261
+			Give_Cron::add_weekly_event(array($this, 'weekly_subscription_check'));
262 262
 
263 263
 			// Show addon notice on plugin page.
264
-			$plugin_name = explode( 'plugins/', $this->file );
265
-			$plugin_name = end( $plugin_name );
266
-			add_action( "after_plugin_row_{$plugin_name}", array( $this, 'plugin_page_notices' ), 10, 3 );
264
+			$plugin_name = explode('plugins/', $this->file);
265
+			$plugin_name = end($plugin_name);
266
+			add_action("after_plugin_row_{$plugin_name}", array($this, 'plugin_page_notices'), 10, 3);
267 267
 
268 268
 		}
269 269
 
@@ -303,16 +303,16 @@  discard block
 block discarded – undo
303 303
 		 *
304 304
 		 * @return array           License settings.
305 305
 		 */
306
-		public function settings( $settings ) {
306
+		public function settings($settings) {
307 307
 
308 308
 			$give_license_settings = array(
309 309
 				array(
310 310
 					'name'    => $this->item_name,
311
-					'id'      => $this->item_shortname . '_license_key',
311
+					'id'      => $this->item_shortname.'_license_key',
312 312
 					'desc'    => '',
313 313
 					'type'    => 'license_key',
314 314
 					'options' => array(
315
-						'license'      => get_option( $this->item_shortname . '_license_active' ),
315
+						'license'      => get_option($this->item_shortname.'_license_active'),
316 316
 						'shortname'    => $this->item_shortname,
317 317
 						'item_name'    => $this->item_name,
318 318
 						'api_url'      => $this->api_url,
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 				),
324 324
 			);
325 325
 
326
-			return array_merge( $settings, $give_license_settings );
326
+			return array_merge($settings, $give_license_settings);
327 327
 		}
328 328
 
329 329
 		/**
@@ -338,18 +338,18 @@  discard block
 block discarded – undo
338 338
 		 *
339 339
 		 * @return array           License settings content.
340 340
 		 */
341
-		public function license_settings_content( $settings ) {
341
+		public function license_settings_content($settings) {
342 342
 
343 343
 			$give_license_settings = array(
344 344
 				array(
345
-					'name' => __( 'Add-on Licenses', 'give' ),
345
+					'name' => __('Add-on Licenses', 'give'),
346 346
 					'desc' => '<hr>',
347 347
 					'type' => 'give_title',
348 348
 					'id'   => 'give_title',
349 349
 				),
350 350
 			);
351 351
 
352
-			return array_merge( $settings, $give_license_settings );
352
+			return array_merge($settings, $give_license_settings);
353 353
 		}
354 354
 
355 355
 		/**
@@ -364,62 +364,62 @@  discard block
 block discarded – undo
364 364
 		 */
365 365
 		public function activate_license() {
366 366
 			// Bailout.
367
-			if ( ! $this->__is_user_can_edit_license() ) {
367
+			if ( ! $this->__is_user_can_edit_license()) {
368 368
 				return;
369 369
 			}
370 370
 
371 371
 			// Allow third party addon developers to handle license activation.
372
-			if ( $this->__is_third_party_addon() ) {
373
-				do_action( 'give_activate_license', $this );
372
+			if ($this->__is_third_party_addon()) {
373
+				do_action('give_activate_license', $this);
374 374
 
375 375
 				return;
376 376
 			}
377 377
 
378 378
 			// Delete previous license setting if a empty license key submitted.
379
-			if ( empty( $_POST["{$this->item_shortname}_license_key"] ) ) {
379
+			if (empty($_POST["{$this->item_shortname}_license_key"])) {
380 380
 				$this->unset_license();
381 381
 
382 382
 				return;
383 383
 			}
384 384
 
385 385
 			// Do not simultaneously activate add-ons if the user want to deactivate a specific add-on.
386
-			if ( $this->is_deactivating_license() ) {
386
+			if ($this->is_deactivating_license()) {
387 387
 				return;
388 388
 			}
389 389
 
390 390
 			// Check if plugin previously installed.
391
-			if ( $this->is_valid_license() ) {
391
+			if ($this->is_valid_license()) {
392 392
 				return;
393 393
 			}
394 394
 
395 395
 			// Get license key.
396
-			$this->license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] );
396
+			$this->license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']);
397 397
 
398 398
 			// Delete previous license key from subscription if previously added.
399 399
 			$this->__remove_license_key_from_subscriptions();
400 400
 
401 401
 			// Make sure there are no api errors.
402
-			if ( ! ( $license_data = $this->get_license_info( 'activate_license' ) ) ) {
402
+			if ( ! ($license_data = $this->get_license_info('activate_license'))) {
403 403
 				return;
404 404
 			}
405 405
 
406 406
 			// Make sure license is valid.
407 407
 			// return because admin will want to activate license again.
408
-			if ( ! $this->is_license( $license_data ) ) {
408
+			if ( ! $this->is_license($license_data)) {
409 409
 				// Add license key.
410
-				give_update_option( "{$this->item_shortname}_license_key", $this->license );
410
+				give_update_option("{$this->item_shortname}_license_key", $this->license);
411 411
 
412 412
 				return;
413 413
 			}
414 414
 
415 415
 			// Tell WordPress to look for updates.
416
-			set_site_transient( 'update_plugins', null );
416
+			set_site_transient('update_plugins', null);
417 417
 
418 418
 			// Add license data.
419
-			update_option( "{$this->item_shortname}_license_active", $license_data, false );
419
+			update_option("{$this->item_shortname}_license_active", $license_data, false);
420 420
 
421 421
 			// Add license key.
422
-			give_update_option( "{$this->item_shortname}_license_key", $this->license );
422
+			give_update_option("{$this->item_shortname}_license_key", $this->license);
423 423
 
424 424
 			// Check subscription for license key and store this to db (if any).
425 425
 			$this->__single_subscription_check();
@@ -437,19 +437,19 @@  discard block
 block discarded – undo
437 437
 		 */
438 438
 		public function deactivate_license() {
439 439
 			// Bailout.
440
-			if ( ! $this->__is_user_can_edit_license() ) {
440
+			if ( ! $this->__is_user_can_edit_license()) {
441 441
 				return;
442 442
 			}
443 443
 
444 444
 			// Allow third party add-on developers to handle license deactivation.
445
-			if ( $this->__is_third_party_addon() ) {
446
-				do_action( 'give_deactivate_license', $this );
445
+			if ($this->__is_third_party_addon()) {
446
+				do_action('give_deactivate_license', $this);
447 447
 
448 448
 				return;
449 449
 			}
450 450
 
451 451
 			// Run on deactivate button press.
452
-			if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) {
452
+			if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) {
453 453
 				$this->unset_license();
454 454
 			}
455 455
 		}
@@ -465,30 +465,30 @@  discard block
 block discarded – undo
465 465
 		public function weekly_license_check() {
466 466
 
467 467
 			if (
468
-				! empty( $_POST['give_settings'] ) ||
469
-				empty( $this->license )
468
+				! empty($_POST['give_settings']) ||
469
+				empty($this->license)
470 470
 			) {
471 471
 				return;
472 472
 			}
473 473
 
474 474
 			// Allow third party add-on developers to handle their license check.
475
-			if ( $this->__is_third_party_addon() ) {
476
-				do_action( 'give_weekly_license_check', $this );
475
+			if ($this->__is_third_party_addon()) {
476
+				do_action('give_weekly_license_check', $this);
477 477
 
478 478
 				return;
479 479
 			}
480 480
 
481 481
 			// Make sure there are no api errors.
482
-			if ( ! ( $license_data = $this->get_license_info( 'check_license' ) ) ) {
482
+			if ( ! ($license_data = $this->get_license_info('check_license'))) {
483 483
 				return;
484 484
 			}
485 485
 
486 486
 			// Bailout.
487
-			if ( ! $this->is_license( $license_data ) ) {
487
+			if ( ! $this->is_license($license_data)) {
488 488
 				return;
489 489
 			}
490 490
 
491
-			update_option( $this->item_shortname . '_license_active', $license_data, false );
491
+			update_option($this->item_shortname.'_license_active', $license_data, false);
492 492
 
493 493
 			return;
494 494
 		}
@@ -504,21 +504,21 @@  discard block
 block discarded – undo
504 504
 		public function weekly_subscription_check() {
505 505
 			// Bailout.
506 506
 			if (
507
-				! empty( $_POST['give_settings'] )
508
-				|| empty( $this->license )
507
+				! empty($_POST['give_settings'])
508
+				|| empty($this->license)
509 509
 			) {
510 510
 				return;
511 511
 			}
512 512
 
513 513
 			// Remove old subscription data.
514
-			if ( absint( get_option( '_give_subscriptions_edit_last', true ) ) < current_time( 'timestamp', 1 ) ) {
515
-				delete_option( 'give_subscriptions' );
516
-				update_option( '_give_subscriptions_edit_last', strtotime( '+ 1 day', current_time( 'timestamp', 1 ) ), false );
514
+			if (absint(get_option('_give_subscriptions_edit_last', true)) < current_time('timestamp', 1)) {
515
+				delete_option('give_subscriptions');
516
+				update_option('_give_subscriptions_edit_last', strtotime('+ 1 day', current_time('timestamp', 1)), false);
517 517
 			}
518 518
 
519 519
 			// Allow third party add-on developers to handle their subscription check.
520
-			if ( $this->__is_third_party_addon() ) {
521
-				do_action( 'give_weekly_subscription_check', $this );
520
+			if ($this->__is_third_party_addon()) {
521
+				do_action('give_weekly_subscription_check', $this);
522 522
 
523 523
 				return;
524 524
 			}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 		 * @return void
536 536
 		 */
537 537
 		private function __single_subscription_check() {
538
-			if ( empty( $this->license ) ) {
538
+			if (empty($this->license)) {
539 539
 				return;
540 540
 			}
541 541
 
@@ -546,26 +546,26 @@  discard block
 block discarded – undo
546 546
 			 * By default edd software licensing api does not have api to check subscription.
547 547
 			 * This is a custom feature to check subscriptions.
548 548
 			 */
549
-			$subscription_data = $this->get_license_info( 'check_subscription', true );
549
+			$subscription_data = $this->get_license_info('check_subscription', true);
550 550
 
551
-			if ( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) {
551
+			if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) {
552 552
 
553
-				$subscriptions = get_option( 'give_subscriptions', array() );
553
+				$subscriptions = get_option('give_subscriptions', array());
554 554
 
555 555
 				// Update subscription data only if subscription does not exist already.
556
-				$subscriptions[ $subscription_data['id'] ] = $subscription_data;
556
+				$subscriptions[$subscription_data['id']] = $subscription_data;
557 557
 
558 558
 				// Initiate default set of license for subscription.
559
-				if ( ! isset( $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) {
560
-					$subscriptions[ $subscription_data['id'] ]['licenses'] = array();
559
+				if ( ! isset($subscriptions[$subscription_data['id']]['licenses'])) {
560
+					$subscriptions[$subscription_data['id']]['licenses'] = array();
561 561
 				}
562 562
 
563 563
 				// Store licenses for subscription.
564
-				if ( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) {
565
-					$subscriptions[ $subscription_data['id'] ]['licenses'][] = $this->license;
564
+				if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) {
565
+					$subscriptions[$subscription_data['id']]['licenses'][] = $this->license;
566 566
 				}
567 567
 
568
-				update_option( 'give_subscriptions', $subscriptions, false );
568
+				update_option('give_subscriptions', $subscriptions, false);
569 569
 			}
570 570
 		}
571 571
 
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
 		 */
580 580
 		public function notices() {
581 581
 
582
-			if ( ! current_user_can( 'manage_give_settings' ) ) {
582
+			if ( ! current_user_can('manage_give_settings')) {
583 583
 				return;
584 584
 			}
585 585
 
586 586
 			// Do not show licenses notices on license tab.
587
-			if ( 'licenses' === give_get_current_setting_tab() ) {
587
+			if ('licenses' === give_get_current_setting_tab()) {
588 588
 				return;
589 589
 			}
590 590
 
@@ -593,17 +593,17 @@  discard block
 block discarded – undo
593 593
 			static $addon_license_key_in_subscriptions;
594 594
 
595 595
 			// Set default value.
596
-			$addon_license_key_in_subscriptions = ! empty( $addon_license_key_in_subscriptions ) ? $addon_license_key_in_subscriptions : array();
596
+			$addon_license_key_in_subscriptions = ! empty($addon_license_key_in_subscriptions) ? $addon_license_key_in_subscriptions : array();
597 597
 			$messages                           = array();
598 598
 
599 599
 			// Check whether admin has Give Add-on activated since 24 hours?
600
-			$is_license_notice_hidden = Give_Cache::get( 'give_cache_hide_license_notice_after_activation' );
600
+			$is_license_notice_hidden = Give_Cache::get('give_cache_hide_license_notice_after_activation');
601 601
 
602 602
 			// Display Invalid License notice, if its more than 24 hours since first Give Add-on activation.
603 603
 			if (
604
-				empty( $this->license )
605
-				&& empty( $showed_invalid_message )
606
-				&& ( false === $is_license_notice_hidden )
604
+				empty($this->license)
605
+				&& empty($showed_invalid_message)
606
+				&& (false === $is_license_notice_hidden)
607 607
 			) {
608 608
 
609 609
 				Give()->notices->register_notice(
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 						'id'               => 'give-invalid-license',
612 612
 						'type'             => 'error',
613 613
 						'description'      => sprintf(
614
-							__( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ),
615
-							admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' )
614
+							__('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'),
615
+							admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')
616 616
 						),
617 617
 						'dismissible_type' => 'user',
618 618
 						'dismiss_interval' => 'shortly',
@@ -624,39 +624,39 @@  discard block
 block discarded – undo
624 624
 			}
625 625
 
626 626
 			// Get subscriptions.
627
-			$subscriptions = get_option( 'give_subscriptions' );
627
+			$subscriptions = get_option('give_subscriptions');
628 628
 
629 629
 			// Show subscription messages.
630
-			if ( ! empty( $subscriptions ) && ! $showed_subscriptions_message ) {
630
+			if ( ! empty($subscriptions) && ! $showed_subscriptions_message) {
631 631
 
632
-				foreach ( $subscriptions as $subscription ) {
632
+				foreach ($subscriptions as $subscription) {
633 633
 					// Subscription expires timestamp.
634
-					$subscription_expires = strtotime( $subscription['expires'] );
634
+					$subscription_expires = strtotime($subscription['expires']);
635 635
 
636 636
 					// Start showing subscriptions message before one week of renewal date.
637
-					if ( strtotime( '- 7 days', $subscription_expires ) > current_time( 'timestamp', 1 ) ) {
637
+					if (strtotime('- 7 days', $subscription_expires) > current_time('timestamp', 1)) {
638 638
 						continue;
639 639
 					}
640 640
 
641 641
 					// Check if subscription message already exist in messages.
642
-					if ( array_key_exists( $subscription['id'], $messages ) ) {
642
+					if (array_key_exists($subscription['id'], $messages)) {
643 643
 						continue;
644 644
 					}
645 645
 
646 646
 					// Check if license already expired.
647
-					if ( strtotime( $subscription['expires'] ) < current_time( 'timestamp', 1 ) ) {
647
+					if (strtotime($subscription['expires']) < current_time('timestamp', 1)) {
648 648
 						Give()->notices->register_notice(
649 649
 							array(
650 650
 								'id'               => "give-expired-subscription-{$subscription['id']}",
651 651
 								'type'             => 'error',
652 652
 								'description'      => sprintf(
653
-									__( 'Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give' ),
654
-									urldecode( $subscription['invoice_url'] ),
653
+									__('Your Give add-on license expired for payment <a href="%1$s" target="_blank">#%2$d</a>. <a href="%3$s" target="_blank">Click to renew an existing license</a> or %4$s.', 'give'),
654
+									urldecode($subscription['invoice_url']),
655 655
 									$subscription['payment_id'],
656 656
 									"{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired",
657 657
 									Give()->notices->get_dismiss_link(
658 658
 										array(
659
-											'title'            => __( 'Click here if already renewed', 'give' ),
659
+											'title'            => __('Click here if already renewed', 'give'),
660 660
 											'dismissible_type' => 'user',
661 661
 											'dismiss_interval' => 'permanent',
662 662
 										)
@@ -672,14 +672,14 @@  discard block
 block discarded – undo
672 672
 								'id'               => "give-expires-subscription-{$subscription['id']}",
673 673
 								'type'             => 'error',
674 674
 								'description'      => sprintf(
675
-									__( 'Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give' ),
676
-									human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscription['expires'] ) ),
677
-									urldecode( $subscription['invoice_url'] ),
675
+									__('Your Give add-on license will expire in %1$s for payment <a href="%2$s" target="_blank">#%3$d</a>. <a href="%4$s" target="_blank">Click to renew an existing license</a> or %5$s.', 'give'),
676
+									human_time_diff(current_time('timestamp', 1), strtotime($subscription['expires'])),
677
+									urldecode($subscription['invoice_url']),
678 678
 									$subscription['payment_id'],
679 679
 									"{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired",
680 680
 									Give()->notices->get_dismiss_link(
681 681
 										array(
682
-											'title'            => __( 'Click here if already renewed', 'give' ),
682
+											'title'            => __('Click here if already renewed', 'give'),
683 683
 											'dismissible_type' => 'user',
684 684
 											'dismiss_interval' => 'permanent',
685 685
 										)
@@ -692,16 +692,16 @@  discard block
 block discarded – undo
692 692
 					}
693 693
 
694 694
 					// Stop validation for these license keys.
695
-					$addon_license_key_in_subscriptions = array_merge( $addon_license_key_in_subscriptions, $subscription['licenses'] );
695
+					$addon_license_key_in_subscriptions = array_merge($addon_license_key_in_subscriptions, $subscription['licenses']);
696 696
 				}// End foreach().
697 697
 				$showed_subscriptions_message = true;
698 698
 			}// End if().
699 699
 
700 700
 			// Show Non Subscription Give Add-on messages.
701 701
 			if (
702
-				! in_array( $this->license, $addon_license_key_in_subscriptions )
703
-				&& ! empty( $this->license )
704
-				&& empty( $showed_invalid_message )
702
+				! in_array($this->license, $addon_license_key_in_subscriptions)
703
+				&& ! empty($this->license)
704
+				&& empty($showed_invalid_message)
705 705
 				&& ! $this->is_valid_license()
706 706
 			) {
707 707
 
@@ -710,8 +710,8 @@  discard block
 block discarded – undo
710 710
 						'id'               => 'give-invalid-license',
711 711
 						'type'             => 'error',
712 712
 						'description'      => sprintf(
713
-							__( 'You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ),
714
-							admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' )
713
+							__('You have invalid or expired license keys for one or more Give Add-ons. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'),
714
+							admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')
715 715
 						),
716 716
 						'dismissible_type' => 'user',
717 717
 						'dismiss_interval' => 'shortly',
@@ -733,10 +733,10 @@  discard block
 block discarded – undo
733 733
 		 *
734 734
 		 * @return bool
735 735
 		 */
736
-		public function is_valid_license( $licence_data = null ) {
737
-			$license_data = empty( $licence_data ) ? $this->license_data : $licence_data;
736
+		public function is_valid_license($licence_data = null) {
737
+			$license_data = empty($licence_data) ? $this->license_data : $licence_data;
738 738
 
739
-			if ( apply_filters( 'give_is_valid_license', ( $this->is_license( $license_data ) && 'valid' === $license_data->license ) ) ) {
739
+			if (apply_filters('give_is_valid_license', ($this->is_license($license_data) && 'valid' === $license_data->license))) {
740 740
 				return true;
741 741
 			}
742 742
 
@@ -754,10 +754,10 @@  discard block
 block discarded – undo
754 754
 		 *
755 755
 		 * @return bool
756 756
 		 */
757
-		public function is_license( $licence_data = null ) {
758
-			$license_data = empty( $licence_data ) ? $this->license_data : $licence_data;
757
+		public function is_license($licence_data = null) {
758
+			$license_data = empty($licence_data) ? $this->license_data : $licence_data;
759 759
 
760
-			if ( apply_filters( 'give_is_license', ( is_object( $license_data ) && ! empty( $license_data ) && property_exists( $license_data, 'license' ) ) ) ) {
760
+			if (apply_filters('give_is_license', (is_object($license_data) && ! empty($license_data) && property_exists($license_data, 'license')))) {
761 761
 				return true;
762 762
 			}
763 763
 
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		 * @return bool
774 774
 		 */
775 775
 		private function __is_third_party_addon() {
776
-			return ( false === strpos( $this->api_url, 'givewp.com/' ) );
776
+			return (false === strpos($this->api_url, 'givewp.com/'));
777 777
 		}
778 778
 
779 779
 		/**
@@ -788,25 +788,25 @@  discard block
 block discarded – undo
788 788
 		 * @return bool
789 789
 		 */
790 790
 		private function __remove_license_key_from_subscriptions() {
791
-			$subscriptions = get_option( 'give_subscriptions', array() );
791
+			$subscriptions = get_option('give_subscriptions', array());
792 792
 
793 793
 			// Bailout.
794
-			if ( empty( $this->license ) ) {
794
+			if (empty($this->license)) {
795 795
 				return false;
796 796
 			}
797 797
 
798
-			if ( ! empty( $subscriptions ) ) {
799
-				foreach ( $subscriptions as $subscription_id => $subscription ) {
800
-					$license_index = array_search( $this->license, $subscription['licenses'] );
801
-					if ( false !== $license_index ) {
798
+			if ( ! empty($subscriptions)) {
799
+				foreach ($subscriptions as $subscription_id => $subscription) {
800
+					$license_index = array_search($this->license, $subscription['licenses']);
801
+					if (false !== $license_index) {
802 802
 						// Remove license key.
803
-						unset( $subscriptions[ $subscription_id ]['licenses'][ $license_index ] );
803
+						unset($subscriptions[$subscription_id]['licenses'][$license_index]);
804 804
 
805 805
 						// Rearrange license keys.
806
-						$subscriptions[ $subscription_id ]['licenses'] = array_values( $subscriptions[ $subscription_id ]['licenses'] );
806
+						$subscriptions[$subscription_id]['licenses'] = array_values($subscriptions[$subscription_id]['licenses']);
807 807
 
808 808
 						// Update subscription information.
809
-						update_option( 'give_subscriptions', $subscriptions, false );
809
+						update_option('give_subscriptions', $subscriptions, false);
810 810
 						break;
811 811
 					}
812 812
 				}
@@ -822,17 +822,17 @@  discard block
 block discarded – undo
822 822
 		 *
823 823
 		 * @return bool
824 824
 		 */
825
-		public function plugin_page_notices( $plugin_file, $plugin_data, $status ) {
825
+		public function plugin_page_notices($plugin_file, $plugin_data, $status) {
826 826
 			// Bailout.
827
-			if ( $this->is_valid_license() ) {
827
+			if ($this->is_valid_license()) {
828 828
 				return false;
829 829
 			}
830 830
 
831 831
 			$update_notice_wrap = '<tr class="give-addon-notice-tr active"><td colspan="3" class="colspanchange"><div class="notice inline notice-warning notice-alt give-invalid-license"><p><span class="dashicons dashicons-info"></span> %s</p></div></td></tr>';
832 832
 			$message            = $this->license_state_message();
833 833
 
834
-			if ( ! empty( $message['message'] ) ) {
835
-				echo sprintf( $update_notice_wrap, $message['message'] );
834
+			if ( ! empty($message['message'])) {
835
+				echo sprintf($update_notice_wrap, $message['message']);
836 836
 			}
837 837
 		}
838 838
 
@@ -847,11 +847,11 @@  discard block
 block discarded – undo
847 847
 		public function license_state_message() {
848 848
 			$message_data = array();
849 849
 
850
-			if ( ! $this->is_valid_license() ) {
850
+			if ( ! $this->is_valid_license()) {
851 851
 
852 852
 				$message_data['message'] = sprintf(
853 853
 					'Please <a href="%1$s">activate your license</a> to receive updates and support for the %2$s add-on.',
854
-					esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) ),
854
+					esc_url(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses')),
855 855
 					$this->item_name
856 856
 				);
857 857
 			}
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 			// Bailout.
872 872
 			if (
873 873
 				! Give_Admin_Settings::verify_nonce()
874
-				|| ! current_user_can( 'manage_give_settings' )
874
+				|| ! current_user_can('manage_give_settings')
875 875
 				|| 'licenses' !== give_get_current_setting_tab()
876 876
 			) {
877 877
 				return false;
@@ -879,10 +879,10 @@  discard block
 block discarded – undo
879 879
 
880 880
 			// Security check.
881 881
 			if (
882
-				isset( $_POST[ $this->item_shortname . '_license_key-nonce' ] )
883
-				&& ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' )
882
+				isset($_POST[$this->item_shortname.'_license_key-nonce'])
883
+				&& ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')
884 884
 			) {
885
-				wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
885
+				wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give'), array('response' => 403));
886 886
 			}
887 887
 
888 888
 			return true;
@@ -900,9 +900,9 @@  discard block
 block discarded – undo
900 900
 		 *
901 901
 		 * @return mixed
902 902
 		 */
903
-		public function get_license_info( $edd_action = '', $response_in_array = false ) {
903
+		public function get_license_info($edd_action = '', $response_in_array = false) {
904 904
 
905
-			if ( empty( $edd_action ) ) {
905
+			if (empty($edd_action)) {
906 906
 				return false;
907 907
 			}
908 908
 
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
 			$api_params = array(
911 911
 				'edd_action' => $edd_action, // never change from "edd_" to "give_"!
912 912
 				'license'    => $this->license,
913
-				'item_name'  => urlencode( $this->item_name ),
913
+				'item_name'  => urlencode($this->item_name),
914 914
 				'url'        => home_url(),
915 915
 			);
916 916
 
@@ -925,11 +925,11 @@  discard block
 block discarded – undo
925 925
 			);
926 926
 
927 927
 			// Make sure there are no errors.
928
-			if ( is_wp_error( $response ) ) {
928
+			if (is_wp_error($response)) {
929 929
 				return false;
930 930
 			}
931 931
 
932
-			return json_decode( wp_remote_retrieve_body( $response ), $response_in_array );
932
+			return json_decode(wp_remote_retrieve_body($response), $response_in_array);
933 933
 		}
934 934
 
935 935
 
@@ -945,9 +945,9 @@  discard block
 block discarded – undo
945 945
 			$this->__remove_license_key_from_subscriptions();
946 946
 
947 947
 			// Remove license from database.
948
-			delete_option( "{$this->item_shortname}_license_active" );
949
-			give_delete_option( "{$this->item_shortname}_license_key" );
950
-			unset( $_POST["{$this->item_shortname}_license_key"] );
948
+			delete_option("{$this->item_shortname}_license_active");
949
+			give_delete_option("{$this->item_shortname}_license_key");
950
+			unset($_POST["{$this->item_shortname}_license_key"]);
951 951
 
952 952
 			// Unset license param.
953 953
 			$this->license = '';
@@ -965,8 +965,8 @@  discard block
 block discarded – undo
965 965
 		private function is_deactivating_license() {
966 966
 			$status = false;
967 967
 
968
-			foreach ( $_POST as $key => $value ) {
969
-				if ( false !== strpos( $key, 'license_key_deactivate' ) ) {
968
+			foreach ($_POST as $key => $value) {
969
+				if (false !== strpos($key, 'license_key_deactivate')) {
970 970
 					$status = true;
971 971
 					break;
972 972
 				}
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -249,10 +249,10 @@
 block discarded – undo
249 249
 	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
250 250
 
251 251
 	$admin_message .= sprintf(
252
-		                  '<a href="%1$s">%2$s</a>',
253
-		                  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
254
-		                  __( 'View Donation Details &raquo;', 'give' )
255
-	                  ) . "\n\n";
252
+						  '<a href="%1$s">%2$s</a>',
253
+						  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
254
+						  __( 'View Donation Details &raquo;', 'give' )
255
+					  ) . "\n\n";
256 256
 
257 257
 	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
258 258
 	$admin_message = give_do_email_tags( $admin_message, $payment_id );
Please login to merge, or discard this patch.
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' ),
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give'),
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 /**
34 34
  * Add our payment instructions to the checkout
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
  *
40 40
  * @return void
41 41
  */
42
-function give_offline_payment_cc_form( $form_id ) {
42
+function give_offline_payment_cc_form($form_id) {
43 43
 	// Get offline payment instruction.
44
-	$offline_instructions = give_get_offline_payment_instruction( $form_id, true );
44
+	$offline_instructions = give_get_offline_payment_instruction($form_id, true);
45 45
 
46 46
 	ob_start();
47 47
 
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param int $form_id Give form id.
54 54
 	 */
55
-	do_action( 'give_before_offline_info_fields', $form_id );
55
+	do_action('give_before_offline_info_fields', $form_id);
56 56
 	?>
57 57
     <fieldset id="give_offline_payment_info">
58
-		<?php echo stripslashes( $offline_instructions ); ?>
58
+		<?php echo stripslashes($offline_instructions); ?>
59 59
     </fieldset>
60 60
 	<?php
61 61
 	/**
@@ -65,35 +65,35 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param int $form_id Give form id.
67 67
 	 */
68
-	do_action( 'give_after_offline_info_fields', $form_id );
68
+	do_action('give_after_offline_info_fields', $form_id);
69 69
 
70 70
 	echo ob_get_clean();
71 71
 }
72 72
 
73
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
73
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
74 74
 
75 75
 /**
76 76
  * Give Offline Billing Field
77 77
  *
78 78
  * @param $form_id
79 79
  */
80
-function give_offline_billing_fields( $form_id ) {
80
+function give_offline_billing_fields($form_id) {
81 81
 	//Enable Default CC fields (billing info)
82
-	$post_offline_cc_fields        = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
83
-	$post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
82
+	$post_offline_cc_fields        = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
83
+	$post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
84 84
 
85
-	$global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' );
85
+	$global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields');
86 86
 
87 87
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
88 88
 	if (
89
-		( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) )
90
-		|| ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) )
89
+		(give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields))
90
+		|| (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields))
91 91
 	) {
92
-		give_default_cc_address_fields( $form_id );
92
+		give_default_cc_address_fields($form_id);
93 93
 	}
94 94
 }
95 95
 
96
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
96
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
97 97
 
98 98
 /**
99 99
  * Process the payment
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
  *
105 105
  * @return void
106 106
  */
107
-function give_offline_process_payment( $purchase_data ) {
107
+function give_offline_process_payment($purchase_data) {
108 108
 
109 109
 	// Setup the payment details.
110 110
 	$payment_data = array(
111 111
 		'price'           => $purchase_data['price'],
112 112
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
113
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
114
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
113
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
114
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
115 115
 		'date'            => $purchase_data['date'],
116 116
 		'user_email'      => $purchase_data['user_email'],
117 117
 		'purchase_key'    => $purchase_data['purchase_key'],
118
-		'currency'        => give_get_currency( $purchase_data['post_data']['give-form-id'], $purchase_data ),
118
+		'currency'        => give_get_currency($purchase_data['post_data']['give-form-id'], $purchase_data),
119 119
 		'user_info'       => $purchase_data['user_info'],
120 120
 		'status'          => 'pending',
121 121
 		'gateway'         => 'offline',
@@ -123,18 +123,18 @@  discard block
 block discarded – undo
123 123
 
124 124
 
125 125
 	// record the pending payment
126
-	$payment = give_insert_payment( $payment_data );
126
+	$payment = give_insert_payment($payment_data);
127 127
 
128
-	if ( $payment ) {
128
+	if ($payment) {
129 129
 		give_send_to_success_page();
130 130
 	} else {
131 131
 		// if errors are present, send the user back to the donation form so they can be corrected
132
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
132
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
133 133
 	}
134 134
 
135 135
 }
136 136
 
137
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
137
+add_action('give_gateway_offline', 'give_offline_process_payment');
138 138
 
139 139
 
140 140
 /**
@@ -147,59 +147,59 @@  discard block
 block discarded – undo
147 147
  * @since       1.0
148 148
  * @return void
149 149
  */
150
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
150
+function give_offline_send_donor_instructions($payment_id = 0) {
151 151
 
152
-	$payment_data                      = give_get_payment_meta( $payment_id );
153
-	$post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
152
+	$payment_data                      = give_get_payment_meta($payment_id);
153
+	$post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
154 154
 
155 155
 	//Customize email content depending on whether the single form has been customized
156
-	$email_content = give_get_option( 'global_offline_donation_email' );
156
+	$email_content = give_get_option('global_offline_donation_email');
157 157
 
158
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
159
-		$email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
158
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
159
+		$email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true);
160 160
 	}
161 161
 
162
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
162
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
163 163
 
164 164
 	/**
165 165
 	 * Filters the from name.
166 166
 	 *
167 167
 	 * @since 1.7
168 168
 	 */
169
-	$from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data );
169
+	$from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data);
170 170
 
171
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
171
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
172 172
 
173 173
 	/**
174 174
 	 * Filters the from email.
175 175
 	 *
176 176
 	 * @since 1.7
177 177
 	 */
178
-	$from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data );
178
+	$from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data);
179 179
 
180
-	$to_email = give_get_payment_user_email( $payment_id );
180
+	$to_email = give_get_payment_user_email($payment_id);
181 181
 
182
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
183
-	if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) {
184
-		$subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
182
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
183
+	if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) {
184
+		$subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
185 185
 	}
186 186
 
187
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
188
-	$subject = give_do_email_tags( $subject, $payment_id );
187
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
188
+	$subject = give_do_email_tags($subject, $payment_id);
189 189
 
190
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
191
-	$message     = give_do_email_tags( $email_content, $payment_id );
190
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
191
+	$message     = give_do_email_tags($email_content, $payment_id);
192 192
 
193 193
 	$emails = Give()->emails;
194 194
 
195
-	$emails->__set( 'from_name', $from_name );
196
-	$emails->__set( 'from_email', $from_email );
197
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
195
+	$emails->__set('from_name', $from_name);
196
+	$emails->__set('from_email', $from_email);
197
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
198 198
 
199
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
200
-	$emails->__set( 'headers', $headers );
199
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
200
+	$emails->__set('headers', $headers);
201 201
 
202
-	$emails->send( $to_email, $subject, $message, $attachments );
202
+	$emails->send($to_email, $subject, $message, $attachments);
203 203
 
204 204
 }
205 205
 
@@ -216,54 +216,54 @@  discard block
 block discarded – undo
216 216
  * @return void
217 217
  *
218 218
  */
219
-function give_offline_send_admin_notice( $payment_id = 0 ) {
219
+function give_offline_send_admin_notice($payment_id = 0) {
220 220
 
221 221
 	/* Send an email notification to the admin */
222 222
 	$admin_email = give_get_admin_notice_emails();
223
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
223
+	$user_info   = give_get_payment_meta_user_info($payment_id);
224 224
 
225
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
226
-		$user_data = get_userdata( $user_info['id'] );
225
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
226
+		$user_data = get_userdata($user_info['id']);
227 227
 		$name      = $user_data->display_name;
228
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
229
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
228
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
229
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
230 230
 	} else {
231 231
 		$name = $user_info['email'];
232 232
 	}
233 233
 
234
-	$amount = give_donation_amount( $payment_id );
234
+	$amount = give_donation_amount($payment_id);
235 235
 
236
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id );
236
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id);
237 237
 
238
-	$admin_message = __( 'Dear Admin,', 'give' ) . "\n\n";
239
-	$admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n";
240
-	$admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
238
+	$admin_message = __('Dear Admin,', 'give')."\n\n";
239
+	$admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n";
240
+	$admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
241 241
 
242 242
 
243
-	$admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n";
244
-	$admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n";
243
+	$admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n";
244
+	$admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n";
245 245
 
246 246
 	$admin_message .= sprintf(
247 247
 		                  '<a href="%1$s">%2$s</a>',
248
-		                  admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ),
249
-		                  __( 'View Donation Details &raquo;', 'give' )
250
-	                  ) . "\n\n";
248
+		                  admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id),
249
+		                  __('View Donation Details &raquo;', 'give')
250
+	                  )."\n\n";
251 251
 
252
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
253
-	$admin_message = give_do_email_tags( $admin_message, $payment_id );
252
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
253
+	$admin_message = give_do_email_tags($admin_message, $payment_id);
254 254
 
255
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
256
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
255
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
256
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
257 257
 
258 258
 	//Send Email
259 259
 	$emails = Give()->emails;
260
-	$emails->__set( 'heading', __( 'New Offline Donation', 'give' ) );
260
+	$emails->__set('heading', __('New Offline Donation', 'give'));
261 261
 
262
-	if ( ! empty( $admin_headers ) ) {
263
-		$emails->__set( 'headers', $admin_headers );
262
+	if ( ! empty($admin_headers)) {
263
+		$emails->__set('headers', $admin_headers);
264 264
 	}
265 265
 
266
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
266
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
267 267
 
268 268
 }
269 269
 
@@ -275,20 +275,20 @@  discard block
 block discarded – undo
275 275
  *
276 276
  * @return array
277 277
  */
278
-function give_offline_add_settings( $settings ) {
278
+function give_offline_add_settings($settings) {
279 279
 
280 280
 	// Bailout: Do not show offline gateways setting in to metabox if its disabled globally.
281
-	if ( in_array( 'offline', (array) give_get_option( 'gateways' ) ) ) {
281
+	if (in_array('offline', (array) give_get_option('gateways'))) {
282 282
 		return $settings;
283 283
 	}
284 284
 
285 285
 	//Vars
286 286
 	$prefix = '_give_';
287 287
 
288
-	$is_gateway_active = give_is_gateway_active( 'offline' );
288
+	$is_gateway_active = give_is_gateway_active('offline');
289 289
 
290 290
 	//this gateway isn't active
291
-	if ( ! $is_gateway_active ) {
291
+	if ( ! $is_gateway_active) {
292 292
 		//return settings and bounce
293 293
 		return $settings;
294 294
 	}
@@ -297,34 +297,34 @@  discard block
 block discarded – undo
297 297
 	$check_settings = array(
298 298
 
299 299
 		array(
300
-			'name'    => __( 'Offline Donations', 'give' ),
301
-			'desc'    => __( 'Do you want to customize the donation instructions for this form?', 'give' ),
302
-			'id'      => $prefix . 'customize_offline_donations',
300
+			'name'    => __('Offline Donations', 'give'),
301
+			'desc'    => __('Do you want to customize the donation instructions for this form?', 'give'),
302
+			'id'      => $prefix.'customize_offline_donations',
303 303
 			'type'    => 'radio_inline',
304 304
 			'default' => 'global',
305
-			'options' => apply_filters( 'give_forms_content_options_select', array(
306
-					'global'   => __( 'Global Option', 'give' ),
307
-					'enabled'  => __( 'Customize', 'give' ),
308
-					'disabled' => __( 'Disable', 'give' ),
305
+			'options' => apply_filters('give_forms_content_options_select', array(
306
+					'global'   => __('Global Option', 'give'),
307
+					'enabled'  => __('Customize', 'give'),
308
+					'disabled' => __('Disable', 'give'),
309 309
 				)
310 310
 			),
311 311
 		),
312 312
 		array(
313
-			'name'        => __( 'Billing Fields', 'give' ),
314
-			'desc'        => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
315
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
313
+			'name'        => __('Billing Fields', 'give'),
314
+			'desc'        => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
315
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
316 316
 			'row_classes' => 'give-subfield give-hidden',
317 317
 			'type'        => 'radio_inline',
318 318
 			'default'     => 'disabled',
319 319
 			'options'     => array(
320
-				'enabled'  => __( 'Enabled', 'give' ),
321
-				'disabled' => __( 'Disabled', 'give' ),
320
+				'enabled'  => __('Enabled', 'give'),
321
+				'disabled' => __('Disabled', 'give'),
322 322
 			),
323 323
 		),
324 324
 		array(
325
-			'id'          => $prefix . 'offline_checkout_notes',
326
-			'name'        => __( 'Donation Instructions', 'give' ),
327
-			'desc'        => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
325
+			'id'          => $prefix.'offline_checkout_notes',
326
+			'name'        => __('Donation Instructions', 'give'),
327
+			'desc'        => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
328 328
 			'default'     => give_get_default_offline_donation_content(),
329 329
 			'type'        => 'wysiwyg',
330 330
 			'row_classes' => 'give-subfield give-hidden',
@@ -336,14 +336,14 @@  discard block
 block discarded – undo
336 336
 			'name'  => 'offline_docs',
337 337
 			'type'  => 'docs_link',
338 338
 			'url'   => 'http://docs.givewp.com/settings-gateway-offline-donations',
339
-			'title' => __( 'Offline Donations', 'give' ),
339
+			'title' => __('Offline Donations', 'give'),
340 340
 		),
341 341
 	);
342 342
 
343
-	return array_merge( $settings, $check_settings );
343
+	return array_merge($settings, $check_settings);
344 344
 }
345 345
 
346
-add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' );
346
+add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings');
347 347
 
348 348
 
349 349
 /**
@@ -354,24 +354,24 @@  discard block
 block discarded – undo
354 354
  * @return string
355 355
  */
356 356
 function give_get_default_offline_donation_content() {
357
-	$default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
357
+	$default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
358 358
 	$default_text .= '<ol>';
359 359
 	$default_text .= '<li>';
360 360
 	$default_text .= sprintf(
361 361
 	/* translators: %s: site name */
362
-		__( 'Make a check payable to "{sitename}"', 'give' ) );
362
+		__('Make a check payable to "{sitename}"', 'give') );
363 363
 	$default_text .= '</li>';
364 364
 	$default_text .= '<li>';
365 365
 	$default_text .= sprintf(
366 366
 	/* translators: %s: site name */
367
-		__( 'On the memo line of the check, please indicate that the donation is for "{sitename}"', 'give' ) );
367
+		__('On the memo line of the check, please indicate that the donation is for "{sitename}"', 'give') );
368 368
 	$default_text .= '</li>';
369
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
369
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
370 370
 	$default_text .= '</ol>';
371 371
 	$default_text .= '{offline_mailing_address}<br>';
372
-	$default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
372
+	$default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
373 373
 
374
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
374
+	return apply_filters('give_default_offline_donation_content', $default_text);
375 375
 
376 376
 }
377 377
 
@@ -383,28 +383,28 @@  discard block
 block discarded – undo
383 383
  * @return string
384 384
  */
385 385
 function give_get_default_offline_donation_email_content() {
386
-	$default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>';
387
-	$default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>';
386
+	$default_text = '<p>'.__('Dear {name},', 'give').'</p>';
387
+	$default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>';
388 388
 	$default_text .= '<ol>';
389 389
 	$default_text .= '<li>';
390 390
 	$default_text .= sprintf(
391 391
 	/* translators: %s: site name */
392
-		__( 'Make a check payable to "{sitename}"', 'give' )
392
+		__('Make a check payable to "{sitename}"', 'give')
393 393
 	);
394 394
 	$default_text .= '</li>';
395 395
 	$default_text .= '<li>';
396 396
 	$default_text .= sprintf(
397
-		__( 'On the memo line of the check, please indicate that the donation is for "{sitename}"', 'give' )
397
+		__('On the memo line of the check, please indicate that the donation is for "{sitename}"', 'give')
398 398
 	);
399 399
 	$default_text .= '</li>';
400
-	$default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>';
400
+	$default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>';
401 401
 	$default_text .= '</ol>';
402 402
 	$default_text .= '{offline_mailing_address}<br>';
403
-	$default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
404
-	$default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>';
403
+	$default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
404
+	$default_text .= '<p>'.__('Sincerely,', 'give').'</p>';
405 405
 	$default_text .= '<p>{sitename}</p>';
406 406
 
407
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
407
+	return apply_filters('give_default_offline_donation_content', $default_text);
408 408
 
409 409
 }
410 410
 
@@ -418,35 +418,35 @@  discard block
 block discarded – undo
418 418
  *
419 419
  * @return string
420 420
  */
421
-function give_get_offline_payment_instruction( $form_id, $wpautop = false ) {
421
+function give_get_offline_payment_instruction($form_id, $wpautop = false) {
422 422
 	// Bailout.
423
-	if ( ! $form_id ) {
423
+	if ( ! $form_id) {
424 424
 		return '';
425 425
 	}
426 426
 
427
-	$post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true );
428
-	$post_offline_instructions         = give_get_meta( $form_id, '_give_offline_checkout_notes', true );
429
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
427
+	$post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true);
428
+	$post_offline_instructions         = give_get_meta($form_id, '_give_offline_checkout_notes', true);
429
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
430 430
 	$offline_instructions              = $global_offline_instruction;
431 431
 
432
-	if ( give_is_setting_enabled( $post_offline_customization_option ) ) {
432
+	if (give_is_setting_enabled($post_offline_customization_option)) {
433 433
 		$offline_instructions = $post_offline_instructions;
434 434
 	}
435 435
 
436
-	$settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
436
+	$settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
437 437
 
438 438
 	/* translators: %s: form settings url */
439
-	$offline_instructions = ! empty( $offline_instructions )
439
+	$offline_instructions = ! empty($offline_instructions)
440 440
 		? $offline_instructions
441 441
 		: sprintf(
442
-			__( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ),
442
+			__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'),
443 443
 			$settings_url
444 444
 		);
445 445
 
446
-	$offline_instructions = give_do_email_tags( $offline_instructions, null );
446
+	$offline_instructions = give_do_email_tags($offline_instructions, null);
447 447
 
448 448
 	$formmated_offline_instructions = $wpautop
449
-		? wpautop( do_shortcode( $offline_instructions ) )
449
+		? wpautop(do_shortcode($offline_instructions))
450 450
 		: $offline_instructions;
451 451
 
452 452
 	/**
@@ -477,21 +477,21 @@  discard block
 block discarded – undo
477 477
  *
478 478
  * @return array
479 479
  */
480
-function give_filter_offline_gateway( $gateway_list, $form_id ) {
480
+function give_filter_offline_gateway($gateway_list, $form_id) {
481 481
 	if (
482 482
 		// Show offline payment gateway if enable for new donation form.
483
-		( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) )
483
+		(false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms'))
484 484
 		&& $form_id
485
-		&& ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array( 'enabled', 'global' ) )
485
+		&& ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array('enabled', 'global'))
486 486
 	) {
487
-		unset( $gateway_list['offline'] );
487
+		unset($gateway_list['offline']);
488 488
 	}
489 489
 
490 490
 	// Output.
491 491
 	return $gateway_list;
492 492
 }
493 493
 
494
-add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 );
494
+add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2);
495 495
 
496 496
 /**
497 497
  * Set default gateway to global default payment gateway
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
  *
506 506
  * @return void
507 507
  */
508
-function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) {
508
+function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) {
509 509
 	if (
510
-		! give_is_setting_enabled( $meta_value, array( 'global', 'enabled' ) )
511
-		&& ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) )
510
+		! give_is_setting_enabled($meta_value, array('global', 'enabled'))
511
+		&& ('offline' === give_get_meta($postid, '_give_default_gateway', true))
512 512
 	) {
513
-		give_update_meta( $postid, '_give_default_gateway', 'global' );
513
+		give_update_meta($postid, '_give_default_gateway', 'global');
514 514
 	}
515 515
 }
516 516
 
517
-add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 );
517
+add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3);
Please login to merge, or discard this patch.
includes/admin/tools/export/export-functions.php 1 patch
Spacing   +27 added lines, -28 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
 
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_do_ajax_export() {
27 27
 
28
-	require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php';
28
+	require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php';
29 29
 
30
-	parse_str( $_POST['form'], $form );
30
+	parse_str($_POST['form'], $form);
31 31
 
32 32
 	$_REQUEST = $form = (array) $form;
33 33
 
34
-	if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) {
35
-		die( '-2' );
34
+	if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) {
35
+		die('-2');
36 36
 	}
37 37
 
38 38
 	/**
@@ -42,28 +42,28 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param string $class Export class.
44 44
 	 */
45
-	do_action( 'give_batch_export_class_include', $form['give-export-class'] );
45
+	do_action('give_batch_export_class_include', $form['give-export-class']);
46 46
 
47
-	$step   = absint( $_POST['step'] );
48
-	$class  = sanitize_text_field( $form['give-export-class'] );
47
+	$step   = absint($_POST['step']);
48
+	$class  = sanitize_text_field($form['give-export-class']);
49 49
 
50 50
 	/* @var Give_Batch_Export $export */
51
-	$export = new $class( $step );
51
+	$export = new $class($step);
52 52
 
53
-	if ( ! $export->can_export() ) {
54
-		die( '-1' );
53
+	if ( ! $export->can_export()) {
54
+		die('-1');
55 55
 	}
56 56
 
57
-	if ( ! $export->is_writable ) {
57
+	if ( ! $export->is_writable) {
58 58
 		$json_args = array(
59 59
 			'error'   => true,
60
-			'message' => esc_html__( 'Export location or file not writable.', 'give' )
60
+			'message' => esc_html__('Export location or file not writable.', 'give')
61 61
 		);
62 62
 		echo json_encode($json_args);
63 63
 		exit;
64 64
 	}
65 65
 
66
-	$export->set_properties( give_clean( $_REQUEST ) );
66
+	$export->set_properties(give_clean($_REQUEST));
67 67
 
68 68
 	$export->pre_fetch();
69 69
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 	$percentage = $export->get_percentage_complete();
73 73
 
74
-	if ( $ret ) {
74
+	if ($ret) {
75 75
 
76 76
 		$step += 1;
77 77
 		$json_data = array(
@@ -79,18 +79,17 @@  discard block
 block discarded – undo
79 79
 			'percentage' => $percentage
80 80
 		);
81 81
 
82
-	} elseif ( true === $export->is_empty ) {
82
+	} elseif (true === $export->is_empty) {
83 83
 
84 84
 		$json_data = array(
85 85
 			'error'   => true,
86
-			'message' => esc_html__( 'No data found for export parameters.', 'give' )
86
+			'message' => esc_html__('No data found for export parameters.', 'give')
87 87
 		);
88 88
 
89
-	} elseif ( true === $export->done && true === $export->is_void ) {
89
+	} elseif (true === $export->done && true === $export->is_void) {
90 90
 
91
-		$message = ! empty( $export->message ) ?
92
-			$export->message :
93
-			esc_html__( 'Batch Processing Complete', 'give' );
91
+		$message = ! empty($export->message) ?
92
+			$export->message : esc_html__('Batch Processing Complete', 'give');
94 93
 
95 94
 		$json_data = array(
96 95
 			'success' => true,
@@ -99,23 +98,23 @@  discard block
 block discarded – undo
99 98
 
100 99
 	} else {
101 100
 		
102
-		$args = array_merge( $_REQUEST, array(
101
+		$args = array_merge($_REQUEST, array(
103 102
 			'step'        => $step,
104 103
 			'class'       => $class,
105
-			'nonce'       => wp_create_nonce( 'give-batch-export' ),
104
+			'nonce'       => wp_create_nonce('give-batch-export'),
106 105
 			'give_action' => 'form_batch_export',
107
-		) );
106
+		));
108 107
 
109 108
 		$json_data = array(
110 109
 			'step' => 'done',
111
-			'url' => add_query_arg( $args, admin_url() )
110
+			'url' => add_query_arg($args, admin_url())
112 111
 		);
113 112
 
114 113
 	}
115 114
 
116
-	$export->unset_properties( give_clean( $_REQUEST ), $export );
117
-	echo json_encode( $json_data );
115
+	$export->unset_properties(give_clean($_REQUEST), $export);
116
+	echo json_encode($json_data);
118 117
 	exit;
119 118
 }
120 119
 
121
-add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' );
120
+add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export');
Please login to merge, or discard this patch.