Completed
Pull Request — master (#801)
by
unknown
18:24
created
includes/class-give-db-customers.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 	 *
423 423
 	 * @access  public
424 424
 	 * @since   1.0
425
-     *
426
-     * @param array $args
427
-     *
428
-     * @return array|object|null
425
+	 *
426
+	 * @param array $args
427
+	 *
428
+	 * @return array|object|null
429 429
 	 */
430 430
 	public function get_customers( $args = array() ) {
431
-        /* @var WPDB $wpdb */
431
+		/* @var WPDB $wpdb */
432 432
 		global $wpdb;
433 433
 
434 434
 		$defaults = array(
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 	 *
554 554
 	 * @access  public
555 555
 	 * @since   1.0
556
-     *
557
-     * @param array $args
558
-     *
559
-     * @return int
556
+	 *
557
+	 * @param array $args
558
+	 *
559
+	 * @return int
560 560
 	 */
561 561
 	public function count( $args = array() ) {
562
-        /* @var WPDB $wpdb */
562
+		/* @var WPDB $wpdb */
563 563
 		global $wpdb;
564 564
 
565 565
 		$where = ' WHERE 1=1 ';
Please login to merge, or discard this patch.
includes/class-give-email-access.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	public $error = '';
24 24
 
25 25
 	private $verify_throttle;
26
-    private $token_expiration;
26
+	private $token_expiration;
27 27
 
28 28
 	/**
29 29
 	 * Give_Email_Access constructor.
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @return bool
244 244
 	 */
245 245
 	function is_valid_verify_key( $token ) {
246
-        /* @var WPDB $wpdb */
246
+		/* @var WPDB $wpdb */
247 247
 		global $wpdb;
248 248
 
249 249
 		// See if the verify_key exists
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @since       1.4
11 11
  */
12 12
 
13
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Class Give_Email_Access
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	function __construct() {
31 31
 
32 32
 		// get it started
33
-		add_action( 'init', array( $this, 'init' ) );
33
+		add_action('init', array($this, 'init'));
34 34
 	}
35 35
 
36 36
 
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	function init() {
41 41
 
42
-		$is_enabled = give_get_option( 'email_access' );
42
+		$is_enabled = give_get_option('email_access');
43 43
 
44 44
 		//Non-logged in users only
45
-		if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) {
45
+		if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) {
46 46
 			return;
47 47
 		}
48 48
 
49 49
 		//Are db columns setup?
50
-		$is_setup = give_get_option( 'email_access_installed' );
51
-		if ( empty( $is_setup ) ) {
50
+		$is_setup = give_get_option('email_access_installed');
51
+		if (empty($is_setup)) {
52 52
 			$this->create_columns();
53 53
 		}
54 54
 
55 55
 		// Timeouts
56
-		$this->verify_throttle  = apply_filters( 'give_nl_verify_throttle', 300 );
57
-		$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
56
+		$this->verify_throttle  = apply_filters('give_nl_verify_throttle', 300);
57
+		$this->token_expiration = apply_filters('give_nl_token_expiration', 7200);
58 58
 
59 59
 		// Setup login
60 60
 		$this->check_for_token();
61 61
 
62
-		if ( $this->token_exists ) {
63
-			add_filter( 'give_can_view_receipt', '__return_true' );
64
-			add_filter( 'give_user_pending_verification', '__return_false' );
65
-			add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) );
62
+		if ($this->token_exists) {
63
+			add_filter('give_can_view_receipt', '__return_true');
64
+			add_filter('give_user_pending_verification', '__return_false');
65
+			add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args'));
66 66
 		}
67 67
 	}
68 68
 
@@ -73,24 +73,24 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return bool
75 75
 	 */
76
-	function can_send_email( $customer_id ) {
76
+	function can_send_email($customer_id) {
77 77
 		global $wpdb;
78 78
 
79 79
 		// Prevent multiple emails within X minutes
80
-		$throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle );
80
+		$throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle);
81 81
 
82 82
 		// Does a user row exist?
83 83
 		$exists = (int) $wpdb->get_var(
84
-			$wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id )
84
+			$wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id)
85 85
 		);
86 86
 
87
-		if ( 0 < $exists ) {
87
+		if (0 < $exists) {
88 88
 			$row_id = (int) $wpdb->get_var(
89
-				$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle )
89
+				$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle)
90 90
 			);
91 91
 
92
-			if ( $row_id < 1 ) {
93
-				give_set_error( 'give_email_access_attempts_exhausted', esc_html__( 'Please wait a few minutes before requesting a new email access link.', 'give' ) );
92
+			if ($row_id < 1) {
93
+				give_set_error('give_email_access_attempts_exhausted', esc_html__('Please wait a few minutes before requesting a new email access link.', 'give'));
94 94
 
95 95
 				return false;
96 96
 			}
@@ -106,38 +106,38 @@  discard block
 block discarded – undo
106 106
 	 * @param $customer_id
107 107
 	 * @param $email
108 108
 	 */
109
-	function send_email( $customer_id, $email ) {
109
+	function send_email($customer_id, $email) {
110 110
 
111
-		$verify_key = wp_generate_password( 20, false );
111
+		$verify_key = wp_generate_password(20, false);
112 112
 
113 113
 		// Generate a new verify key
114
-		$this->set_verify_key( $customer_id, $email, $verify_key );
114
+		$this->set_verify_key($customer_id, $email, $verify_key);
115 115
 
116 116
 		// Get the purchase history URL
117
-		$page_id = give_get_option( 'history_page' );
117
+		$page_id = give_get_option('history_page');
118 118
 
119
-		$access_url = add_query_arg( array(
119
+		$access_url = add_query_arg(array(
120 120
 			'give_nl' => $verify_key,
121
-		), get_permalink( $page_id ) );
121
+		), get_permalink($page_id));
122 122
 
123 123
 		//Nice subject and message
124
-		$subject = apply_filters( 'give_email_access_token_subject', sprintf( esc_html__( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) );
124
+		$subject = apply_filters('give_email_access_token_subject', sprintf(esc_html__('Your Access Link to %s', 'give'), get_bloginfo('name')));
125 125
 
126
-		$message = esc_html__( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n";
126
+		$message = esc_html__('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n";
127 127
 
128
-		$message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . esc_html__( 'Access My Donation Details', 'give' ) . ' &raquo;</a>';
128
+		$message .= '<a href="'.esc_url($access_url).'" target="_blank">'.esc_html__('Access My Donation Details', 'give').' &raquo;</a>';
129 129
 
130 130
 		$message .= "\n\n";
131 131
 		$message .= "\n\n";
132
-		$message .= esc_html__( 'Sincerely,', 'give' );
133
-		$message .= "\n" . get_bloginfo( 'name' ) . "\n";
132
+		$message .= esc_html__('Sincerely,', 'give');
133
+		$message .= "\n".get_bloginfo('name')."\n";
134 134
 
135
-		$message = apply_filters( 'give_email_access_token_message', $message );
135
+		$message = apply_filters('give_email_access_token_message', $message);
136 136
 
137 137
 
138 138
 		// Send the email
139
-		Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', esc_html__( 'Your Access Link', 'give' ) ) );
140
-		Give()->emails->send( $email, $subject, $message );
139
+		Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', esc_html__('Your Access Link', 'give')));
140
+		Give()->emails->send($email, $subject, $message);
141 141
 
142 142
 	}
143 143
 
@@ -147,24 +147,24 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	function check_for_token() {
149 149
 
150
-		$token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : '';
150
+		$token = isset($_GET['give_nl']) ? $_GET['give_nl'] : '';
151 151
 
152 152
 		// Check for cookie
153
-		if ( empty( $token ) ) {
154
-			$token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : '';
153
+		if (empty($token)) {
154
+			$token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : '';
155 155
 		}
156 156
 
157
-		if ( ! empty( $token ) ) {
158
-			if ( ! $this->is_valid_token( $token ) ) {
159
-				if ( ! $this->is_valid_verify_key( $token ) ) {
157
+		if ( ! empty($token)) {
158
+			if ( ! $this->is_valid_token($token)) {
159
+				if ( ! $this->is_valid_verify_key($token)) {
160 160
 					return;
161 161
 				}
162 162
 			}
163 163
 
164 164
 			$this->token_exists = true;
165 165
 			// Set cookie
166
-			$lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time();
167
-			@setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
166
+			$lifetime = current_time('timestamp') + Give()->session->set_expiration_time();
167
+			@setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
168 168
 		}
169 169
 	}
170 170
 
@@ -175,18 +175,18 @@  discard block
 block discarded – undo
175 175
 	 *
176 176
 	 * @return bool
177 177
 	 */
178
-	function is_valid_token( $token ) {
178
+	function is_valid_token($token) {
179 179
 
180 180
 		global $wpdb;
181 181
 
182 182
 		// Make sure token isn't expired
183
-		$expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
183
+		$expires = date('Y-m-d H:i:s', time() - $this->token_expiration);
184 184
 
185 185
 		$email = $wpdb->get_var(
186
-			$wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires )
186
+			$wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires)
187 187
 		);
188 188
 
189
-		if ( ! empty( $email ) ) {
189
+		if ( ! empty($email)) {
190 190
 			$this->token_email = $email;
191 191
 			$this->token       = $token;
192 192
 
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		//Set error only if email access form isn't being submitted
197
-		if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) {
198
-			give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give' ) );
197
+		if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) {
198
+			give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give'));
199 199
 		}
200 200
 
201 201
 
@@ -210,25 +210,25 @@  discard block
 block discarded – undo
210 210
 	 * @param $email
211 211
 	 * @param $verify_key
212 212
 	 */
213
-	function set_verify_key( $customer_id, $email, $verify_key ) {
213
+	function set_verify_key($customer_id, $email, $verify_key) {
214 214
 		global $wpdb;
215 215
 
216
-		$now = date( 'Y-m-d H:i:s' );
216
+		$now = date('Y-m-d H:i:s');
217 217
 
218 218
 		// Insert or update?
219 219
 		$row_id = (int) $wpdb->get_var(
220
-			$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id )
220
+			$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id)
221 221
 		);
222 222
 
223 223
 		// Update
224
-		if ( ! empty( $row_id ) ) {
224
+		if ( ! empty($row_id)) {
225 225
 			$wpdb->query(
226
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id )
226
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id)
227 227
 			);
228 228
 		} // Insert
229 229
 		else {
230 230
 			$wpdb->query(
231
-				$wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now )
231
+				$wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now)
232 232
 			);
233 233
 		}
234 234
 	}
@@ -240,20 +240,20 @@  discard block
 block discarded – undo
240 240
 	 *
241 241
 	 * @return bool
242 242
 	 */
243
-	function is_valid_verify_key( $token ) {
243
+	function is_valid_verify_key($token) {
244 244
 		global $wpdb;
245 245
 
246 246
 		// See if the verify_key exists
247 247
 		$row = $wpdb->get_row(
248
-			$wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token )
248
+			$wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token)
249 249
 		);
250 250
 
251
-		$now = date( 'Y-m-d H:i:s' );
251
+		$now = date('Y-m-d H:i:s');
252 252
 
253 253
 		// Set token
254
-		if ( ! empty( $row ) ) {
254
+		if ( ! empty($row)) {
255 255
 			$wpdb->query(
256
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id )
256
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id)
257 257
 			);
258 258
 
259 259
 			$this->token_email = $row->email;
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 *
273 273
 	 * @return mixed
274 274
 	 */
275
-	function users_purchases_args( $args ) {
275
+	function users_purchases_args($args) {
276 276
 		$args['user'] = $this->token_email;
277 277
 
278 278
 		return $args;
@@ -289,11 +289,11 @@  discard block
 block discarded – undo
289 289
 		global $wpdb;
290 290
 
291 291
 		//Create columns in customers table
292
-		$query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" );
292
+		$query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");
293 293
 
294 294
 		//Columns added properly
295
-		if ( $query ) {
296
-			give_update_option( 'email_access_installed', 1 );
295
+		if ($query) {
296
+			give_update_option('email_access_installed', 1);
297 297
 		}
298 298
 
299 299
 	}
Please login to merge, or discard this patch.
includes/gateways/functions.php 1 patch
Spacing   +75 added lines, -75 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,17 +24,17 @@  discard block
 block discarded – undo
24 24
 	// Default, built-in gateways
25 25
 	$gateways = array(
26 26
 		'paypal' => array(
27
-			'admin_label'    => esc_html__( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => esc_html__( 'PayPal', 'give' ),
29
-			'supports'       => array( 'buy_now' )
27
+			'admin_label'    => esc_html__('PayPal Standard', 'give'),
28
+			'checkout_label' => esc_html__('PayPal', 'give'),
29
+			'supports'       => array('buy_now')
30 30
 		),
31 31
 		'manual' => array(
32
-			'admin_label'    => esc_html__( 'Test Payment', 'give' ),
33
-			'checkout_label' => esc_html__( 'Test Payment', 'give' )
32
+			'admin_label'    => esc_html__('Test Payment', 'give'),
33
+			'checkout_label' => esc_html__('Test Payment', 'give')
34 34
 		),
35 35
 	);
36 36
 
37
-	return apply_filters( 'give_payment_gateways', $gateways );
37
+	return apply_filters('give_payment_gateways', $gateways);
38 38
 
39 39
 }
40 40
 
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
 
49 49
 	$gateways = give_get_payment_gateways();
50 50
 
51
-	$enabled = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
51
+	$enabled = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
52 52
 
53 53
 	$gateway_list = array();
54 54
 
55
-	foreach ( $gateways as $key => $gateway ) {
56
-		if ( isset( $enabled[ $key ] ) && $enabled[ $key ] == 1 ) {
57
-			$gateway_list[ $key ] = $gateway;
55
+	foreach ($gateways as $key => $gateway) {
56
+		if (isset($enabled[$key]) && $enabled[$key] == 1) {
57
+			$gateway_list[$key] = $gateway;
58 58
 		}
59 59
 	}
60 60
 
61 61
 	// Set order of payment gateway in list.
62
-	$gateway_list = give_get_ordered_payment_gateways( $gateway_list );
62
+	$gateway_list = give_get_ordered_payment_gateways($gateway_list);
63 63
 
64
-	return apply_filters( 'give_enabled_payment_gateways', $gateway_list );
64
+	return apply_filters('give_enabled_payment_gateways', $gateway_list);
65 65
 }
66 66
 
67 67
 /**
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
  *
74 74
  * @return boolean true if enabled, false otherwise
75 75
  */
76
-function give_is_gateway_active( $gateway ) {
76
+function give_is_gateway_active($gateway) {
77 77
 	$gateways = give_get_enabled_payment_gateways();
78 78
 
79
-	$ret = array_key_exists( $gateway, $gateways );
79
+	$ret = array_key_exists($gateway, $gateways);
80 80
 
81
-	return apply_filters( 'give_is_gateway_active', $ret, $gateway, $gateways );
81
+	return apply_filters('give_is_gateway_active', $ret, $gateway, $gateways);
82 82
 }
83 83
 
84 84
 /**
@@ -91,24 +91,24 @@  discard block
 block discarded – undo
91 91
  *
92 92
  * @return string Gateway ID
93 93
  */
94
-function give_get_default_gateway( $form_id ) {
94
+function give_get_default_gateway($form_id) {
95 95
 
96 96
 	global $give_options;
97 97
 
98
-	$default      = isset( $give_options['default_gateway'] ) && give_is_gateway_active( $give_options['default_gateway'] ) ? $give_options['default_gateway'] : 'paypal';
99
-	$form_default = get_post_meta( $form_id, '_give_default_gateway', true );
98
+	$default      = isset($give_options['default_gateway']) && give_is_gateway_active($give_options['default_gateway']) ? $give_options['default_gateway'] : 'paypal';
99
+	$form_default = get_post_meta($form_id, '_give_default_gateway', true);
100 100
 
101 101
 	//Single Form settings varies compared to the Global default settings
102
-	if ( ! empty( $form_default ) &&
102
+	if ( ! empty($form_default) &&
103 103
 	     $form_id !== null &&
104 104
 	     $default !== $form_default &&
105 105
 	     $form_default !== 'global' &&
106
-	     give_is_gateway_active( $form_default )
106
+	     give_is_gateway_active($form_default)
107 107
 	) {
108 108
 		$default = $form_default;
109 109
 	}
110 110
 
111
-	return apply_filters( 'give_default_gateway', $default );
111
+	return apply_filters('give_default_gateway', $default);
112 112
 }
113 113
 
114 114
 /**
@@ -120,18 +120,18 @@  discard block
 block discarded – undo
120 120
  *
121 121
  * @return string Gateway admin label
122 122
  */
123
-function give_get_gateway_admin_label( $gateway ) {
123
+function give_get_gateway_admin_label($gateway) {
124 124
 	$gateways = give_get_enabled_payment_gateways();
125
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['admin_label'] : $gateway;
126
-	$payment  = isset( $_GET['id'] ) ? absint( $_GET['id'] ) : false;
125
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['admin_label'] : $gateway;
126
+	$payment  = isset($_GET['id']) ? absint($_GET['id']) : false;
127 127
 
128
-	if ( $gateway == 'manual' && $payment ) {
129
-		if ( give_get_payment_amount( $payment ) == 0 ) {
130
-			$label = esc_html__( 'Test Donation', 'give' );
128
+	if ($gateway == 'manual' && $payment) {
129
+		if (give_get_payment_amount($payment) == 0) {
130
+			$label = esc_html__('Test Donation', 'give');
131 131
 		}
132 132
 	}
133 133
 
134
-	return apply_filters( 'give_gateway_admin_label', $label, $gateway );
134
+	return apply_filters('give_gateway_admin_label', $label, $gateway);
135 135
 }
136 136
 
137 137
 /**
@@ -143,15 +143,15 @@  discard block
 block discarded – undo
143 143
  *
144 144
  * @return string Checkout label for the gateway
145 145
  */
146
-function give_get_gateway_checkout_label( $gateway ) {
146
+function give_get_gateway_checkout_label($gateway) {
147 147
 	$gateways = give_get_enabled_payment_gateways();
148
-	$label    = isset( $gateways[ $gateway ] ) ? $gateways[ $gateway ]['checkout_label'] : $gateway;
148
+	$label    = isset($gateways[$gateway]) ? $gateways[$gateway]['checkout_label'] : $gateway;
149 149
 
150
-	if ( $gateway == 'manual' ) {
151
-		$label = esc_html__( 'Test Donation', 'give' );
150
+	if ($gateway == 'manual') {
151
+		$label = esc_html__('Test Donation', 'give');
152 152
 	}
153 153
 
154
-	return apply_filters( 'give_gateway_checkout_label', $label, $gateway );
154
+	return apply_filters('give_gateway_checkout_label', $label, $gateway);
155 155
 }
156 156
 
157 157
 /**
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
  *
164 164
  * @return array Options the gateway supports
165 165
  */
166
-function give_get_gateway_supports( $gateway ) {
166
+function give_get_gateway_supports($gateway) {
167 167
 	$gateways = give_get_enabled_payment_gateways();
168
-	$supports = isset( $gateways[ $gateway ]['supports'] ) ? $gateways[ $gateway ]['supports'] : array();
168
+	$supports = isset($gateways[$gateway]['supports']) ? $gateways[$gateway]['supports'] : array();
169 169
 
170
-	return apply_filters( 'give_gateway_supports', $supports, $gateway );
170
+	return apply_filters('give_gateway_supports', $supports, $gateway);
171 171
 }
172 172
 
173 173
 /**
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
  *
180 180
  * @return bool
181 181
  */
182
-function give_gateway_supports_buy_now( $gateway ) {
183
-	$supports = give_get_gateway_supports( $gateway );
184
-	$ret      = in_array( 'buy_now', $supports );
182
+function give_gateway_supports_buy_now($gateway) {
183
+	$supports = give_get_gateway_supports($gateway);
184
+	$ret      = in_array('buy_now', $supports);
185 185
 
186
-	return apply_filters( 'give_gateway_supports_buy_now', $ret, $gateway );
186
+	return apply_filters('give_gateway_supports_buy_now', $ret, $gateway);
187 187
 }
188 188
 
189 189
 /**
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 	$gateways = give_get_enabled_payment_gateways();
197 197
 	$ret      = false;
198 198
 
199
-	if ( $gateways ) {
200
-		foreach ( $gateways as $gateway_id => $gateway ) {
201
-			if ( give_gateway_supports_buy_now( $gateway_id ) ) {
199
+	if ($gateways) {
200
+		foreach ($gateways as $gateway_id => $gateway) {
201
+			if (give_gateway_supports_buy_now($gateway_id)) {
202 202
 				$ret = true;
203 203
 				break;
204 204
 			}
205 205
 		}
206 206
 	}
207 207
 
208
-	return apply_filters( 'give_give_supports_buy_now', $ret );
208
+	return apply_filters('give_give_supports_buy_now', $ret);
209 209
 }
210 210
 
211 211
 /**
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @return void
220 220
  */
221
-function give_send_to_gateway( $gateway, $payment_data ) {
221
+function give_send_to_gateway($gateway, $payment_data) {
222 222
 
223
-	$payment_data['gateway_nonce'] = wp_create_nonce( 'give-gateway' );
223
+	$payment_data['gateway_nonce'] = wp_create_nonce('give-gateway');
224 224
 
225 225
 	// $gateway must match the ID used when registering the gateway
226
-	do_action( 'give_gateway_' . $gateway, $payment_data );
226
+	do_action('give_gateway_'.$gateway, $payment_data);
227 227
 }
228 228
 
229 229
 
@@ -240,32 +240,32 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @return string $enabled_gateway The slug of the gateway
242 242
  */
243
-function give_get_chosen_gateway( $form_id ) {
243
+function give_get_chosen_gateway($form_id) {
244 244
 	$gateways        = give_get_enabled_payment_gateways();
245
-	$request_form_id = isset( $_REQUEST['give_form_id'] ) ? $_REQUEST['give_form_id'] : 0;
246
-	if ( empty( $request_form_id ) ) {
247
-		$request_form_id = isset( $_REQUEST['form-id'] ) ? $_REQUEST['form-id'] : 0;
245
+	$request_form_id = isset($_REQUEST['give_form_id']) ? $_REQUEST['give_form_id'] : 0;
246
+	if (empty($request_form_id)) {
247
+		$request_form_id = isset($_REQUEST['form-id']) ? $_REQUEST['form-id'] : 0;
248 248
 	}
249
-	$chosen          = give_get_default_gateway( $form_id );
249
+	$chosen          = give_get_default_gateway($form_id);
250 250
 	$enabled_gateway = '';
251 251
 
252 252
 	//Take into account request Form ID args
253
-	if ( ! empty( $request_form_id ) && $form_id == $request_form_id ) {
253
+	if ( ! empty($request_form_id) && $form_id == $request_form_id) {
254 254
 		$chosen = $_REQUEST['payment-mode'];
255 255
 	}
256 256
 
257
-	if ( $chosen ) {
258
-		$enabled_gateway = urldecode( $chosen );
259
-	} else if ( count( $gateways ) >= 1 && ! $chosen ) {
260
-		foreach ( $gateways as $gateway_id => $gateway ):
257
+	if ($chosen) {
258
+		$enabled_gateway = urldecode($chosen);
259
+	} else if (count($gateways) >= 1 && ! $chosen) {
260
+		foreach ($gateways as $gateway_id => $gateway):
261 261
 			$enabled_gateway = $gateway_id;
262 262
 		endforeach;
263 263
 	} else {
264
-		$enabled_gateway = give_get_default_gateway( $form_id );
264
+		$enabled_gateway = give_get_default_gateway($form_id);
265 265
 	}
266 266
 
267 267
 
268
-	return apply_filters( 'give_chosen_gateway', $enabled_gateway );
268
+	return apply_filters('give_chosen_gateway', $enabled_gateway);
269 269
 }
270 270
 
271 271
 /**
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @return int ID of the new log entry
284 284
  */
285
-function give_record_gateway_error( $title = '', $message = '', $parent = 0 ) {
286
-	return give_record_log( $title, $message, $parent, 'gateway_error' );
285
+function give_record_gateway_error($title = '', $message = '', $parent = 0) {
286
+	return give_record_log($title, $message, $parent, 'gateway_error');
287 287
 }
288 288
 
289 289
 /**
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
  *
297 297
  * @return int
298 298
  */
299
-function give_count_sales_by_gateway( $gateway_id = 'paypal', $status = 'publish' ) {
299
+function give_count_sales_by_gateway($gateway_id = 'paypal', $status = 'publish') {
300 300
 
301 301
 	$ret  = 0;
302 302
 	$args = array(
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 		'fields'      => 'ids'
309 309
 	);
310 310
 
311
-	$payments = new WP_Query( $args );
311
+	$payments = new WP_Query($args);
312 312
 
313
-	if ( $payments ) {
313
+	if ($payments) {
314 314
 		$ret = $payments->post_count;
315 315
 	}
316 316
 
@@ -327,27 +327,27 @@  discard block
 block discarded – undo
327 327
  *
328 328
  * @return array $gateways All the available gateways
329 329
  */
330
-function give_get_ordered_payment_gateways( $gateways ) {
330
+function give_get_ordered_payment_gateways($gateways) {
331 331
 
332 332
 	//  Get gateways setting.
333
-	$gateways_setting = isset( $_POST['gateways'] ) ? $_POST['gateways'] : give_get_option( 'gateways' );
333
+	$gateways_setting = isset($_POST['gateways']) ? $_POST['gateways'] : give_get_option('gateways');
334 334
 
335 335
 	// Return from here if we do not have gateways setting.
336
-	if ( empty( $gateways_setting ) ) {
336
+	if (empty($gateways_setting)) {
337 337
 		return $gateways;
338 338
 	}
339 339
 
340 340
 	// Reverse array to order payment gateways.
341
-	$gateways_setting = array_reverse( $gateways_setting );
341
+	$gateways_setting = array_reverse($gateways_setting);
342 342
 
343 343
 	// Reorder gateways array
344
-	foreach ( $gateways_setting as $gateway_key => $value ) {
344
+	foreach ($gateways_setting as $gateway_key => $value) {
345 345
 
346
-		$new_gateway_value = isset( $gateways[ $gateway_key ] ) ? $gateways[ $gateway_key ] : '';
347
-		unset( $gateways[ $gateway_key ] );
346
+		$new_gateway_value = isset($gateways[$gateway_key]) ? $gateways[$gateway_key] : '';
347
+		unset($gateways[$gateway_key]);
348 348
 
349
-		if(!empty($new_gateway_value)) {
350
-			$gateways = array_merge( array( $gateway_key => $new_gateway_value ), $gateways );
349
+		if ( ! empty($new_gateway_value)) {
350
+			$gateways = array_merge(array($gateway_key => $new_gateway_value), $gateways);
351 351
 		}
352 352
 	}
353 353
 
@@ -358,5 +358,5 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @param array $gateways All the available gateways
360 360
 	 */
361
-	return apply_filters( 'give_payment_gateways_order', $gateways );
361
+	return apply_filters('give_payment_gateways_order', $gateways);
362 362
 }
Please login to merge, or discard this patch.
includes/gateways/actions.php 1 patch
Spacing   +13 added lines, -13 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,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param $data
23 23
  */
24
-function give_process_gateway_select( $data ) {
25
-	if ( isset( $_POST['gateway_submit'] ) ) {
26
-		wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) );
24
+function give_process_gateway_select($data) {
25
+	if (isset($_POST['gateway_submit'])) {
26
+		wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode'])));
27 27
 		exit;
28 28
 	}
29 29
 }
30 30
 
31
-add_action( 'give_gateway_select', 'give_process_gateway_select' );
31
+add_action('give_gateway_select', 'give_process_gateway_select');
32 32
 
33 33
 /**
34 34
  * Loads a payment gateway via AJAX
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
  * @return void
38 38
  */
39 39
 function give_load_ajax_gateway() {
40
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
-		do_action( 'give_purchase_form', $_POST['give_form_id'] );
40
+	if (isset($_POST['give_payment_mode'])) {
41
+		do_action('give_purchase_form', $_POST['give_form_id']);
42 42
 		exit();
43 43
 	}
44 44
 }
45 45
 
46
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
47
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
46
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
47
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
48 48
 
49 49
 /**
50 50
  * Sets an error on checkout if no gateways are enabled
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 function give_no_gateway_error() {
56 56
 	$gateways = give_get_enabled_payment_gateways();
57 57
 
58
-	if ( empty( $gateways ) ) {
59
-		give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) );
58
+	if (empty($gateways)) {
59
+		give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give'));
60 60
 	} else {
61
-		give_unset_error( 'no_gateways' );
61
+		give_unset_error('no_gateways');
62 62
 	}
63 63
 }
64 64
 
65
-add_action( 'init', 'give_no_gateway_error' );
66 65
\ No newline at end of file
66
+add_action('init', 'give_no_gateway_error');
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
includes/misc-functions.php 2 patches
Spacing   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 function give_is_test_mode() {
25 25
 	global $give_options;
26 26
 
27
-	$ret = ! empty( $give_options['test_mode'] );
27
+	$ret = ! empty($give_options['test_mode']);
28 28
 
29
-	return (bool) apply_filters( 'give_is_test_mode', $ret );
29
+	return (bool) apply_filters('give_is_test_mode', $ret);
30 30
 }
31 31
 
32 32
 /**
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function give_get_currency() {
39 39
 	global $give_options;
40
-	$currency = isset( $give_options['currency'] ) ? $give_options['currency'] : 'USD';
40
+	$currency = isset($give_options['currency']) ? $give_options['currency'] : 'USD';
41 41
 
42
-	return apply_filters( 'give_currency', $currency );
42
+	return apply_filters('give_currency', $currency);
43 43
 }
44 44
 
45 45
 /**
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function give_get_currency_position() {
53 53
 	global $give_options;
54
-	$currency_pos = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before';
54
+	$currency_pos = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before';
55 55
 
56
-	return apply_filters( 'give_currency_position', $currency_pos );
56
+	return apply_filters('give_currency_position', $currency_pos);
57 57
 }
58 58
 
59 59
 
@@ -66,39 +66,39 @@  discard block
 block discarded – undo
66 66
 
67 67
 function give_get_currencies() {
68 68
 	$currencies = array(
69
-		'USD'  => esc_html__( 'US Dollars ($)', 'give' ),
70
-		'EUR'  => esc_html__( 'Euros (€)', 'give' ),
71
-		'GBP'  => esc_html__( 'Pounds Sterling (£)', 'give' ),
72
-		'AUD'  => esc_html__( 'Australian Dollars ($)', 'give' ),
73
-		'BRL'  => esc_html__( 'Brazilian Real (R$)', 'give' ),
74
-		'CAD'  => esc_html__( 'Canadian Dollars ($)', 'give' ),
75
-		'CZK'  => esc_html__( 'Czech Koruna (Kč)', 'give' ),
76
-		'DKK'  => esc_html__( 'Danish Krone (kr)', 'give' ),
77
-		'HKD'  => esc_html__( 'Hong Kong Dollar ($)', 'give' ),
78
-		'HUF'  => esc_html__( 'Hungarian Forint (Ft)', 'give' ),
79
-		'ILS'  => esc_html__( 'Israeli Shekel (₪)', 'give' ),
80
-		'JPY'  => esc_html__( 'Japanese Yen (¥)', 'give' ),
81
-		'MYR'  => esc_html__( 'Malaysian Ringgits (RM)', 'give' ),
82
-		'MXN'  => esc_html__( 'Mexican Peso ($)', 'give' ),
83
-		'MAD'  => esc_html__( 'Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give' ),
84
-		'NZD'  => esc_html__( 'New Zealand Dollar ($)', 'give' ),
85
-		'NOK'  => esc_html__( 'Norwegian Krone (Kr.)', 'give' ),
86
-		'PHP'  => esc_html__( 'Philippine Pesos (₱)', 'give' ),
87
-		'PLN'  => esc_html__( 'Polish Zloty (zł)', 'give' ),
88
-		'SGD'  => esc_html__( 'Singapore Dollar ($)', 'give' ),
89
-		'KRW'  => esc_html__( 'South Korean Won (₩)', 'give' ),
90
-		'ZAR'  => esc_html__( 'South African Rand (R)', 'give' ),
91
-		'SEK'  => esc_html__( 'Swedish Krona (kr)', 'give' ),
92
-		'CHF'  => esc_html__( 'Swiss Franc (CHF)', 'give' ),
93
-		'TWD'  => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ),
94
-		'THB'  => esc_html__( 'Thai Baht (฿)', 'give' ),
95
-		'INR'  => esc_html__( 'Indian Rupee (₹)', 'give' ),
96
-		'TRY'  => esc_html__( 'Turkish Lira (₺)', 'give' ),
97
-		'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ),
98
-		'RUB'  => esc_html__( 'Russian Rubles (руб)', 'give' )
69
+		'USD'  => esc_html__('US Dollars ($)', 'give'),
70
+		'EUR'  => esc_html__('Euros (€)', 'give'),
71
+		'GBP'  => esc_html__('Pounds Sterling (£)', 'give'),
72
+		'AUD'  => esc_html__('Australian Dollars ($)', 'give'),
73
+		'BRL'  => esc_html__('Brazilian Real (R$)', 'give'),
74
+		'CAD'  => esc_html__('Canadian Dollars ($)', 'give'),
75
+		'CZK'  => esc_html__('Czech Koruna (Kč)', 'give'),
76
+		'DKK'  => esc_html__('Danish Krone (kr)', 'give'),
77
+		'HKD'  => esc_html__('Hong Kong Dollar ($)', 'give'),
78
+		'HUF'  => esc_html__('Hungarian Forint (Ft)', 'give'),
79
+		'ILS'  => esc_html__('Israeli Shekel (₪)', 'give'),
80
+		'JPY'  => esc_html__('Japanese Yen (¥)', 'give'),
81
+		'MYR'  => esc_html__('Malaysian Ringgits (RM)', 'give'),
82
+		'MXN'  => esc_html__('Mexican Peso ($)', 'give'),
83
+		'MAD'  => esc_html__('Moroccan Dirham (&#x2e;&#x62f;&#x2e;&#x645;)', 'give'),
84
+		'NZD'  => esc_html__('New Zealand Dollar ($)', 'give'),
85
+		'NOK'  => esc_html__('Norwegian Krone (Kr.)', 'give'),
86
+		'PHP'  => esc_html__('Philippine Pesos (₱)', 'give'),
87
+		'PLN'  => esc_html__('Polish Zloty (zł)', 'give'),
88
+		'SGD'  => esc_html__('Singapore Dollar ($)', 'give'),
89
+		'KRW'  => esc_html__('South Korean Won (₩)', 'give'),
90
+		'ZAR'  => esc_html__('South African Rand (R)', 'give'),
91
+		'SEK'  => esc_html__('Swedish Krona (kr)', 'give'),
92
+		'CHF'  => esc_html__('Swiss Franc (CHF)', 'give'),
93
+		'TWD'  => esc_html__('Taiwan New Dollars (NT$)', 'give'),
94
+		'THB'  => esc_html__('Thai Baht (฿)', 'give'),
95
+		'INR'  => esc_html__('Indian Rupee (₹)', 'give'),
96
+		'TRY'  => esc_html__('Turkish Lira (₺)', 'give'),
97
+		'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'),
98
+		'RUB'  => esc_html__('Russian Rubles (руб)', 'give')
99 99
 	);
100 100
 
101
-	return apply_filters( 'give_currencies', $currencies );
101
+	return apply_filters('give_currencies', $currencies);
102 102
 }
103 103
 
104 104
 
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
  *
114 114
  * @return string           The symbol to use for the currency
115 115
  */
116
-function give_currency_symbol( $currency = '' ) {
116
+function give_currency_symbol($currency = '') {
117 117
 
118
-	if ( empty( $currency ) ) {
118
+	if (empty($currency)) {
119 119
 		$currency = give_get_currency();
120 120
 	}
121
-	switch ( $currency ) :
121
+	switch ($currency) :
122 122
 		case 'GBP' :
123 123
 			$symbol = '£';
124 124
 			break;
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	endswitch;
198 198
 
199 199
 
200
-	return apply_filters( 'give_currency_symbol', $symbol, $currency );
200
+	return apply_filters('give_currency_symbol', $symbol, $currency);
201 201
 }
202 202
 
203 203
 
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
  */
210 210
 function give_get_current_page_url() {
211 211
 
212
-	if ( is_front_page() ) {
213
-		$current_url = home_url( '/' );
212
+	if (is_front_page()) {
213
+		$current_url = home_url('/');
214 214
 	} else {
215
-		$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . untrailingslashit( $_SERVER['REQUEST_URI'] ) );
215
+		$current_url = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].untrailingslashit($_SERVER['REQUEST_URI']));
216 216
 	}
217 217
 
218
-	return apply_filters( 'give_get_current_page_url', esc_url( $current_url ) );
218
+	return apply_filters('give_get_current_page_url', esc_url($current_url));
219 219
 }
220 220
 
221 221
 
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	$gateways = give_get_enabled_payment_gateways();
238 238
 
239
-	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) {
239
+	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) {
240 240
 		$ret = true;
241
-	} else if ( count( $gateways ) == 1 ) {
241
+	} else if (count($gateways) == 1) {
242 242
 		$ret = false;
243
-	} else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) {
243
+	} else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) {
244 244
 		$ret = false;
245 245
 	}
246 246
 
247
-	return (bool) apply_filters( 'give_verify_credit_cards', $ret );
247
+	return (bool) apply_filters('give_verify_credit_cards', $ret);
248 248
 }
249 249
 
250 250
 /**
@@ -256,26 +256,26 @@  discard block
 block discarded – undo
256 256
 function give_get_timezone_id() {
257 257
 
258 258
 	// if site timezone string exists, return it
259
-	if ( $timezone = get_option( 'timezone_string' ) ) {
259
+	if ($timezone = get_option('timezone_string')) {
260 260
 		return $timezone;
261 261
 	}
262 262
 
263 263
 	// get UTC offset, if it isn't set return UTC
264
-	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) {
264
+	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) {
265 265
 		return 'UTC';
266 266
 	}
267 267
 
268 268
 	// attempt to guess the timezone string from the UTC offset
269
-	$timezone = timezone_name_from_abbr( '', $utc_offset );
269
+	$timezone = timezone_name_from_abbr('', $utc_offset);
270 270
 
271 271
 	// last try, guess timezone string manually
272
-	if ( $timezone === false ) {
272
+	if ($timezone === false) {
273 273
 
274
-		$is_dst = date( 'I' );
274
+		$is_dst = date('I');
275 275
 
276
-		foreach ( timezone_abbreviations_list() as $abbr ) {
277
-			foreach ( $abbr as $city ) {
278
-				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) {
276
+		foreach (timezone_abbreviations_list() as $abbr) {
277
+			foreach ($abbr as $city) {
278
+				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) {
279 279
 					return $city['timezone_id'];
280 280
 				}
281 281
 			}
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 
300 300
 	$ip = '127.0.0.1';
301 301
 
302
-	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
302
+	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) {
303 303
 		//check ip from share internet
304 304
 		$ip = $_SERVER['HTTP_CLIENT_IP'];
305
-	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
305
+	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
306 306
 		//to check ip is pass from proxy
307 307
 		$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
308
-	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
308
+	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) {
309 309
 		$ip = $_SERVER['REMOTE_ADDR'];
310 310
 	}
311 311
 
312
-	return apply_filters( 'give_get_ip', $ip );
312
+	return apply_filters('give_get_ip', $ip);
313 313
 }
314 314
 
315 315
 
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
  *
325 325
  * @uses  Give()->session->set()
326 326
  */
327
-function give_set_purchase_session( $purchase_data = array() ) {
328
-	Give()->session->set( 'give_purchase', $purchase_data );
329
-	Give()->session->set( 'give_email', $purchase_data['user_email'] );
327
+function give_set_purchase_session($purchase_data = array()) {
328
+	Give()->session->set('give_purchase', $purchase_data);
329
+	Give()->session->set('give_email', $purchase_data['user_email']);
330 330
 }
331 331
 
332 332
 /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
  * @return mixed array | false
341 341
  */
342 342
 function give_get_purchase_session() {
343
-	return Give()->session->get( 'give_purchase' );
343
+	return Give()->session->get('give_purchase');
344 344
 }
345 345
 
346 346
 /**
@@ -355,14 +355,14 @@  discard block
 block discarded – undo
355 355
  *
356 356
  * @return string
357 357
  */
358
-function give_get_purchase_summary( $purchase_data, $email = true ) {
358
+function give_get_purchase_summary($purchase_data, $email = true) {
359 359
 	$summary = '';
360 360
 
361
-	if ( $email ) {
362
-		$summary .= $purchase_data['user_email'] . ' - ';
361
+	if ($email) {
362
+		$summary .= $purchase_data['user_email'].' - ';
363 363
 	}
364 364
 
365
-	$summary .= get_the_title( $purchase_data['post_data']['give-form-id'] );
365
+	$summary .= get_the_title($purchase_data['post_data']['give-form-id']);
366 366
 
367 367
 	return $summary;
368 368
 }
@@ -379,31 +379,31 @@  discard block
 block discarded – undo
379 379
 function give_get_host() {
380 380
 	$host = false;
381 381
 
382
-	if ( defined( 'WPE_APIKEY' ) ) {
382
+	if (defined('WPE_APIKEY')) {
383 383
 		$host = 'WP Engine';
384
-	} elseif ( defined( 'PAGELYBIN' ) ) {
384
+	} elseif (defined('PAGELYBIN')) {
385 385
 		$host = 'Pagely';
386
-	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
386
+	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') {
387 387
 		$host = 'ICDSoft';
388
-	} elseif ( DB_HOST == 'mysqlv5' ) {
388
+	} elseif (DB_HOST == 'mysqlv5') {
389 389
 		$host = 'NetworkSolutions';
390
-	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
390
+	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) {
391 391
 		$host = 'iPage';
392
-	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
392
+	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) {
393 393
 		$host = 'IPower';
394
-	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
394
+	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) {
395 395
 		$host = 'MediaTemple Grid';
396
-	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) {
396
+	} elseif (strpos(DB_HOST, '.pair.com') !== false) {
397 397
 		$host = 'pair Networks';
398
-	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
398
+	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) {
399 399
 		$host = 'Rackspace Cloud';
400
-	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
400
+	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) {
401 401
 		$host = 'SysFix.eu Power Hosting';
402
-	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
402
+	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
403 403
 		$host = 'Flywheel';
404 404
 	} else {
405 405
 		// Adding a general fallback for data gathering
406
-		$host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];
406
+		$host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];
407 407
 	}
408 408
 
409 409
 	return $host;
@@ -419,67 +419,67 @@  discard block
 block discarded – undo
419 419
  *
420 420
  * @return bool true if host matches, false if not
421 421
  */
422
-function give_is_host( $host = false ) {
422
+function give_is_host($host = false) {
423 423
 
424 424
 	$return = false;
425 425
 
426
-	if ( $host ) {
427
-		$host = str_replace( ' ', '', strtolower( $host ) );
426
+	if ($host) {
427
+		$host = str_replace(' ', '', strtolower($host));
428 428
 
429
-		switch ( $host ) {
429
+		switch ($host) {
430 430
 			case 'wpengine':
431
-				if ( defined( 'WPE_APIKEY' ) ) {
431
+				if (defined('WPE_APIKEY')) {
432 432
 					$return = true;
433 433
 				}
434 434
 				break;
435 435
 			case 'pagely':
436
-				if ( defined( 'PAGELYBIN' ) ) {
436
+				if (defined('PAGELYBIN')) {
437 437
 					$return = true;
438 438
 				}
439 439
 				break;
440 440
 			case 'icdsoft':
441
-				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) {
441
+				if (DB_HOST == 'localhost:/tmp/mysql5.sock') {
442 442
 					$return = true;
443 443
 				}
444 444
 				break;
445 445
 			case 'networksolutions':
446
-				if ( DB_HOST == 'mysqlv5' ) {
446
+				if (DB_HOST == 'mysqlv5') {
447 447
 					$return = true;
448 448
 				}
449 449
 				break;
450 450
 			case 'ipage':
451
-				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) {
451
+				if (strpos(DB_HOST, 'ipagemysql.com') !== false) {
452 452
 					$return = true;
453 453
 				}
454 454
 				break;
455 455
 			case 'ipower':
456
-				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) {
456
+				if (strpos(DB_HOST, 'ipowermysql.com') !== false) {
457 457
 					$return = true;
458 458
 				}
459 459
 				break;
460 460
 			case 'mediatemplegrid':
461
-				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) {
461
+				if (strpos(DB_HOST, '.gridserver.com') !== false) {
462 462
 					$return = true;
463 463
 				}
464 464
 				break;
465 465
 			case 'pairnetworks':
466
-				if ( strpos( DB_HOST, '.pair.com' ) !== false ) {
466
+				if (strpos(DB_HOST, '.pair.com') !== false) {
467 467
 					$return = true;
468 468
 				}
469 469
 				break;
470 470
 			case 'rackspacecloud':
471
-				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) {
471
+				if (strpos(DB_HOST, '.stabletransit.com') !== false) {
472 472
 					$return = true;
473 473
 				}
474 474
 				break;
475 475
 			case 'sysfix.eu':
476 476
 			case 'sysfix.eupowerhosting':
477
-				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) {
477
+				if (strpos(DB_HOST, '.sysfix.eu') !== false) {
478 478
 					$return = true;
479 479
 				}
480 480
 				break;
481 481
 			case 'flywheel':
482
-				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) {
482
+				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) {
483 483
 					$return = true;
484 484
 				}
485 485
 				break;
@@ -512,20 +512,20 @@  discard block
 block discarded – undo
512 512
  * @param string $replacement Optional. The function that should have been called
513 513
  * @param array $backtrace Optional. Contains stack backtrace of deprecated function
514 514
  */
515
-function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) {
516
-	do_action( 'give_deprecated_function_run', $function, $replacement, $version );
515
+function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) {
516
+	do_action('give_deprecated_function_run', $function, $replacement, $version);
517 517
 
518
-	$show_errors = current_user_can( 'manage_options' );
518
+	$show_errors = current_user_can('manage_options');
519 519
 
520 520
 	// Allow plugin to filter the output error trigger
521
-	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) {
522
-		if ( ! is_null( $replacement ) ) {
523
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );
524
-			trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
521
+	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) {
522
+		if ( ! is_null($replacement)) {
523
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement));
524
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
525 525
 			// Alternatively we could dump this to a file.
526 526
 		} else {
527
-			trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );
528
-			trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
527
+			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version));
528
+			trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
529 529
 			// Alternatively we could dump this to a file.
530 530
 		}
531 531
 	}
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
  * @return string $post_id
540 540
  */
541 541
 function give_get_admin_post_id() {
542
-	$post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;
543
-	if ( ! $post_id && isset( $_POST['post_id'] ) ) {
542
+	$post_id = isset($_GET['post']) ? $_GET['post'] : null;
543
+	if ( ! $post_id && isset($_POST['post_id'])) {
544 544
 		$post_id = $_POST['post_id'];
545 545
 	}
546 546
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
  * @return string Arg separator output
555 555
  */
556 556
 function give_get_php_arg_separator_output() {
557
-	return ini_get( 'arg_separator.output' );
557
+	return ini_get('arg_separator.output');
558 558
 }
559 559
 
560 560
 
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
  *
570 570
  * @return string Short month name
571 571
  */
572
-function give_month_num_to_name( $n ) {
573
-	$timestamp = mktime( 0, 0, 0, $n, 1, 2005 );
572
+function give_month_num_to_name($n) {
573
+	$timestamp = mktime(0, 0, 0, $n, 1, 2005);
574 574
 
575
-	return date_i18n( "M", $timestamp );
575
+	return date_i18n("M", $timestamp);
576 576
 }
577 577
 
578 578
 
@@ -585,10 +585,10 @@  discard block
 block discarded – undo
585 585
  *
586 586
  * @return bool Whether or not function is disabled.
587 587
  */
588
-function give_is_func_disabled( $function ) {
589
-	$disabled = explode( ',', ini_get( 'disable_functions' ) );
588
+function give_is_func_disabled($function) {
589
+	$disabled = explode(',', ini_get('disable_functions'));
590 590
 
591
-	return in_array( $function, $disabled );
591
+	return in_array($function, $disabled);
592 592
 }
593 593
 
594 594
 
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
 		<form action="//givewp.us3.list-manage.com/subscribe/post?u=3ccb75d68bda4381e2f45794c&amp;id=12a081aa13" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
605 605
 			<div class="give-newsletter-confirmation">
606
-				<p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>
606
+				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p>
607 607
 			</div>
608 608
 
609 609
 			<table class="form-table give-newsletter-form">
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
  *
700 700
  * @return mixed
701 701
  */
702
-function give_svg_icons( $icon ) {
702
+function give_svg_icons($icon) {
703 703
 
704 704
 	// Store your SVGs in an associative array
705 705
 	$svgs = array(
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	);
712 712
 
713 713
 	// Return the chosen icon's SVG string
714
-	return $svgs[ $icon ];
714
+	return $svgs[$icon];
715 715
 }
716 716
 
717 717
 /**
@@ -723,15 +723,15 @@  discard block
 block discarded – undo
723 723
  *
724 724
  * @return mixed
725 725
  */
726
-function modify_nav_menu_meta_box_object( $post_type ) {
727
-	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) {
726
+function modify_nav_menu_meta_box_object($post_type) {
727
+	if (isset($post_type->name) && $post_type->name == 'give_forms') {
728 728
 		$post_type->labels->name = 'Donation Forms';
729 729
 	}
730 730
 
731 731
 	return $post_type;
732 732
 }
733 733
 
734
-add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );
734
+add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object');
735 735
 
736 736
 
737 737
 /**
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
  * @license    http://opensource.org/licenses/MIT MIT
745 745
  */
746 746
 
747
-if ( ! function_exists( 'array_column' ) ) {
747
+if ( ! function_exists('array_column')) {
748 748
 	/**
749 749
 	 * Returns the values from a single column of the input array, identified by
750 750
 	 * the $columnKey.
@@ -763,56 +763,56 @@  discard block
 block discarded – undo
763 763
 	 *
764 764
 	 * @return array
765 765
 	 */
766
-	function array_column( $input = null, $columnKey = null, $indexKey = null ) {
766
+	function array_column($input = null, $columnKey = null, $indexKey = null) {
767 767
 		// Using func_get_args() in order to check for proper number of
768 768
 		// parameters and trigger errors exactly as the built-in array_column()
769 769
 		// does in PHP 5.5.
770 770
 		$argc   = func_num_args();
771 771
 		$params = func_get_args();
772 772
 
773
-		if ( $argc < 2 ) {
774
-			trigger_error( "array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING );
773
+		if ($argc < 2) {
774
+			trigger_error("array_column() expects at least 2 parameters, {$argc} given", E_USER_WARNING);
775 775
 
776 776
 			return null;
777 777
 		}
778 778
 
779
-		if ( ! is_array( $params[0] ) ) {
779
+		if ( ! is_array($params[0])) {
780 780
 			trigger_error(
781
-				'array_column() expects parameter 1 to be array, ' . gettype( $params[0] ) . ' given',
781
+				'array_column() expects parameter 1 to be array, '.gettype($params[0]).' given',
782 782
 				E_USER_WARNING
783 783
 			);
784 784
 
785 785
 			return null;
786 786
 		}
787 787
 
788
-		if ( ! is_int( $params[1] )
789
-		     && ! is_float( $params[1] )
790
-		     && ! is_string( $params[1] )
788
+		if ( ! is_int($params[1])
789
+		     && ! is_float($params[1])
790
+		     && ! is_string($params[1])
791 791
 		     && $params[1] !== null
792
-		     && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )
792
+		     && ! (is_object($params[1]) && method_exists($params[1], '__toString'))
793 793
 		) {
794
-			trigger_error( 'array_column(): The column key should be either a string or an integer', E_USER_WARNING );
794
+			trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING);
795 795
 
796 796
 			return false;
797 797
 		}
798 798
 
799
-		if ( isset( $params[2] )
800
-		     && ! is_int( $params[2] )
801
-		     && ! is_float( $params[2] )
802
-		     && ! is_string( $params[2] )
803
-		     && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )
799
+		if (isset($params[2])
800
+		     && ! is_int($params[2])
801
+		     && ! is_float($params[2])
802
+		     && ! is_string($params[2])
803
+		     && ! (is_object($params[2]) && method_exists($params[2], '__toString'))
804 804
 		) {
805
-			trigger_error( 'array_column(): The index key should be either a string or an integer', E_USER_WARNING );
805
+			trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING);
806 806
 
807 807
 			return false;
808 808
 		}
809 809
 
810 810
 		$paramsInput     = $params[0];
811
-		$paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;
811
+		$paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;
812 812
 
813 813
 		$paramsIndexKey = null;
814
-		if ( isset( $params[2] ) ) {
815
-			if ( is_float( $params[2] ) || is_int( $params[2] ) ) {
814
+		if (isset($params[2])) {
815
+			if (is_float($params[2]) || is_int($params[2])) {
816 816
 				$paramsIndexKey = (int) $params[2];
817 817
 			} else {
818 818
 				$paramsIndexKey = (string) $params[2];
@@ -821,26 +821,26 @@  discard block
 block discarded – undo
821 821
 
822 822
 		$resultArray = array();
823 823
 
824
-		foreach ( $paramsInput as $row ) {
824
+		foreach ($paramsInput as $row) {
825 825
 			$key    = $value = null;
826 826
 			$keySet = $valueSet = false;
827 827
 
828
-			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) {
828
+			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) {
829 829
 				$keySet = true;
830
-				$key    = (string) $row[ $paramsIndexKey ];
830
+				$key    = (string) $row[$paramsIndexKey];
831 831
 			}
832 832
 
833
-			if ( $paramsColumnKey === null ) {
833
+			if ($paramsColumnKey === null) {
834 834
 				$valueSet = true;
835 835
 				$value    = $row;
836
-			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) {
836
+			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) {
837 837
 				$valueSet = true;
838
-				$value    = $row[ $paramsColumnKey ];
838
+				$value    = $row[$paramsColumnKey];
839 839
 			}
840 840
 
841
-			if ( $valueSet ) {
842
-				if ( $keySet ) {
843
-					$resultArray[ $key ] = $value;
841
+			if ($valueSet) {
842
+				if ($keySet) {
843
+					$resultArray[$key] = $value;
844 844
 				} else {
845 845
 					$resultArray[] = $value;
846 846
 				}
@@ -862,40 +862,40 @@  discard block
 block discarded – undo
862 862
  *
863 863
  * @return bool Whether the receipt is visible or not.
864 864
  */
865
-function give_can_view_receipt( $payment_key = '' ) {
865
+function give_can_view_receipt($payment_key = '') {
866 866
 
867 867
 	$return = false;
868 868
 
869
-	if ( empty( $payment_key ) ) {
869
+	if (empty($payment_key)) {
870 870
 		return $return;
871 871
 	}
872 872
 
873 873
 	global $give_receipt_args;
874 874
 
875
-	$give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );
875
+	$give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);
876 876
 
877
-	$user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );
877
+	$user_id = (int) give_get_payment_user_id($give_receipt_args['id']);
878 878
 
879
-	$payment_meta = give_get_payment_meta( $give_receipt_args['id'] );
879
+	$payment_meta = give_get_payment_meta($give_receipt_args['id']);
880 880
 
881
-	if ( is_user_logged_in() ) {
882
-		if ( $user_id === (int) get_current_user_id() ) {
881
+	if (is_user_logged_in()) {
882
+		if ($user_id === (int) get_current_user_id()) {
883 883
 			$return = true;
884
-		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) {
884
+		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) {
885 885
 			$return = true;
886
-		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) {
886
+		} elseif (current_user_can('view_give_sensitive_data')) {
887 887
 			$return = true;
888 888
 		}
889 889
 	}
890 890
 
891 891
 	$session = give_get_purchase_session();
892
-	if ( ! empty( $session ) && ! is_user_logged_in() ) {
893
-		if ( $session['purchase_key'] === $payment_meta['key'] ) {
892
+	if ( ! empty($session) && ! is_user_logged_in()) {
893
+		if ($session['purchase_key'] === $payment_meta['key']) {
894 894
 			$return = true;
895 895
 		}
896 896
 	}
897 897
 
898
-	return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );
898
+	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key);
899 899
 
900 900
 }
901 901
 
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
  *
905 905
  * @description: Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar
906 906
  */
907
-if ( ! function_exists( 'cal_days_in_month' ) ) {
907
+if ( ! function_exists('cal_days_in_month')) {
908 908
 	/**
909 909
 	 * cal_days_in_month
910 910
 	 *
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	 *
915 915
 	 * @return bool|string
916 916
 	 */
917
-	function cal_days_in_month( $calendar, $month, $year ) {
918
-		return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );
917
+	function cal_days_in_month($calendar, $month, $year) {
918
+		return date('t', mktime(0, 0, 0, $month, 1, $year));
919 919
 	}
920 920
 }
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
  *
338 338
  * @since 1.0
339 339
  * @uses  Give()->session->get()
340
- * @return mixed array | false
340
+ * @return string array | false
341 341
  */
342 342
 function give_get_purchase_session() {
343 343
 	return Give()->session->get( 'give_purchase' );
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 /**
696 696
  * Create SVG library function
697 697
  *
698
- * @param $icon
698
+ * @param string $icon
699 699
  *
700
- * @return mixed
700
+ * @return string
701 701
  */
702 702
 function give_svg_icons( $icon ) {
703 703
 
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 	 *
755 755
 	 * @param array $input A multi-dimensional array (record set) from which to pull
756 756
 	 *                         a column of values.
757
-	 * @param mixed $columnKey The column of values to return. This value may be the
757
+	 * @param string $columnKey The column of values to return. This value may be the
758 758
 	 *                         integer key of the column you wish to retrieve, or it
759 759
 	 *                         may be the string key name for an associative array.
760 760
 	 * @param mixed $indexKey (Optional.) The column to use as the index/keys for
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
 	/**
909 909
 	 * cal_days_in_month
910 910
 	 *
911
-	 * @param $calendar
911
+	 * @param integer $calendar
912 912
 	 * @param $month
913 913
 	 * @param $year
914 914
 	 *
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-form.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 /**
15 15
  * Class Give_Shortcode_Donation_Form
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title']   = esc_html__( 'Donation Form', 'give' );
25
-		$this->shortcode['label']   = esc_html__( 'Donation Form', 'give' );
24
+		$this->shortcode['title']   = esc_html__('Donation Form', 'give');
25
+		$this->shortcode['label']   = esc_html__('Donation Form', 'give');
26 26
 
27
-		parent::__construct( 'give_form' );
27
+		parent::__construct('give_form');
28 28
 	}
29 29
 
30 30
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
 		$create_form_link = sprintf(
38 38
 			/* translators: %s: create new form URL */
39
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
40
-			admin_url( 'post-new.php?post_type=give_forms' )
39
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
40
+			admin_url('post-new.php?post_type=give_forms')
41 41
 		);
42 42
 
43 43
 		return array(
@@ -47,68 +47,68 @@  discard block
 block discarded – undo
47 47
 					'post_type' => 'give_forms',
48 48
 				),
49 49
 				'name'        => 'id',
50
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
51
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
50
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
51
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
52 52
 				'required'    => array(
53
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
54
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ),
53
+					'alert' => esc_html__('You must first select a Form!', 'give'),
54
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type' => 'container',
59
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional form settings', 'give' ) ),
59
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional form settings', 'give')),
60 60
 			),
61 61
 			array(
62 62
 				'type'    => 'listbox',
63 63
 				'name'    => 'show_title',
64
-				'label'   => esc_html__( 'Show Title:', 'give' ),
65
-				'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
64
+				'label'   => esc_html__('Show Title:', 'give'),
65
+				'tooltip' => esc_attr__('Do you want to display the form title?', 'give'),
66 66
 				'options' => array(
67
-					'true'  => esc_html__( 'Show', 'give' ),
68
-					'false' => esc_html__( 'Hide', 'give' ),
67
+					'true'  => esc_html__('Show', 'give'),
68
+					'false' => esc_html__('Hide', 'give'),
69 69
 				),
70 70
 			),
71 71
 			array(
72 72
 				'type'    => 'listbox',
73 73
 				'name'    => 'show_goal',
74
-				'label'   => esc_html__( 'Show Goal:', 'give' ),
75
-				'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
74
+				'label'   => esc_html__('Show Goal:', 'give'),
75
+				'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'),
76 76
 				'options' => array(
77
-					'true'  => esc_html__( 'Show', 'give' ),
78
-					'false' => esc_html__( 'Hide', 'give' ),
77
+					'true'  => esc_html__('Show', 'give'),
78
+					'false' => esc_html__('Hide', 'give'),
79 79
 				),
80 80
 			),
81 81
 			array(
82 82
 				'type'    => 'listbox',
83 83
 				'name'    => 'show_content',
84 84
 				'minWidth' => 240,
85
-				'label'   => esc_html__( 'Display Content:', 'give' ),
86
-				'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ),
85
+				'label'   => esc_html__('Display Content:', 'give'),
86
+				'tooltip' => esc_attr__('Do you want to display the form content?', 'give'),
87 87
 				'options' => array(
88
-					'none'  => esc_html__( 'No Content', 'give' ),
89
-					'above' => esc_html__( 'Display above the form fields', 'give' ),
90
-					'below' => esc_html__( 'Display below the form fields', 'give' ),
88
+					'none'  => esc_html__('No Content', 'give'),
89
+					'above' => esc_html__('Display above the form fields', 'give'),
90
+					'below' => esc_html__('Display below the form fields', 'give'),
91 91
 				),
92 92
 			),
93 93
 			array(
94 94
 				'type'    => 'listbox',
95 95
 				'name'    => 'display_style',
96
-				'label'   => esc_html__( 'Payment Fields:', 'give' ),
97
-				'tooltip' => esc_attr__( 'How would you like to display payment information?', 'give' ),
96
+				'label'   => esc_html__('Payment Fields:', 'give'),
97
+				'tooltip' => esc_attr__('How would you like to display payment information?', 'give'),
98 98
 				'options' => array(
99
-					'onpage' => esc_html__( 'Show on Page', 'give' ),
100
-					'reveal' => esc_html__( 'Reveal Upon Click', 'give' ),
101
-					'modal'  => esc_html__( 'Modal Window Upon Click', 'give' ),
99
+					'onpage' => esc_html__('Show on Page', 'give'),
100
+					'reveal' => esc_html__('Reveal Upon Click', 'give'),
101
+					'modal'  => esc_html__('Modal Window Upon Click', 'give'),
102 102
 				),
103 103
 			),
104 104
 			array(
105 105
 				'type'    => 'listbox',
106 106
 				'name'    => 'float_labels',
107
-				'label'   => esc_html__( 'Floating Labels:', 'give' ),
108
-				'tooltip' => esc_attr__( 'Override the default floating labels setting for this form?', 'give' ),
107
+				'label'   => esc_html__('Floating Labels:', 'give'),
108
+				'tooltip' => esc_attr__('Override the default floating labels setting for this form?', 'give'),
109 109
 				'options' => array(
110
-					'enabled'  => esc_html__( 'Enabled', 'give' ),
111
-					'disabled' => esc_html__( 'Disabled', 'give' ),
110
+					'enabled'  => esc_html__('Enabled', 'give'),
111
+					'disabled' => esc_html__('Disabled', 'give'),
112 112
 				),
113 113
 			),
114 114
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-profile-editor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator {
15 15
 
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' );
21
+		$this->shortcode['label'] = esc_html__('Profile Editor', 'give');
22 22
 
23
-		parent::__construct( 'give_profile_editor' );
23
+		parent::__construct('give_profile_editor');
24 24
 	}
25 25
 }
26 26
 
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-receipt.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' );
22
-		$this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' );
21
+		$this->shortcode['title'] = esc_html__('Donation Receipt', 'give');
22
+		$this->shortcode['label'] = esc_html__('Donation Receipt', 'give');
23 23
 
24
-		parent::__construct( 'give_receipt' );
24
+		parent::__construct('give_receipt');
25 25
 	}
26 26
 
27 27
 	/**
@@ -34,60 +34,60 @@  discard block
 block discarded – undo
34 34
 		return array(
35 35
 			array(
36 36
 				'type' => 'container',
37
-				'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
37
+				'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')),
38 38
 			),
39 39
 			array(
40 40
 				'type'    => 'listbox',
41 41
 				'name'    => 'price',
42
-				'label'   => esc_html__( 'Show Donation Amount:', 'give' ),
42
+				'label'   => esc_html__('Show Donation Amount:', 'give'),
43 43
 				'options' => array(
44
-					'true'  => esc_html__( 'Show', 'give' ),
45
-					'false' => esc_html__( 'Hide', 'give' ),
44
+					'true'  => esc_html__('Show', 'give'),
45
+					'false' => esc_html__('Hide', 'give'),
46 46
 				),
47 47
 			),
48 48
 			array(
49 49
 				'type'    => 'listbox',
50 50
 				'name'    => 'donor',
51
-				'label'   => esc_html__( 'Show Donor Name:', 'give' ),
51
+				'label'   => esc_html__('Show Donor Name:', 'give'),
52 52
 				'options' => array(
53
-					'true'  => esc_html__( 'Show', 'give' ),
54
-					'false' => esc_html__( 'Hide', 'give' ),
53
+					'true'  => esc_html__('Show', 'give'),
54
+					'false' => esc_html__('Hide', 'give'),
55 55
 				),
56 56
 			),
57 57
 			array(
58 58
 				'type'    => 'listbox',
59 59
 				'name'    => 'date',
60
-				'label'   => esc_html__( 'Show Date:', 'give' ),
60
+				'label'   => esc_html__('Show Date:', 'give'),
61 61
 				'options' => array(
62
-					'true'  => esc_html__( 'Show', 'give' ),
63
-					'false' => esc_html__( 'Hide', 'give' ),
62
+					'true'  => esc_html__('Show', 'give'),
63
+					'false' => esc_html__('Hide', 'give'),
64 64
 				),
65 65
 			),
66 66
 			array(
67 67
 				'type'    => 'listbox',
68 68
 				'name'    => 'payment_key',
69
-				'label'   => esc_html__( 'Show Payment Key:', 'give' ),
69
+				'label'   => esc_html__('Show Payment Key:', 'give'),
70 70
 				'options' => array(
71
-					'true'  => esc_html__( 'Show', 'give' ),
72
-					'false' => esc_html__( 'Hide', 'give' ),
71
+					'true'  => esc_html__('Show', 'give'),
72
+					'false' => esc_html__('Hide', 'give'),
73 73
 				),
74 74
 			),
75 75
 			array(
76 76
 				'type'    => 'listbox',
77 77
 				'name'    => 'payment_method',
78
-				'label'   => esc_html__( 'Show Payment Method:', 'give' ),
78
+				'label'   => esc_html__('Show Payment Method:', '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'    => 'payment_id',
87
-				'label'   => esc_html__( 'Show Payment ID:', 'give' ),
87
+				'label'   => esc_html__('Show Payment ID:', 'give'),
88 88
 				'options' => array(
89
-					'true'  => esc_html__( 'Show', 'give' ),
90
-					'false' => esc_html__( 'Hide', 'give' ),
89
+					'true'  => esc_html__('Show', 'give'),
90
+					'false' => esc_html__('Hide', 'give'),
91 91
 				),
92 92
 			),
93 93
 		);
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-goal.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since       1.3.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) or exit;
12
+defined('ABSPATH') or exit;
13 13
 
14 14
 class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator {
15 15
 
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function __construct() {
20 20
 
21
-		$this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' );
22
-		$this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' );
21
+		$this->shortcode['title'] = esc_html__('Donation Form Goal', 'give');
22
+		$this->shortcode['label'] = esc_html__('Donation Form Goal', 'give');
23 23
 
24
-		parent::__construct( 'give_goal' );
24
+		parent::__construct('give_goal');
25 25
 	}
26 26
 
27 27
 	/**
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$create_form_link = sprintf(
35 35
 			/* translators: %s: create new form URL */
36
-			__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
37
-			admin_url( 'post-new.php?post_type=give_forms' )
36
+			__('<a href="%s">Create</a> a new Donation Form.', 'give'),
37
+			admin_url('post-new.php?post_type=give_forms')
38 38
 		);
39 39
 
40 40
 		return array(
@@ -44,35 +44,35 @@  discard block
 block discarded – undo
44 44
 					'post_type' => 'give_forms',
45 45
 				),
46 46
 				'name'        => 'id',
47
-				'tooltip'     => esc_attr__( 'Select a Donation Form', 'give' ),
48
-				'placeholder' => esc_attr__( '- Select a Form -', 'give' ),
47
+				'tooltip'     => esc_attr__('Select a Donation Form', 'give'),
48
+				'placeholder' => esc_attr__('- Select a Form -', 'give'),
49 49
 				'required'    => array(
50
-					'alert' => esc_html__( 'You must first select a Form!', 'give' ),
51
-					'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ),
50
+					'alert' => esc_html__('You must first select a Form!', 'give'),
51
+					'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link),
52 52
 				),
53 53
 			),
54 54
 			array(
55 55
 				'type' => 'container',
56
-				'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
56
+				'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')),
57 57
 			),
58 58
 			array(
59 59
 				'type'    => 'listbox',
60 60
 				'name'    => 'show_text',
61
-				'label'   => esc_html__( 'Show Text:', 'give' ),
62
-				'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ),
61
+				'label'   => esc_html__('Show Text:', 'give'),
62
+				'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'),
63 63
 				'options' => array(
64
-					'true'  => esc_html__( 'Show', 'give' ),
65
-					'false' => esc_html__( 'Hide', 'give' ),
64
+					'true'  => esc_html__('Show', 'give'),
65
+					'false' => esc_html__('Hide', 'give'),
66 66
 				),
67 67
 			),
68 68
 			array(
69 69
 				'type'    => 'listbox',
70 70
 				'name'    => 'show_bar',
71
-				'label'   => esc_html__( 'Show Progress Bar:', 'give' ),
72
-				'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ),
71
+				'label'   => esc_html__('Show Progress Bar:', 'give'),
72
+				'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'),
73 73
 				'options' => array(
74
-					'true'  => esc_html__( 'Show', 'give' ),
75
-					'false' => esc_html__( 'Hide', 'give' ),
74
+					'true'  => esc_html__('Show', 'give'),
75
+					'false' => esc_html__('Hide', 'give'),
76 76
 				),
77 77
 			),
78 78
 		);
Please login to merge, or discard this patch.