Completed
Pull Request — master (#703)
by
unknown
17:23
created
includes/emails/class-give-emails.php 1 patch
Spacing   +58 added lines, -58 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
 
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function __construct() {
81 81
 
82
-		if ( 'none' === $this->get_template() ) {
82
+		if ('none' === $this->get_template()) {
83 83
 			$this->html = false;
84 84
 		}
85 85
 
86
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
87
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
86
+		add_action('give_email_send_before', array($this, 'send_before'));
87
+		add_action('give_email_send_after', array($this, 'send_after'));
88 88
 
89 89
 	}
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @since 1.0
95 95
 	 */
96
-	public function __set( $key, $value ) {
96
+	public function __set($key, $value) {
97 97
 		$this->$key = $value;
98 98
 	}
99 99
 
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 	 * @since 1.0
104 104
 	 */
105 105
 	public function get_from_name() {
106
-		if ( ! $this->from_name ) {
107
-			$this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) );
106
+		if ( ! $this->from_name) {
107
+			$this->from_name = give_get_option('from_name', get_bloginfo('name'));
108 108
 		}
109 109
 
110
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
110
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
111 111
 	}
112 112
 
113 113
 	/**
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 	 * @since 1.0
117 117
 	 */
118 118
 	public function get_from_address() {
119
-		if ( ! $this->from_address ) {
120
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
119
+		if ( ! $this->from_address) {
120
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
121 121
 		}
122 122
 
123
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
123
+		return apply_filters('give_email_from_address', $this->from_address, $this);
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,13 +129,13 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.0
130 130
 	 */
131 131
 	public function get_content_type() {
132
-		if ( ! $this->content_type && $this->html ) {
133
-			$this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this );
134
-		} else if ( ! $this->html ) {
132
+		if ( ! $this->content_type && $this->html) {
133
+			$this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this);
134
+		} else if ( ! $this->html) {
135 135
 			$this->content_type = 'text/plain';
136 136
 		}
137 137
 
138
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
138
+		return apply_filters('give_email_content_type', $this->content_type, $this);
139 139
 	}
140 140
 
141 141
 	/**
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 	 * @since 1.0
145 145
 	 */
146 146
 	public function get_headers() {
147
-		if ( ! $this->headers ) {
147
+		if ( ! $this->headers) {
148 148
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
149 149
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
150 150
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
151 151
 		}
152 152
 
153
-		return apply_filters( 'give_email_headers', $this->headers, $this );
153
+		return apply_filters('give_email_headers', $this->headers, $this);
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function get_templates() {
162 162
 		$templates = array(
163
-			'default' => __( 'Default Template', 'give' ),
164
-			'none'    => __( 'No template, plain text only', 'give' )
163
+			'default' => __('Default Template', 'give'),
164
+			'none'    => __('No template, plain text only', 'give')
165 165
 		);
166 166
 
167
-		return apply_filters( 'give_email_templates', $templates );
167
+		return apply_filters('give_email_templates', $templates);
168 168
 	}
169 169
 
170 170
 	/**
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 	 * @since 1.0
174 174
 	 */
175 175
 	public function get_template() {
176
-		if ( ! $this->template ) {
177
-			$this->template = give_get_option( 'email_template', 'default' );
176
+		if ( ! $this->template) {
177
+			$this->template = give_get_option('email_template', 'default');
178 178
 		}
179 179
 
180
-		return apply_filters( 'give_email_template', $this->template );
180
+		return apply_filters('give_email_template', $this->template);
181 181
 	}
182 182
 
183 183
 	/**
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 	 * @since 1.0
187 187
 	 */
188 188
 	public function get_heading() {
189
-		return apply_filters( 'give_email_heading', $this->heading );
189
+		return apply_filters('give_email_heading', $this->heading);
190 190
 	}
191 191
 
192 192
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 *
197 197
 	 * @return mixed
198 198
 	 */
199
-	public function parse_tags( $content ) {
199
+	public function parse_tags($content) {
200 200
 
201 201
 		// The email tags are parsed during setup for purchase receipts and sale notifications
202 202
 		// Once tags are not restricted to payments, we'll expand this. @see https://github.com/easydigitaldownloads/Easy-Digital-Downloads/issues/2151
@@ -209,36 +209,36 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @since 1.0
211 211
 	 */
212
-	public function build_email( $message ) {
212
+	public function build_email($message) {
213 213
 
214
-		if ( false === $this->html ) {
215
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
214
+		if (false === $this->html) {
215
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
216 216
 		}
217 217
 
218
-		$message = $this->text_to_html( $message );
218
+		$message = $this->text_to_html($message);
219 219
 
220 220
 		ob_start();
221 221
 
222
-		give_get_template_part( 'emails/header', $this->get_template(), true );
222
+		give_get_template_part('emails/header', $this->get_template(), true);
223 223
 
224
-		do_action( 'give_email_header', $this );
224
+		do_action('give_email_header', $this);
225 225
 
226
-		if ( has_action( 'give_email_template_' . $this->get_template() ) ) {
227
-			do_action( 'give_email_template_' . $this->get_template() );
226
+		if (has_action('give_email_template_'.$this->get_template())) {
227
+			do_action('give_email_template_'.$this->get_template());
228 228
 		} else {
229
-			give_get_template_part( 'emails/body', $this->get_template(), true );
229
+			give_get_template_part('emails/body', $this->get_template(), true);
230 230
 		}
231 231
 
232
-		do_action( 'give_email_body', $this );
232
+		do_action('give_email_body', $this);
233 233
 
234
-		give_get_template_part( 'emails/footer', $this->get_template(), true );
234
+		give_get_template_part('emails/footer', $this->get_template(), true);
235 235
 
236
-		do_action( 'give_email_footer', $this );
236
+		do_action('give_email_footer', $this);
237 237
 
238 238
 		$body    = ob_get_clean();
239
-		$message = str_replace( '{email}', $message, $body );
239
+		$message = str_replace('{email}', $message, $body);
240 240
 
241
-		return apply_filters( 'give_email_message', $message, $this );
241
+		return apply_filters('give_email_message', $message, $this);
242 242
 	}
243 243
 
244 244
 	/**
@@ -251,26 +251,26 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @return bool
253 253
 	 */
254
-	public function send( $to, $subject, $message, $attachments = '' ) {
254
+	public function send($to, $subject, $message, $attachments = '') {
255 255
 
256
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
257
-			_doing_it_wrong( __FUNCTION__, __( 'You cannot send email with Give_Emails until init/admin_init has been reached', 'give' ), null );
256
+		if ( ! did_action('init') && ! did_action('admin_init')) {
257
+			_doing_it_wrong(__FUNCTION__, __('You cannot send email with Give_Emails until init/admin_init has been reached', 'give'), null);
258 258
 
259 259
 			return false;
260 260
 		}
261 261
 
262
-		do_action( 'give_email_send_before', $this );
262
+		do_action('give_email_send_before', $this);
263 263
 
264
-		$subject = $this->parse_tags( $subject );
265
-		$message = $this->parse_tags( $message );
264
+		$subject = $this->parse_tags($subject);
265
+		$message = $this->parse_tags($message);
266 266
 
267
-		$message = $this->build_email( $message );
267
+		$message = $this->build_email($message);
268 268
 
269
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
269
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
270 270
 
271
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
271
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
272 272
 
273
-		do_action( 'give_email_send_after', $this );
273
+		do_action('give_email_send_after', $this);
274 274
 
275 275
 		return $sent;
276 276
 
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
 	 * @since 1.0
283 283
 	 */
284 284
 	public function send_before() {
285
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
286
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
287
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
285
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
286
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
287
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
288 288
 	}
289 289
 
290 290
 	/**
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 	 * @since 1.0
294 294
 	 */
295 295
 	public function send_after() {
296
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
297
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
298
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
296
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
297
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
298
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
299 299
 
300 300
 		// Reset heading to an empty string
301 301
 		$this->heading = '';
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 	 *
307 307
 	 * @since 1.0
308 308
 	 */
309
-	public function text_to_html( $message ) {
309
+	public function text_to_html($message) {
310 310
 
311
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
312
-			$message = wpautop( $message );
311
+		if ('text/html' == $this->content_type || true === $this->html) {
312
+			$message = wpautop($message);
313 313
 		}
314 314
 
315 315
 		return $message;
Please login to merge, or discard this patch.
includes/error-tracking.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -29,33 +29,33 @@  discard block
 block discarded – undo
29 29
  *
30 30
  * @return void
31 31
  */
32
-function give_print_errors( $form_id ) {
32
+function give_print_errors($form_id) {
33 33
 
34 34
 	$errors = give_get_errors();
35 35
 
36
-	$request_form_id = isset( $_REQUEST['form-id'] ) ? intval( $_REQUEST['form-id'] ) : 0;
36
+	$request_form_id = isset($_REQUEST['form-id']) ? intval($_REQUEST['form-id']) : 0;
37 37
 
38 38
 	//Sanity checks first: Ensure that gateway returned errors display on the appropriate form
39
-	if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) {
39
+	if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) {
40 40
 		return;
41 41
 	}
42 42
 
43
-	if ( $errors ) {
44
-		$classes = apply_filters( 'give_error_class', array(
43
+	if ($errors) {
44
+		$classes = apply_filters('give_error_class', array(
45 45
 			'give_errors'
46
-		) );
47
-		echo '<div class="' . implode( ' ', $classes ) . '">';
46
+		));
47
+		echo '<div class="'.implode(' ', $classes).'">';
48 48
 		// Loop error codes and display errors
49
-		foreach ( $errors as $error_id => $error ) {
50
-			echo '<div class="give_error" id="give_error_' . $error_id . '"><p><strong>' . __( 'Error', 'give' ) . '</strong>: ' . $error . '</p></div>';
49
+		foreach ($errors as $error_id => $error) {
50
+			echo '<div class="give_error" id="give_error_'.$error_id.'"><p><strong>'.__('Error', 'give').'</strong>: '.$error.'</p></div>';
51 51
 		}
52 52
 		echo '</div>';
53 53
 		give_clear_errors();
54 54
 	}
55 55
 }
56 56
 
57
-add_action( 'give_purchase_form_before_personal_info', 'give_print_errors' );
58
-add_action( 'give_ajax_checkout_errors', 'give_print_errors' );
57
+add_action('give_purchase_form_before_personal_info', 'give_print_errors');
58
+add_action('give_ajax_checkout_errors', 'give_print_errors');
59 59
 
60 60
 /**
61 61
  * Get Errors
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  * @return mixed array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71
-	return Give()->session->get( 'give_errors' );
71
+	return Give()->session->get('give_errors');
72 72
 }
73 73
 
74 74
 /**
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
  *
85 85
  * @return void
86 86
  */
87
-function give_set_error( $error_id, $error_message ) {
87
+function give_set_error($error_id, $error_message) {
88 88
 	$errors = give_get_errors();
89
-	if ( ! $errors ) {
89
+	if ( ! $errors) {
90 90
 		$errors = array();
91 91
 	}
92
-	$errors[ $error_id ] = $error_message;
93
-	Give()->session->set( 'give_errors', $errors );
92
+	$errors[$error_id] = $error_message;
93
+	Give()->session->set('give_errors', $errors);
94 94
 }
95 95
 
96 96
 /**
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * @return void
102 102
  */
103 103
 function give_clear_errors() {
104
-	Give()->session->set( 'give_errors', null );
104
+	Give()->session->set('give_errors', null);
105 105
 }
106 106
 
107 107
 /**
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
  *
115 115
  * @return string
116 116
  */
117
-function give_unset_error( $error_id ) {
117
+function give_unset_error($error_id) {
118 118
 	$errors = give_get_errors();
119
-	if ( $errors ) {
120
-		unset( $errors[ $error_id ] );
121
-		Give()->session->set( 'give_errors', $errors );
119
+	if ($errors) {
120
+		unset($errors[$error_id]);
121
+		Give()->session->set('give_errors', $errors);
122 122
 	}
123 123
 }
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  * @return void
130 130
  */
131 131
 function _give_die_handler() {
132
-	if ( defined( 'GIVE_UNIT_TESTS' ) ) {
132
+	if (defined('GIVE_UNIT_TESTS')) {
133 133
 		return '_give_die_handler';
134 134
 	} else {
135 135
 		die();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
  * @since  1.0
145 145
  * @return void
146 146
  */
147
-function give_die( $message = '', $title = '', $status = 400 ) {
148
-	add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 );
149
-	add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 );
150
-	wp_die( $message, $title, array( 'response' => $status ) );
147
+function give_die($message = '', $title = '', $status = 400) {
148
+	add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3);
149
+	add_filter('wp_die_handler', '_give_die_handler', 10, 3);
150
+	wp_die($message, $title, array('response' => $status));
151 151
 }
152 152
 
153 153
 /**
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
  *
163 163
  * @return   string  $error
164 164
  */
165
-function give_output_error( $message, $echo = true, $error_id = 'warning' ) {
166
-	$error = '<div class="give_errors" id="give_error_' . $error_id . '"><p class="give_error  give_' . $error_id . '">' . $message . '</p></div>';
165
+function give_output_error($message, $echo = true, $error_id = 'warning') {
166
+	$error = '<div class="give_errors" id="give_error_'.$error_id.'"><p class="give_error  give_'.$error_id.'">'.$message.'</p></div>';
167 167
 
168
-	if ( $echo ) {
168
+	if ($echo) {
169 169
 		echo $error;
170 170
 	} else {
171 171
 		return $error;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
  *
66 66
  * @since 1.0
67 67
  * @uses  Give_Session::get()
68
- * @return mixed array if errors are present, false if none found
68
+ * @return string array if errors are present, false if none found
69 69
  */
70 70
 function give_get_errors() {
71 71
 	return Give()->session->get( 'give_errors' );
Please login to merge, or discard this patch.
includes/forms/widget.php 1 patch
Spacing   +47 added lines, -47 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
-defined( 'ABSPATH' ) or exit;
13
+defined('ABSPATH') or exit;
14 14
 
15 15
 /**
16 16
  * Give Form widget
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function __construct()
33 33
 	{
34
-		$this->self = get_class( $this );
34
+		$this->self = get_class($this);
35 35
 
36 36
 		parent::__construct(
37
-			strtolower( $this->self ),
38
-			__( 'Give - Donation Form', 'give' ),
37
+			strtolower($this->self),
38
+			__('Give - Donation Form', 'give'),
39 39
 			array(
40
-				'description' => __( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' )
40
+				'description' => __('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give')
41 41
 			)
42 42
 		);
43 43
 
44
-		add_action( 'widgets_init',          array( $this, 'widget_init' ) );
45
-		add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) );
44
+		add_action('widgets_init', array($this, 'widget_init'));
45
+		add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts'));
46 46
 	}
47 47
 
48 48
 	/**
@@ -52,24 +52,24 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return void
54 54
 	 */
55
-	public function admin_widget_scripts( $hook )
55
+	public function admin_widget_scripts($hook)
56 56
 	{
57 57
 		// Directories of assets
58
-		$js_dir     = GIVE_PLUGIN_URL . 'assets/js/admin/';
59
-		$js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/';
60
-		$css_dir    = GIVE_PLUGIN_URL . 'assets/css/';
58
+		$js_dir     = GIVE_PLUGIN_URL.'assets/js/admin/';
59
+		$js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/';
60
+		$css_dir    = GIVE_PLUGIN_URL.'assets/css/';
61 61
 
62 62
 		// Use minified libraries if SCRIPT_DEBUG is turned off
63
-		$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
63
+		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
64 64
 
65 65
 		// Widget Script
66
-		if ( $hook == 'widgets.php' ) {
66
+		if ($hook == 'widgets.php') {
67 67
 
68
-			wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' );
68
+			wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css');
69 69
 
70
-			wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION );
70
+			wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION);
71 71
 
72
-			wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false );
72
+			wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false);
73 73
 		}
74 74
 	}
75 75
 
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
 	 *                        before_widget, and after_widget.
81 81
 	 * @param array $instance The settings for the particular instance of the widget.
82 82
 	 */
83
-	public function widget( $args, $instance )
83
+	public function widget($args, $instance)
84 84
 	{
85
-		extract( $args );
85
+		extract($args);
86 86
 
87
-		$title = !empty( $instance['title'] ) ? $instance['title'] : '';
88
-		$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
87
+		$title = ! empty($instance['title']) ? $instance['title'] : '';
88
+		$title = apply_filters('widget_title', $title, $instance, $this->id_base);
89 89
 
90 90
 		echo $before_widget;
91 91
 
92
-		do_action( 'give_before_forms_widget' );
92
+		do_action('give_before_forms_widget');
93 93
 
94
-		echo $title ? $before_title . $title . $after_title : '';
94
+		echo $title ? $before_title.$title.$after_title : '';
95 95
 
96
-		give_get_donation_form( $instance );
96
+		give_get_donation_form($instance);
97 97
 
98 98
 		echo $after_widget;
99 99
 
100
-		do_action( 'give_after_forms_widget' );
100
+		do_action('give_after_forms_widget');
101 101
 	}
102 102
 
103 103
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @return string
109 109
 	 */
110
-	public function form( $instance )
110
+	public function form($instance)
111 111
 	{
112 112
 		$defaults = array(
113 113
 			'title'        => '',
@@ -115,51 +115,51 @@  discard block
 block discarded – undo
115 115
 			'float_labels' => '',
116 116
 		);
117 117
 
118
-		$instance = wp_parse_args( (array) $instance, $defaults );
118
+		$instance = wp_parse_args((array) $instance, $defaults);
119 119
 
120
-		extract( $instance );
120
+		extract($instance);
121 121
 
122 122
 		// Query Give Forms
123 123
 
124 124
 		$args = array(
125 125
 			'post_type'      => 'give_forms',
126
-			'posts_per_page' => - 1,
126
+			'posts_per_page' => -1,
127 127
 			'post_status'    => 'publish',
128 128
 		);
129 129
 
130
-		$give_forms = get_posts( $args );
130
+		$give_forms = get_posts($args);
131 131
 
132 132
 		// Widget: Title
133 133
 
134 134
 		?><p>
135
-			<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'give' ); ?></label>
136
-			<input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>" /><br>
137
-			<small><?php _e( 'Leave blank to hide the widget title.', 'give' ); ?></small>
135
+			<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'give'); ?></label>
136
+			<input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($title); ?>" /><br>
137
+			<small><?php _e('Leave blank to hide the widget title.', 'give'); ?></small>
138 138
 		</p><?php
139 139
 
140 140
 		// Widget: Give Form
141 141
 
142 142
 		?><p>
143
-			<label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php printf( __( 'Give %s:', 'give' ), give_get_forms_label_singular() ); ?></label>
144
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>">
145
-				<option value="current"><?php _e( '— Select —', 'give' ); ?></option>
146
-				<?php foreach ( $give_forms as $give_form ) { ?>
147
-					<option <?php selected( absint( $id ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $give_form->post_title; ?></option>
143
+			<label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php printf(__('Give %s:', 'give'), give_get_forms_label_singular()); ?></label>
144
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>">
145
+				<option value="current"><?php _e('— Select —', 'give'); ?></option>
146
+				<?php foreach ($give_forms as $give_form) { ?>
147
+					<option <?php selected(absint($id), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $give_form->post_title; ?></option>
148 148
 				<?php } ?>
149 149
 			</select><br>
150
-			<small><?php _e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small>
150
+			<small><?php _e('Select a Give Form to embed in this widget.', 'give'); ?></small>
151 151
 		</p><?php
152 152
 
153 153
 		// Widget: Floating Labels
154 154
 
155 155
 		?><p>
156
-			<label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php _e( 'Floating Labels (optional):', 'give' ); ?></label>
157
-			<select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'float_labels' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>">
158
-				<option value="" <?php selected( esc_attr( $float_labels ), '' ) ?>>– <?php _e( 'Select', 'give' ); ?> –</option>
159
-				<option value="enabled" <?php selected( esc_attr( $float_labels ), 'enabled' ) ?>><?php _e( 'Enabled', 'give' ); ?></option>
160
-				<option value="disabled" <?php selected( esc_attr( $float_labels ), 'disabled' ) ?>><?php _e( 'Disabled', 'give' ); ?></option>
156
+			<label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php _e('Floating Labels (optional):', 'give'); ?></label>
157
+			<select class="widefat" name="<?php echo esc_attr($this->get_field_name('float_labels')); ?>" id="<?php echo esc_attr($this->get_field_id('float_labels')); ?>">
158
+				<option value="" <?php selected(esc_attr($float_labels), '') ?>>– <?php _e('Select', 'give'); ?> –</option>
159
+				<option value="enabled" <?php selected(esc_attr($float_labels), 'enabled') ?>><?php _e('Enabled', 'give'); ?></option>
160
+				<option value="disabled" <?php selected(esc_attr($float_labels), 'disabled') ?>><?php _e('Disabled', 'give'); ?></option>
161 161
 			</select><br>
162
-			<small><?php printf( __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ); ?></small>
162
+			<small><?php printf(__('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")); ?></small>
163 163
 		</p><?php
164 164
 	}
165 165
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	function widget_init()
172 172
 	{
173
-		register_widget( $this->self );
173
+		register_widget($this->self);
174 174
 	}
175 175
 
176 176
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return array
183 183
 	 */
184
-	public function update( $new_instance, $old_instance )
184
+	public function update($new_instance, $old_instance)
185 185
 	{
186 186
 		$this->flush_widget_cache();
187 187
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	public function flush_widget_cache()
197 197
 	{
198
-		wp_cache_delete( $this->self, 'widget' );
198
+		wp_cache_delete($this->self, 'widget');
199 199
 	}
200 200
 }
201 201
 
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', __( 'You must enable a payment gateway to use Give', 'give' ) );
58
+	if (empty($gateways)) {
59
+		give_set_error('no_gateways', __('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/gateways/functions.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,10 +97,10 @@
 block discarded – undo
97 97
 
98 98
 	//Single Form settings varies compared to the Global default settings
99 99
 	if ( ! empty( $form_default ) &&
100
-	     $form_id !== null &&
101
-	     $default !== $form_default &&
102
-	     $form_default !== 'global' &&
103
-	     give_is_gateway_active( $form_default )
100
+		 $form_id !== null &&
101
+		 $default !== $form_default &&
102
+		 $form_default !== 'global' &&
103
+		 give_is_gateway_active( $form_default )
104 104
 	) {
105 105
 		$default = $form_default;
106 106
 	}
Please login to merge, or discard this 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'    => __( 'PayPal Standard', 'give' ),
28
-			'checkout_label' => __( 'PayPal', 'give' ),
29
-			'supports'       => array( 'buy_now' )
27
+			'admin_label'    => __('PayPal Standard', 'give'),
28
+			'checkout_label' => __('PayPal', 'give'),
29
+			'supports'       => array('buy_now')
30 30
 		),
31 31
 		'manual' => array(
32
-			'admin_label'    => __( 'Test Payment', 'give' ),
33
-			'checkout_label' => __( 'Test Payment', 'give' )
32
+			'admin_label'    => __('Test Payment', 'give'),
33
+			'checkout_label' => __('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 = __( 'Test Donation', 'give' );
128
+	if ($gateway == 'manual' && $payment) {
129
+		if (give_get_payment_amount($payment) == 0) {
130
+			$label = __('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 = __( 'Test Donation', 'give' );
150
+	if ($gateway == 'manual') {
151
+		$label = __('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/price-functions.php 1 patch
Spacing   +15 added lines, -15 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
 
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return bool true if has variable prices, false otherwise
25 25
  */
26
-function give_has_variable_prices( $form_id = 0 ) {
26
+function give_has_variable_prices($form_id = 0) {
27 27
 
28
-	if ( empty( $form_id ) ) {
28
+	if (empty($form_id)) {
29 29
 		return false;
30 30
 	}
31 31
 
32
-	$form = new Give_Donate_Form( $form_id );
32
+	$form = new Give_Donate_Form($form_id);
33 33
 
34 34
 	return $form->has_variable_prices();
35 35
 }
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @return array Variable prices
46 46
  */
47
-function give_get_variable_prices( $form_id = 0 ) {
47
+function give_get_variable_prices($form_id = 0) {
48 48
 
49
-	if ( empty( $form_id ) ) {
49
+	if (empty($form_id)) {
50 50
 		return false;
51 51
 	}
52 52
 
53
-	$form = new Give_Donate_Form( $form_id );
53
+	$form = new Give_Donate_Form($form_id);
54 54
 
55 55
 	return $form->prices;
56 56
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @return string $default_price
69 69
  */
70
-function give_get_default_multilevel_amount( $form_id ) {
70
+function give_get_default_multilevel_amount($form_id) {
71 71
 	$default_price = '1.00';
72
-	$prices        = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id );
72
+	$prices        = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id);
73 73
 
74
-	foreach ( $prices as $price ) {
74
+	foreach ($prices as $price) {
75 75
 
76
-		if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) {
76
+		if (isset($price['_give_default']) && $price['_give_default'] === 'default') {
77 77
 			$default_price = $price['_give_amount'];
78 78
 		}
79 79
 
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
  * @return string $default_price
95 95
  * @since      1.0
96 96
  */
97
-function give_get_default_form_amount( $form_id ) {
97
+function give_get_default_form_amount($form_id) {
98 98
 
99
-	if ( give_has_variable_prices( $form_id ) ) {
99
+	if (give_has_variable_prices($form_id)) {
100 100
 
101
-		$default_amount = give_get_default_multilevel_amount( $form_id );
101
+		$default_amount = give_get_default_multilevel_amount($form_id);
102 102
 
103 103
 	} else {
104 104
 
105
-		$default_amount = get_post_meta( $form_id, '_give_set_price', true );
105
+		$default_amount = get_post_meta($form_id, '_give_set_price', true);
106 106
 
107 107
 	}
108 108
 
Please login to merge, or discard this patch.
uninstall.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,83 +10,83 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
13
+if ( ! defined('WP_UNINSTALL_PLUGIN')) {
14 14
 	exit;
15 15
 }
16 16
 
17 17
 // Load Give file
18
-include_once( 'give.php' );
18
+include_once('give.php');
19 19
 
20 20
 global $wpdb, $wp_roles;
21 21
 
22 22
 
23
-if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) {
23
+if (give_get_option('uninstall_on_delete') === 'on') {
24 24
 
25 25
 	// Delete All the Custom Post Types
26
-	$give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type', );
27
-	$give_post_types = array( 'give_forms', 'give_payment', 'give_log' );
28
-	foreach ( $give_post_types as $post_type ) {
26
+	$give_taxonomies = array('form_category', 'form_tag', 'give_log_type',);
27
+	$give_post_types = array('give_forms', 'give_payment', 'give_log');
28
+	foreach ($give_post_types as $post_type) {
29 29
 
30
-		$give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) );
31
-		$items           = get_posts( array(
30
+		$give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type));
31
+		$items           = get_posts(array(
32 32
 			'post_type'   => $post_type,
33 33
 			'post_status' => 'any',
34
-			'numberposts' => - 1,
34
+			'numberposts' => -1,
35 35
 			'fields'      => 'ids'
36
-		) );
36
+		));
37 37
 
38
-		if ( $items ) {
39
-			foreach ( $items as $item ) {
40
-				wp_delete_post( $item, true );
38
+		if ($items) {
39
+			foreach ($items as $item) {
40
+				wp_delete_post($item, true);
41 41
 			}
42 42
 		}
43 43
 	}
44 44
 
45 45
 	// Delete All the Terms & Taxonomies
46
-	foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) {
46
+	foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) {
47 47
 
48
-		$terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) );
48
+		$terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy));
49 49
 
50 50
 		// Delete Terms
51
-		if ( $terms ) {
52
-			foreach ( $terms as $term ) {
53
-				$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) );
54
-				$wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) );
51
+		if ($terms) {
52
+			foreach ($terms as $term) {
53
+				$wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id));
54
+				$wpdb->delete($wpdb->terms, array('term_id' => $term->term_id));
55 55
 			}
56 56
 		}
57 57
 
58 58
 		// Delete Taxonomies
59
-		$wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) );
59
+		$wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s'));
60 60
 	}
61 61
 
62 62
 	// Delete the Plugin Pages
63
-	$give_created_pages = array( 'success_page', 'failure_page', 'history_page' );
64
-	foreach ( $give_created_pages as $p ) {
65
-		$page = give_get_option( $p, false );
66
-		if ( $page ) {
67
-			wp_delete_post( $page, true );
63
+	$give_created_pages = array('success_page', 'failure_page', 'history_page');
64
+	foreach ($give_created_pages as $p) {
65
+		$page = give_get_option($p, false);
66
+		if ($page) {
67
+			wp_delete_post($page, true);
68 68
 		}
69 69
 	}
70 70
 
71 71
 	// Delete all the Plugin Options
72
-	delete_option( 'give_settings' );
73
-	delete_option( 'give_version' );
72
+	delete_option('give_settings');
73
+	delete_option('give_version');
74 74
 
75 75
 	// Delete Capabilities
76 76
 	Give()->roles->remove_caps();
77 77
 
78 78
 	// Delete the Roles
79
-	$give_roles = array( 'give_manager', 'give_accountant', 'give_worker' );
80
-	foreach ( $give_roles as $role ) {
81
-		remove_role( $role );
79
+	$give_roles = array('give_manager', 'give_accountant', 'give_worker');
80
+	foreach ($give_roles as $role) {
81
+		remove_role($role);
82 82
 	}
83 83
 
84 84
 	// Remove all database tables
85
-	$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_donors" );
86
-	$wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_customers" );
85
+	$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_donors");
86
+	$wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_customers");
87 87
 
88 88
 	// Cleanup Cron Events
89
-	wp_clear_scheduled_hook( 'give_daily_scheduled_events' );
90
-	wp_clear_scheduled_hook( 'give_daily_cron' );
91
-	wp_clear_scheduled_hook( 'give_weekly_cron' );
89
+	wp_clear_scheduled_hook('give_daily_scheduled_events');
90
+	wp_clear_scheduled_hook('give_daily_cron');
91
+	wp_clear_scheduled_hook('give_weekly_cron');
92 92
 }
Please login to merge, or discard this patch.
includes/formatting.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -142,8 +142,10 @@
 block discarded – undo
142 142
 
143 143
 	if ( is_front_page() ) :
144 144
 		$page_url = home_url();
145
-	else :
145
+	else {
146
+		:
146 147
 		$page_url = 'http';
148
+	}
147 149
 
148 150
 		if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
149 151
 			$page_url .= "s";
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@
 block discarded – undo
119 119
  * @param $field_args
120 120
  * @param $field
121 121
  *
122
- * @return bool
122
+ * @return false|null
123 123
  */
124 124
 function give_format_admin_multilevel_amount( $field_args, $field ) {
125 125
 
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -25,37 +25,37 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @return string $amount Newly sanitized amount
27 27
  */
28
-function give_sanitize_amount( $amount ) {
28
+function give_sanitize_amount($amount) {
29 29
 	$is_negative   = false;
30
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
31
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
30
+	$thousands_sep = give_get_option('thousands_separator', ',');
31
+	$decimal_sep   = give_get_option('decimal_separator', '.');
32 32
 
33 33
 	// Sanitize the amount
34
-	if ( $decimal_sep == ',' && false !== ( $found = strpos( $amount, $decimal_sep ) ) ) {
35
-		if ( ( $thousands_sep == '.' || $thousands_sep == ' ' ) && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
36
-			$amount = str_replace( $thousands_sep, '', $amount );
37
-		} elseif ( empty( $thousands_sep ) && false !== ( $found = strpos( $amount, '.' ) ) ) {
38
-			$amount = str_replace( '.', '', $amount );
34
+	if ($decimal_sep == ',' && false !== ($found = strpos($amount, $decimal_sep))) {
35
+		if (($thousands_sep == '.' || $thousands_sep == ' ') && false !== ($found = strpos($amount, $thousands_sep))) {
36
+			$amount = str_replace($thousands_sep, '', $amount);
37
+		} elseif (empty($thousands_sep) && false !== ($found = strpos($amount, '.'))) {
38
+			$amount = str_replace('.', '', $amount);
39 39
 		}
40 40
 
41
-		$amount = str_replace( $decimal_sep, '.', $amount );
42
-	} elseif ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
43
-		$amount = str_replace( $thousands_sep, '', $amount );
41
+		$amount = str_replace($decimal_sep, '.', $amount);
42
+	} elseif ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
43
+		$amount = str_replace($thousands_sep, '', $amount);
44 44
 	}
45 45
 
46
-	if ( $amount < 0 ) {
46
+	if ($amount < 0) {
47 47
 		$is_negative = true;
48 48
 	}
49 49
 
50
-	$amount   = preg_replace( '/[^0-9\.]/', '', $amount );
51
-	$decimals = apply_filters( 'give_sanitize_amount_decimals', 2, $amount );
52
-	$amount   = number_format( (double) $amount, $decimals, '.', '' );
50
+	$amount   = preg_replace('/[^0-9\.]/', '', $amount);
51
+	$decimals = apply_filters('give_sanitize_amount_decimals', 2, $amount);
52
+	$amount   = number_format((double) $amount, $decimals, '.', '');
53 53
 
54
-	if ( $is_negative ) {
54
+	if ($is_negative) {
55 55
 		$amount *= - 1;
56 56
 	}
57 57
 
58
-	return apply_filters( 'give_sanitize_amount', $amount );
58
+	return apply_filters('give_sanitize_amount', $amount);
59 59
 }
60 60
 
61 61
 /**
@@ -68,47 +68,47 @@  discard block
 block discarded – undo
68 68
  *
69 69
  * @return string $amount Newly formatted amount or Price Not Available
70 70
  */
71
-function give_format_amount( $amount, $decimals = true ) {
71
+function give_format_amount($amount, $decimals = true) {
72 72
 
73
-	$thousands_sep = give_get_option( 'thousands_separator', ',' );
74
-	$decimal_sep   = give_get_option( 'decimal_separator', '.' );
73
+	$thousands_sep = give_get_option('thousands_separator', ',');
74
+	$decimal_sep   = give_get_option('decimal_separator', '.');
75 75
 
76 76
 	// Format the amount
77
-	if ( $decimal_sep == ',' && false !== ( $sep_found = strpos( $amount, $decimal_sep ) ) ) {
78
-		$whole  = substr( $amount, 0, $sep_found );
79
-		$part   = substr( $amount, $sep_found + 1, ( strlen( $amount ) - 1 ) );
80
-		$amount = $whole . '.' . $part;
77
+	if ($decimal_sep == ',' && false !== ($sep_found = strpos($amount, $decimal_sep))) {
78
+		$whole  = substr($amount, 0, $sep_found);
79
+		$part   = substr($amount, $sep_found + 1, (strlen($amount) - 1));
80
+		$amount = $whole.'.'.$part;
81 81
 	}
82 82
 
83 83
 	// Strip , from the amount (if set as the thousands separator)
84
-	if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
85
-		$amount = str_replace( ',', '', $amount );
84
+	if ($thousands_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
85
+		$amount = str_replace(',', '', $amount);
86 86
 	}
87 87
 
88 88
 	// Strip . from the amount (if set as the thousands separator) AND , set to decimal separator
89
-	if ( $thousands_sep == '.' && $decimal_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
90
-		$amount      = explode( '.', $amount );
91
-		$array_count = count( $amount );
92
-		if ( $decimals == true ) {
93
-			unset( $amount[ $array_count - 1 ] );
89
+	if ($thousands_sep == '.' && $decimal_sep == ',' && false !== ($found = strpos($amount, $thousands_sep))) {
90
+		$amount      = explode('.', $amount);
91
+		$array_count = count($amount);
92
+		if ($decimals == true) {
93
+			unset($amount[$array_count - 1]);
94 94
 		}
95
-		$amount = implode( '', $amount );
95
+		$amount = implode('', $amount);
96 96
 	}
97 97
 
98 98
 	// Strip ' ' from the amount (if set as the thousands separator)
99
-	if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
100
-		$amount = str_replace( ' ', '', $amount );
99
+	if ($thousands_sep == ' ' && false !== ($found = strpos($amount, $thousands_sep))) {
100
+		$amount = str_replace(' ', '', $amount);
101 101
 	}
102 102
 
103
-	if ( empty( $amount ) ) {
103
+	if (empty($amount)) {
104 104
 		$amount = 0;
105 105
 	}
106 106
 
107
-	$decimals = apply_filters( 'give_format_amount_decimals', $decimals ? 2 : 0, $amount );
107
+	$decimals = apply_filters('give_format_amount_decimals', $decimals ? 2 : 0, $amount);
108 108
 
109
-	$formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep );
109
+	$formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep);
110 110
 
111
-	return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep );
111
+	return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep);
112 112
 }
113 113
 
114 114
 /**
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
  *
122 122
  * @return bool
123 123
  */
124
-function give_format_admin_multilevel_amount( $field_args, $field ) {
124
+function give_format_admin_multilevel_amount($field_args, $field) {
125 125
 
126
-	if ( empty( $field->value ) ) {
126
+	if (empty($field->value)) {
127 127
 		return false;
128 128
 	}
129 129
 
130
-	$field->value = give_format_amount( $field->value );
130
+	$field->value = give_format_amount($field->value);
131 131
 
132 132
 }
133 133
 
@@ -141,24 +141,24 @@  discard block
 block discarded – undo
141 141
  *
142 142
  * @return mixed|string|void
143 143
  */
144
-function give_currency_filter( $price = '', $currency = '' ) {
144
+function give_currency_filter($price = '', $currency = '') {
145 145
 
146
-	if ( empty( $currency ) ) {
146
+	if (empty($currency)) {
147 147
 		$currency = give_get_currency();
148 148
 	}
149 149
 
150
-	$position = give_get_option( 'currency_position', 'before' );
150
+	$position = give_get_option('currency_position', 'before');
151 151
 
152 152
 	$negative = $price < 0;
153 153
 
154
-	if ( $negative ) {
155
-		$price = substr( $price, 1 ); // Remove proceeding "-" -
154
+	if ($negative) {
155
+		$price = substr($price, 1); // Remove proceeding "-" -
156 156
 	}
157 157
 
158
-	$symbol = give_currency_symbol( $currency );
158
+	$symbol = give_currency_symbol($currency);
159 159
 
160
-	if ( $position == 'before' ):
161
-		switch ( $currency ):
160
+	if ($position == 'before'):
161
+		switch ($currency):
162 162
 			case 'GBP' :
163 163
 			case 'BRL' :
164 164
 			case 'EUR' :
@@ -184,18 +184,18 @@  discard block
 block discarded – undo
184 184
 			case 'DKK' :
185 185
 			case 'HUF' :
186 186
 			case 'ILS' :
187
-				$formatted = $symbol . $price;
187
+				$formatted = $symbol.$price;
188 188
 				break;
189 189
 			case 'NOK' :
190
-				$formatted = $symbol . ' ' . $price;
190
+				$formatted = $symbol.' '.$price;
191 191
 				break;
192 192
 			default :
193
-				$formatted = $currency . ' ' . $price;
193
+				$formatted = $currency.' '.$price;
194 194
 				break;
195 195
 		endswitch;
196
-		$formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_before', $formatted, $currency, $price );
196
+		$formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_before', $formatted, $currency, $price);
197 197
 	else :
198
-		switch ( $currency ) :
198
+		switch ($currency) :
199 199
 			case 'GBP' :
200 200
 			case 'BRL' :
201 201
 			case 'EUR' :
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
 			case 'HUF' :
221 221
 			case 'MYR' :
222 222
 			case 'ILS' :
223
-				$formatted = $price . $symbol;
223
+				$formatted = $price.$symbol;
224 224
 				break;
225 225
 			default :
226
-				$formatted = $price . ' ' . $currency;
226
+				$formatted = $price.' '.$currency;
227 227
 				break;
228 228
 		endswitch;
229
-		$formatted = apply_filters( 'give_' . strtolower( $currency ) . '_currency_filter_after', $formatted, $currency, $price );
229
+		$formatted = apply_filters('give_'.strtolower($currency).'_currency_filter_after', $formatted, $currency, $price);
230 230
 	endif;
231 231
 
232
-	if ( $negative ) {
232
+	if ($negative) {
233 233
 		// Prepend the mins sign before the currency sign
234
-		$formatted = '-' . $formatted;
234
+		$formatted = '-'.$formatted;
235 235
 	}
236 236
 
237 237
 	return $formatted;
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
  *
247 247
  * @return int $decimals
248 248
  */
249
-function give_currency_decimal_filter( $decimals = 2 ) {
249
+function give_currency_decimal_filter($decimals = 2) {
250 250
 
251 251
 	$currency = give_get_currency();
252 252
 
253
-	switch ( $currency ) {
253
+	switch ($currency) {
254 254
 		case 'RIAL' :
255 255
 		case 'JPY' :
256 256
 		case 'TWD' :
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 			break;
261 261
 	}
262 262
 
263
-	return apply_filters( 'give_currency_decimal_count', $decimals, $currency );
263
+	return apply_filters('give_currency_decimal_count', $decimals, $currency);
264 264
 }
265 265
 
266
-add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' );
267
-add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' );
268 266
\ No newline at end of file
267
+add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter');
268
+add_filter('give_format_amount_decimals', 'give_currency_decimal_filter');
269 269
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/welcome.php 1 patch
Spacing   +104 added lines, -104 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
 
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @since 1.0
36 36
 	 */
37 37
 	public function __construct() {
38
-		add_action( 'admin_menu', array( $this, 'admin_menus' ) );
39
-		add_action( 'admin_head', array( $this, 'admin_head' ) );
40
-		add_action( 'admin_init', array( $this, 'welcome' ) );
38
+		add_action('admin_menu', array($this, 'admin_menus'));
39
+		add_action('admin_head', array($this, 'admin_head'));
40
+		add_action('admin_init', array($this, 'welcome'));
41 41
 	}
42 42
 
43 43
 	/**
@@ -51,38 +51,38 @@  discard block
 block discarded – undo
51 51
 	public function admin_menus() {
52 52
 		// About Page
53 53
 		add_dashboard_page(
54
-			__( 'Welcome to Give', 'give' ),
55
-			__( 'Welcome to Give', 'give' ),
54
+			__('Welcome to Give', 'give'),
55
+			__('Welcome to Give', 'give'),
56 56
 			$this->minimum_capability,
57 57
 			'give-about',
58
-			array( $this, 'about_screen' )
58
+			array($this, 'about_screen')
59 59
 		);
60 60
 
61 61
 		// Changelog Page
62 62
 		add_dashboard_page(
63
-			__( 'Give Changelog', 'give' ),
64
-			__( 'Give Changelog', 'give' ),
63
+			__('Give Changelog', 'give'),
64
+			__('Give Changelog', 'give'),
65 65
 			$this->minimum_capability,
66 66
 			'give-changelog',
67
-			array( $this, 'changelog_screen' )
67
+			array($this, 'changelog_screen')
68 68
 		);
69 69
 
70 70
 		// Getting Started Page
71 71
 		add_dashboard_page(
72
-			__( 'Getting started with Give', 'give' ),
73
-			__( 'Getting started with Give', 'give' ),
72
+			__('Getting started with Give', 'give'),
73
+			__('Getting started with Give', 'give'),
74 74
 			$this->minimum_capability,
75 75
 			'give-getting-started',
76
-			array( $this, 'getting_started_screen' )
76
+			array($this, 'getting_started_screen')
77 77
 		);
78 78
 
79 79
 		// Credits Page
80 80
 		add_dashboard_page(
81
-			__( 'The people that build Give', 'give' ),
82
-			__( 'The people that build Give', 'give' ),
81
+			__('The people that build Give', 'give'),
82
+			__('The people that build Give', 'give'),
83 83
 			$this->minimum_capability,
84 84
 			'give-credits',
85
-			array( $this, 'credits_screen' )
85
+			array($this, 'credits_screen')
86 86
 		);
87 87
 	}
88 88
 
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function admin_head() {
97 97
 
98
-		remove_submenu_page( 'index.php', 'give-about' );
99
-		remove_submenu_page( 'index.php', 'give-changelog' );
100
-		remove_submenu_page( 'index.php', 'give-getting-started' );
101
-		remove_submenu_page( 'index.php', 'give-credits' );
98
+		remove_submenu_page('index.php', 'give-about');
99
+		remove_submenu_page('index.php', 'give-changelog');
100
+		remove_submenu_page('index.php', 'give-getting-started');
101
+		remove_submenu_page('index.php', 'give-credits');
102 102
 
103 103
 		// Badge for welcome page
104
-		$badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png';
104
+		$badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png';
105 105
 
106 106
 		?>
107 107
 		<style type="text/css" media="screen">
@@ -215,20 +215,20 @@  discard block
 block discarded – undo
215 215
 	 * @return void
216 216
 	 */
217 217
 	public function tabs() {
218
-		$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about';
218
+		$selected = isset($_GET['page']) ? $_GET['page'] : 'give-about';
219 219
 		?>
220 220
 		<h1 class="nav-tab-wrapper">
221
-			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>">
222
-				<?php _e( "About Give", 'give' ); ?>
221
+			<a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>">
222
+				<?php _e("About Give", 'give'); ?>
223 223
 			</a>
224
-			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>">
225
-				<?php _e( 'Getting Started', 'give' ); ?>
224
+			<a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>">
225
+				<?php _e('Getting Started', 'give'); ?>
226 226
 			</a>
227
-			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>">
228
-				<?php _e( 'Credits', 'give' ); ?>
227
+			<a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>">
228
+				<?php _e('Credits', 'give'); ?>
229 229
 			</a>
230
-			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>">
231
-				<?php _e( 'Add-ons', 'give' ); ?>
230
+			<a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>">
231
+				<?php _e('Add-ons', 'give'); ?>
232 232
 			</a>
233 233
 		</h1>
234 234
 	<?php
@@ -242,20 +242,20 @@  discard block
 block discarded – undo
242 242
 	 * @return void
243 243
 	 */
244 244
 	public function about_screen() {
245
-		list( $display_version ) = explode( '-', GIVE_VERSION );
245
+		list($display_version) = explode('-', GIVE_VERSION);
246 246
 		?>
247 247
 		<div class="wrap about-wrap">
248
-			<h1 class="welcome-h1"><?php printf( __( 'Welcome to Give %s', 'give' ), $display_version ); ?></h1>
248
+			<h1 class="welcome-h1"><?php printf(__('Welcome to Give %s', 'give'), $display_version); ?></h1>
249 249
 
250 250
 			<?php give_social_media_elements() ?>
251 251
 
252
-			<div class="about-text"><?php printf( __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%s" title="View the Give plugin documentation online" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), 'https://givewp.com/documenation/' ); ?></div>
252
+			<div class="about-text"><?php printf(__('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. </You>We encourage you to check out the <a href="%s" title="View the Give plugin documentation online" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), 'https://givewp.com/documenation/'); ?></div>
253 253
 
254
-			<p class="newsletter-intro"><?php _e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>
254
+			<p class="newsletter-intro"><?php _e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p>
255 255
 
256 256
 			<?php give_get_newsletter() ?>
257 257
 
258
-			<div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div>
258
+			<div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div>
259 259
 
260 260
 
261 261
 
@@ -264,15 +264,15 @@  discard block
 block discarded – undo
264 264
 			<div class="feature-section clearfix introduction">
265 265
 
266 266
 				<div class="video feature-section-item">
267
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form">
267
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form">
268 268
 
269 269
 				</div>
270 270
 
271 271
 				<div class="content feature-section-item last-feature">
272 272
 
273
-					<h3><?php _e( 'Give - Democratizing Generosity', 'give' ); ?></h3>
273
+					<h3><?php _e('Give - Democratizing Generosity', 'give'); ?></h3>
274 274
 
275
-					<p><?php _e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p>
275
+					<p><?php _e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p>
276 276
 					<a href="https://givewp.com" target="_blank" class="button-secondary" title="Visit the Give Website">Learn More
277 277
 						<span class="dashicons dashicons-external"></span></a>
278 278
 
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 
286 286
 				<div class="content feature-section-item">
287 287
 
288
-					<h3><?php _e( 'Getting to Know Give', 'give' ); ?></h3>
288
+					<h3><?php _e('Getting to Know Give', 'give'); ?></h3>
289 289
 
290
-					<p><?php _e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p>
290
+					<p><?php _e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have an question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p>
291 291
 					<a href="https://givewp.com/documentation" target="_blank" class="button-secondary" title="Visit the Give Website">View Documentation
292 292
 						<span class="dashicons dashicons-external"></span></a>
293 293
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 				<div class="content  feature-section-item last-feature">
297 297
 
298
-					<img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give">
298
+					<img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give">
299 299
 
300 300
 				</div>
301 301
 
@@ -315,18 +315,18 @@  discard block
 block discarded – undo
315 315
 	 * @return void
316 316
 	 */
317 317
 	public function changelog_screen() {
318
-		list( $display_version ) = explode( '-', GIVE_VERSION );
318
+		list($display_version) = explode('-', GIVE_VERSION);
319 319
 		?>
320 320
 		<div class="wrap about-wrap">
321
-			<h1><?php _e( 'Give Changelog', 'give' ); ?></h1>
321
+			<h1><?php _e('Give Changelog', 'give'); ?></h1>
322 322
 
323
-			<div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), $display_version ); ?></div>
324
-			<div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div>
323
+			<div class="about-text"><?php printf(__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), $display_version); ?></div>
324
+			<div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div>
325 325
 
326 326
 			<?php $this->tabs(); ?>
327 327
 
328 328
 			<div class="changelog">
329
-				<h3><?php _e( 'Full Changelog', 'give' ); ?></h3>
329
+				<h3><?php _e('Full Changelog', 'give'); ?></h3>
330 330
 
331 331
 				<div class="feature-section">
332 332
 					<?php echo $this->parse_readme(); ?>
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 			</div>
335 335
 
336 336
 			<div class="return-to-dashboard">
337
-				<a href="<?php echo esc_url( admin_url( add_query_arg( array(
337
+				<a href="<?php echo esc_url(admin_url(add_query_arg(array(
338 338
 					'post_type' => 'give_forms',
339 339
 					'page'      => 'give-settings'
340
-				), 'edit.php' ) ) ); ?>"><?php _e( 'Go to Give Settings', 'give' ); ?></a>
340
+				), 'edit.php'))); ?>"><?php _e('Go to Give Settings', 'give'); ?></a>
341 341
 			</div>
342 342
 		</div>
343 343
 	<?php
@@ -351,35 +351,35 @@  discard block
 block discarded – undo
351 351
 	 * @return void
352 352
 	 */
353 353
 	public function getting_started_screen() {
354
-		list( $display_version ) = explode( '-', GIVE_VERSION );
354
+		list($display_version) = explode('-', GIVE_VERSION);
355 355
 		?>
356 356
 		<div class="wrap about-wrap get-started">
357
-			<h1 class="welcome-h1"><?php printf( __( 'Give %s - Getting Started Guide', 'give' ), $display_version ); ?></h1>
357
+			<h1 class="welcome-h1"><?php printf(__('Give %s - Getting Started Guide', 'give'), $display_version); ?></h1>
358 358
 
359 359
 			<?php give_social_media_elements() ?>
360 360
 
361
-			<div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div>
361
+			<div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div>
362 362
 
363
-			<p class="newsletter-intro"><?php _e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?>.</p>
363
+			<p class="newsletter-intro"><?php _e('Don\'t forget to sign up for the newsletter!', 'give'); ?>.</p>
364 364
 
365 365
 			<?php give_get_newsletter() ?>
366 366
 
367
-			<div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div>
367
+			<div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div>
368 368
 
369 369
 			<?php $this->tabs(); ?>
370 370
 
371 371
 
372
-			<div class="about-text"><?php printf( __( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></div>
372
+			<div class="about-text"><?php printf(__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></div>
373 373
 
374 374
 
375 375
 			<div class="feature-section clearfix">
376 376
 
377 377
 				<div class="content feature-section-item">
378
-					<h3><?php _e( 'STEP 1: Create a New Form', 'give' ); ?></h3>
378
+					<h3><?php _e('STEP 1: Create a New Form', 'give'); ?></h3>
379 379
 
380
-					<p><?php _e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p>
380
+					<p><?php _e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p>
381 381
 
382
-					<p><?php _e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p>
382
+					<p><?php _e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p>
383 383
 				</div>
384 384
 
385 385
 				<div class="content feature-section-item last-feature">
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 				</div>
397 397
 
398 398
 				<div class="content feature-section-item last-feature">
399
-					<h3><?php _e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3>
399
+					<h3><?php _e('STEP 2: Choose Your Levels', 'give'); ?></h3>
400 400
 
401
-					<p><?php _e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p>
401
+					<p><?php _e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p>
402 402
 				</div>
403 403
 
404 404
 			</div>
@@ -407,11 +407,11 @@  discard block
 block discarded – undo
407 407
 			<div class="feature-section clearfix">
408 408
 
409 409
 				<div class="content feature-section-item add-content">
410
-					<h3><?php _e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3>
410
+					<h3><?php _e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3>
411 411
 
412
-					<p><?php _e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p>
412
+					<p><?php _e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p>
413 413
 
414
-					<p><?php _e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p>
414
+					<p><?php _e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the Donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p>
415 415
 				</div>
416 416
 
417 417
 				<div class="content feature-section-item last-feature">
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
 				</div>
429 429
 
430 430
 				<div class="content feature-section-item last-feature">
431
-					<h3><?php _e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3>
431
+					<h3><?php _e('STEP 4: Configure Your Display Options', 'give'); ?></h3>
432 432
 
433
-					<p><?php _e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p>
433
+					<p><?php _e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p>
434 434
 				</div>
435 435
 
436 436
 
@@ -450,26 +450,26 @@  discard block
 block discarded – undo
450 450
 	 * @return void
451 451
 	 */
452 452
 	public function credits_screen() {
453
-		list( $display_version ) = explode( '-', GIVE_VERSION );
453
+		list($display_version) = explode('-', GIVE_VERSION);
454 454
 		?>
455 455
 		<div class="wrap about-wrap">
456
-			<h1 class="welcome-h1"><?php printf( __( 'Give %s - Credits', 'give' ), $display_version ); ?></h1>
456
+			<h1 class="welcome-h1"><?php printf(__('Give %s - Credits', 'give'), $display_version); ?></h1>
457 457
 
458 458
 			<?php give_social_media_elements() ?>
459 459
 
460
-			<div class="about-text"><?php printf( __( 'Thanks to all those who have contributed code directly or indirectly. ', 'give' ), $display_version ); ?></div>
460
+			<div class="about-text"><?php printf(__('Thanks to all those who have contributed code directly or indirectly. ', 'give'), $display_version); ?></div>
461 461
 
462
-			<div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div>
462
+			<div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div>
463 463
 
464 464
 			<p class="newsletter-intro">Be sure to sign up for the Give newsletter below to stay informed of important updates and news.</p>
465 465
 
466 466
 			<?php give_get_newsletter() ?>
467 467
 
468
-			<div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div>
468
+			<div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div>
469 469
 
470 470
 			<?php $this->tabs(); ?>
471 471
 
472
-			<p class="about-description"><?php _e( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give' ); ?></p>
472
+			<p class="about-description"><?php _e('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give'); ?></p>
473 473
 
474 474
 			<?php echo $this->contributors(); ?>
475 475
 		</div>
@@ -484,21 +484,21 @@  discard block
 block discarded – undo
484 484
 	 * @return string $readme HTML formatted readme file
485 485
 	 */
486 486
 	public function parse_readme() {
487
-		$file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null;
487
+		$file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null;
488 488
 
489
-		if ( ! $file ) {
490
-			$readme = '<p>' . __( 'No valid changlog was found.', 'give' ) . '</p>';
489
+		if ( ! $file) {
490
+			$readme = '<p>'.__('No valid changlog was found.', 'give').'</p>';
491 491
 		} else {
492
-			$readme = file_get_contents( $file );
493
-			$readme = nl2br( esc_html( $readme ) );
494
-			$readme = explode( '== Changelog ==', $readme );
495
-			$readme = end( $readme );
496
-
497
-			$readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme );
498
-			$readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme );
499
-			$readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme );
500
-			$readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme );
501
-			$readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme );
492
+			$readme = file_get_contents($file);
493
+			$readme = nl2br(esc_html($readme));
494
+			$readme = explode('== Changelog ==', $readme);
495
+			$readme = end($readme);
496
+
497
+			$readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme);
498
+			$readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme);
499
+			$readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme);
500
+			$readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme);
501
+			$readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme);
502 502
 		}
503 503
 
504 504
 		return $readme;
@@ -515,21 +515,21 @@  discard block
 block discarded – undo
515 515
 	public function contributors() {
516 516
 		$contributors = $this->get_contributors();
517 517
 
518
-		if ( empty( $contributors ) ) {
518
+		if (empty($contributors)) {
519 519
 			return '';
520 520
 		}
521 521
 
522 522
 		$contributor_list = '<ul class="wp-people-group">';
523 523
 
524
-		foreach ( $contributors as $contributor ) {
524
+		foreach ($contributors as $contributor) {
525 525
 			$contributor_list .= '<li class="wp-person">';
526
-			$contributor_list .= sprintf( '<a href="%s" title="%s">',
527
-				esc_url( 'https://github.com/' . $contributor->login ),
528
-				esc_html( sprintf( __( 'View %s', 'give' ), $contributor->login ) )
526
+			$contributor_list .= sprintf('<a href="%s" title="%s">',
527
+				esc_url('https://github.com/'.$contributor->login),
528
+				esc_html(sprintf(__('View %s', 'give'), $contributor->login))
529 529
 			);
530
-			$contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
530
+			$contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login));
531 531
 			$contributor_list .= '</a>';
532
-			$contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
532
+			$contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login));
533 533
 			$contributor_list .= '</a>';
534 534
 			$contributor_list .= '</li>';
535 535
 		}
@@ -547,25 +547,25 @@  discard block
 block discarded – undo
547 547
 	 * @return array $contributors List of contributors
548 548
 	 */
549 549
 	public function get_contributors() {
550
-		$contributors = get_transient( 'give_contributors' );
550
+		$contributors = get_transient('give_contributors');
551 551
 
552
-		if ( false !== $contributors ) {
552
+		if (false !== $contributors) {
553 553
 			return $contributors;
554 554
 		}
555 555
 
556
-		$response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) );
556
+		$response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false));
557 557
 
558
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
558
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
559 559
 			return array();
560 560
 		}
561 561
 
562
-		$contributors = json_decode( wp_remote_retrieve_body( $response ) );
562
+		$contributors = json_decode(wp_remote_retrieve_body($response));
563 563
 
564
-		if ( ! is_array( $contributors ) ) {
564
+		if ( ! is_array($contributors)) {
565 565
 			return array();
566 566
 		}
567 567
 
568
-		set_transient( 'give_contributors', $contributors, 3600 );
568
+		set_transient('give_contributors', $contributors, 3600);
569 569
 
570 570
 		return $contributors;
571 571
 	}
@@ -584,24 +584,24 @@  discard block
 block discarded – undo
584 584
 
585 585
 
586 586
 		// Bail if no activation redirect
587
-		if ( ! get_transient( '_give_activation_redirect' ) ) {
587
+		if ( ! get_transient('_give_activation_redirect')) {
588 588
 			return;
589 589
 		}
590 590
 
591 591
 		// Delete the redirect transient
592
-		delete_transient( '_give_activation_redirect' );
592
+		delete_transient('_give_activation_redirect');
593 593
 
594 594
 		// Bail if activating from network, or bulk
595
-		if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
595
+		if (is_network_admin() || isset($_GET['activate-multi'])) {
596 596
 			return;
597 597
 		}
598 598
 
599
-		$upgrade = get_option( 'give_version_upgraded_from' );
599
+		$upgrade = get_option('give_version_upgraded_from');
600 600
 
601
-		if ( ! $upgrade ) { // First time install
602
-			wp_safe_redirect( admin_url( 'index.php?page=give-about' ) );
601
+		if ( ! $upgrade) { // First time install
602
+			wp_safe_redirect(admin_url('index.php?page=give-about'));
603 603
 			exit;
604
-		} elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings
604
+		} elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings
605 605
 
606 606
 		} else { // Welcome is NOT disabled in settings
607 607
 			wp_safe_redirect(admin_url('index.php?page=give-about'));
Please login to merge, or discard this patch.