Test Failed
Pull Request — master (#2211)
by Ravinder
05:56 queued 47s
created
includes/admin/shortcodes/shortcode-give-register.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['title'] = esc_html__( 'Register', 'give' );
25
-		$this->shortcode['label'] = esc_html__( 'Register', 'give' );
24
+		$this->shortcode['title'] = esc_html__('Register', 'give');
25
+		$this->shortcode['label'] = esc_html__('Register', 'give');
26 26
 
27
-		parent::__construct( 'give_register' );
27
+		parent::__construct('give_register');
28 28
 	}
29 29
 
30 30
 	/**
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 		return array(
38 38
 			array(
39 39
 				'type' => 'container',
40
-				'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ),
40
+				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')),
41 41
 			),
42 42
 			array(
43 43
 				'type'     => 'textbox',
44 44
 				'name'     => 'redirect',
45 45
 				'minWidth' => 320,
46
-				'tooltip'  => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ),
46
+				'tooltip'  => esc_attr__('Enter an URL here to redirect to after registering.', 'give'),
47 47
 			),
48 48
 		);
49 49
 	}
Please login to merge, or discard this patch.
includes/admin/shortcodes/shortcode-give-donation-history.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public function __construct() {
23 23
 
24
-		$this->shortcode['label'] = esc_html__( 'Donation History', 'give' );
24
+		$this->shortcode['label'] = esc_html__('Donation History', 'give');
25 25
 
26
-		parent::__construct( 'donation_history' );
26
+		parent::__construct('donation_history');
27 27
 	}
28 28
 }
29 29
 
Please login to merge, or discard this patch.
includes/api/class-give-api-v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly.
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
Please login to merge, or discard this patch.
includes/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.
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
  * @return void
39 39
  */
40 40
 function give_load_ajax_gateway() {
41
-	if ( isset( $_POST['give_payment_mode'] ) ) {
41
+	if (isset($_POST['give_payment_mode'])) {
42 42
 		/**
43 43
 		 * Fire to render donation form.
44 44
 		 *
45 45
 		 * @since 1.7
46 46
 		 */
47
-		do_action( 'give_donation_form', $_POST['give_form_id'] );
47
+		do_action('give_donation_form', $_POST['give_form_id']);
48 48
 
49 49
 		exit();
50 50
 	}
51 51
 }
52 52
 
53
-add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' );
54
-add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' );
53
+add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway');
54
+add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway');
55 55
 
56 56
 /**
57 57
  * Sets an error within the donation form if no gateways are enabled.
@@ -63,11 +63,11 @@  discard block
 block discarded – undo
63 63
 function give_no_gateway_error() {
64 64
 	$gateways = give_get_enabled_payment_gateways();
65 65
 
66
-	if ( empty( $gateways ) ) {
67
-		give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) );
66
+	if (empty($gateways)) {
67
+		give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give'));
68 68
 	} else {
69
-		give_unset_error( 'no_gateways' );
69
+		give_unset_error('no_gateways');
70 70
 	}
71 71
 }
72 72
 
73
-add_action( 'init', 'give_no_gateway_error' );
73
+add_action('init', 'give_no_gateway_error');
Please login to merge, or discard this patch.
includes/admin/abstract-admin-settings-page.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Page' ) ) :
16
+if ( ! class_exists('Give_Settings_Page')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Page.
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
 			// Get current setting page.
63 63
 			$this->current_setting_page = give_get_current_setting_page();
64 64
 
65
-			add_filter( "give_default_setting_tab_section_{$this->id}", array( $this, 'set_default_setting_tab' ), 10 );
66
-			add_filter( "{$this->current_setting_page}_tabs_array", array( $this, 'add_settings_page' ), 20 );
67
-			add_action( "{$this->current_setting_page}_sections_{$this->id}_page", array( $this, 'output_sections' ) );
68
-			add_action( "{$this->current_setting_page}_settings_{$this->id}_page", array( $this, 'output' ) );
69
-			add_action( "{$this->current_setting_page}_save_{$this->id}", array( $this, 'save' ) );
65
+			add_filter("give_default_setting_tab_section_{$this->id}", array($this, 'set_default_setting_tab'), 10);
66
+			add_filter("{$this->current_setting_page}_tabs_array", array($this, 'add_settings_page'), 20);
67
+			add_action("{$this->current_setting_page}_sections_{$this->id}_page", array($this, 'output_sections'));
68
+			add_action("{$this->current_setting_page}_settings_{$this->id}_page", array($this, 'output'));
69
+			add_action("{$this->current_setting_page}_save_{$this->id}", array($this, 'save'));
70 70
 		}
71 71
 
72 72
 		/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		 *
79 79
 		 * @return string
80 80
 		 */
81
-		function set_default_setting_tab( $setting_tab ) {
81
+		function set_default_setting_tab($setting_tab) {
82 82
 			return $this->default_tab;
83 83
 		}
84 84
 
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 		 *
92 92
 		 * @return array
93 93
 		 */
94
-		public function add_settings_page( $pages ) {
95
-			$pages[ $this->id ] = $this->label;
94
+		public function add_settings_page($pages) {
95
+			$pages[$this->id] = $this->label;
96 96
 
97 97
 			return $pages;
98 98
 		}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			 *
112 112
 			 * @param  array $settings
113 113
 			 */
114
-			$settings = apply_filters( 'give_get_settings_' . $this->id, array() );
114
+			$settings = apply_filters('give_get_settings_'.$this->id, array());
115 115
 
116 116
 			// Output.
117 117
 			return $settings;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		 * @return array
125 125
 		 */
126 126
 		public function get_sections() {
127
-			return apply_filters( 'give_get_sections_' . $this->id, array() );
127
+			return apply_filters('give_get_sections_'.$this->id, array());
128 128
 		}
129 129
 
130 130
 		/**
@@ -141,29 +141,29 @@  discard block
 block discarded – undo
141 141
 			$sections = $this->get_sections();
142 142
 
143 143
 			// Show section settings only if setting section exist.
144
-			if ( $current_section && ! in_array( $current_section, array_keys( $sections ) ) ) {
145
-				echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';
144
+			if ($current_section && ! in_array($current_section, array_keys($sections))) {
145
+				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>';
146 146
 				$GLOBALS['give_hide_save_button'] = true;
147 147
 
148 148
 				return;
149 149
 			}
150 150
 
151 151
 			// Bailout.
152
-			if ( empty( $sections ) ) {
152
+			if (empty($sections)) {
153 153
 				return;
154 154
 			}
155 155
 
156
-			if ( is_null( $this->current_setting_page ) ) {
156
+			if (is_null($this->current_setting_page)) {
157 157
 				$this->current_setting_page = give_get_current_setting_page();
158 158
 			}
159 159
 
160 160
 			echo '<ul class="subsubsub">';
161 161
 
162 162
 			// Get section keys.
163
-			$array_keys = array_keys( $sections );
163
+			$array_keys = array_keys($sections);
164 164
 
165
-			foreach ( $sections as $id => $label ) {
166
-				echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=' . $this->current_setting_page . '&tab=' . $this->id . '&section=' . sanitize_title( $id ) ) . '" class="' . ( $current_section == $id ? 'current' : '' ) . '">' . $label . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';
165
+			foreach ($sections as $id => $label) {
166
+				echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page='.$this->current_setting_page.'&tab='.$this->id.'&section='.sanitize_title($id)).'" class="'.($current_section == $id ? 'current' : '').'">'.$label.'</a> '.(end($array_keys) == $id ? '' : '|').' </li>';
167 167
 			}
168 168
 
169 169
 			echo '</ul><br class="clear" /><hr>';
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		public function output() {
179 179
 			$settings = $this->get_settings();
180 180
 
181
-			Give_Admin_Settings::output_fields( $settings, 'give_settings' );
181
+			Give_Admin_Settings::output_fields($settings, 'give_settings');
182 182
 		}
183 183
 
184 184
 		/**
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 			$settings        = $this->get_settings();
192 192
 			$current_section = give_get_current_setting_section();
193 193
 
194
-			Give_Admin_Settings::save_fields( $settings, 'give_settings' );
194
+			Give_Admin_Settings::save_fields($settings, 'give_settings');
195 195
 
196 196
 			/**
197 197
 			 * Trigger Action
198 198
 			 *
199 199
 			 * @since 1.8
200 200
 			 */
201
-			do_action( 'give_update_options_' . $this->id . '_' . $current_section );
201
+			do_action('give_update_options_'.$this->id.'_'.$current_section);
202 202
 		}
203 203
 	}
204 204
 
Please login to merge, or discard this patch.
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
 
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function __construct() {
89 89
 
90
-		if ( 'none' === $this->get_template() ) {
90
+		if ('none' === $this->get_template()) {
91 91
 			$this->html = false;
92 92
 		}
93 93
 
94
-		add_action( 'give_email_send_before', array( $this, 'send_before' ) );
95
-		add_action( 'give_email_send_after', array( $this, 'send_after' ) );
94
+		add_action('give_email_send_before', array($this, 'send_before'));
95
+		add_action('give_email_send_after', array($this, 'send_after'));
96 96
 
97 97
 	}
98 98
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	 * @param $key
105 105
 	 * @param $value
106 106
 	 */
107
-	public function __set( $key, $value ) {
107
+	public function __set($key, $value) {
108 108
 		$this->$key = $value;
109 109
 	}
110 110
 
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 * @since 1.0
115 115
 	 */
116 116
 	public function get_from_name() {
117
-		if ( ! $this->from_name ) {
118
-			$this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) );
117
+		if ( ! $this->from_name) {
118
+			$this->from_name = give_get_option('from_name', get_bloginfo('name'));
119 119
 		}
120 120
 
121
-		return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this );
121
+		return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this);
122 122
 	}
123 123
 
124 124
 	/**
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 	 * @since 1.0
128 128
 	 */
129 129
 	public function get_from_address() {
130
-		if ( ! $this->from_address ) {
131
-			$this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) );
130
+		if ( ! $this->from_address) {
131
+			$this->from_address = give_get_option('from_email', get_option('admin_email'));
132 132
 		}
133 133
 
134
-		return apply_filters( 'give_email_from_address', $this->from_address, $this );
134
+		return apply_filters('give_email_from_address', $this->from_address, $this);
135 135
 	}
136 136
 
137 137
 	/**
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
 	 * @since 1.0
141 141
 	 */
142 142
 	public function get_content_type() {
143
-		if ( ! $this->content_type && $this->html ) {
144
-			$this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this );
145
-		} else if ( ! $this->html ) {
143
+		if ( ! $this->content_type && $this->html) {
144
+			$this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this);
145
+		} else if ( ! $this->html) {
146 146
 			$this->content_type = 'text/plain';
147 147
 		}
148 148
 
149
-		return apply_filters( 'give_email_content_type', $this->content_type, $this );
149
+		return apply_filters('give_email_content_type', $this->content_type, $this);
150 150
 	}
151 151
 
152 152
 	/**
@@ -155,13 +155,13 @@  discard block
 block discarded – undo
155 155
 	 * @since 1.0
156 156
 	 */
157 157
 	public function get_headers() {
158
-		if ( ! $this->headers ) {
158
+		if ( ! $this->headers) {
159 159
 			$this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n";
160 160
 			$this->headers .= "Reply-To: {$this->get_from_address()}\r\n";
161 161
 			$this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n";
162 162
 		}
163 163
 
164
-		return apply_filters( 'give_email_headers', $this->headers, $this );
164
+		return apply_filters('give_email_headers', $this->headers, $this);
165 165
 	}
166 166
 
167 167
 	/**
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function get_templates() {
173 173
 		$templates = array(
174
-			'default' => esc_html__( 'Default Template', 'give' ),
175
-			'none'    => esc_html__( 'No template, plain text only', 'give' )
174
+			'default' => esc_html__('Default Template', 'give'),
175
+			'none'    => esc_html__('No template, plain text only', 'give')
176 176
 		);
177 177
 
178
-		return apply_filters( 'give_email_templates', $templates );
178
+		return apply_filters('give_email_templates', $templates);
179 179
 	}
180 180
 
181 181
 	/**
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	 * @since 1.0
185 185
 	 */
186 186
 	public function get_template() {
187
-		if ( ! $this->template ) {
188
-			$this->template = give_get_option( 'email_template', 'default' );
187
+		if ( ! $this->template) {
188
+			$this->template = give_get_option('email_template', 'default');
189 189
 		}
190 190
 
191
-		return apply_filters( 'give_email_template', $this->template );
191
+		return apply_filters('give_email_template', $this->template);
192 192
 	}
193 193
 
194 194
 	/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @since 1.0
198 198
 	 */
199 199
 	public function get_heading() {
200
-		return apply_filters( 'give_email_heading', $this->heading );
200
+		return apply_filters('give_email_heading', $this->heading);
201 201
 	}
202 202
 
203 203
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return mixed
209 209
 	 */
210
-	public function parse_tags( $content ) {
210
+	public function parse_tags($content) {
211 211
 		return $content;
212 212
 	}
213 213
 
@@ -220,19 +220,19 @@  discard block
 block discarded – undo
220 220
 	 *
221 221
 	 * @return string
222 222
 	 */
223
-	public function build_email( $message ) {
223
+	public function build_email($message) {
224 224
 
225
-		if ( false === $this->html ) {
226
-			return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this );
225
+		if (false === $this->html) {
226
+			return apply_filters('give_email_message', wp_strip_all_tags($message), $this);
227 227
 		}
228 228
 
229
-		$message = $this->text_to_html( $message );
229
+		$message = $this->text_to_html($message);
230 230
 
231 231
 		$template = $this->get_template();
232 232
 
233 233
 		ob_start();
234 234
 
235
-		give_get_template_part( 'emails/header', $template, true );
235
+		give_get_template_part('emails/header', $template, true);
236 236
 
237 237
 		/**
238 238
 		 * Fires in the email head.
@@ -241,17 +241,17 @@  discard block
 block discarded – undo
241 241
 		 *
242 242
 		 * @param Give_Emails $this The email object.
243 243
 		 */
244
-		do_action( 'give_email_header', $this );
244
+		do_action('give_email_header', $this);
245 245
 
246
-		if ( has_action( 'give_email_template_' . $template ) ) {
246
+		if (has_action('give_email_template_'.$template)) {
247 247
 			/**
248 248
 			 * Fires in a specific email template.
249 249
 			 *
250 250
 			 * @since 1.0
251 251
 			 */
252
-			do_action( "give_email_template_{$template}" );
252
+			do_action("give_email_template_{$template}");
253 253
 		} else {
254
-			give_get_template_part( 'emails/body', $template, true );
254
+			give_get_template_part('emails/body', $template, true);
255 255
 		}
256 256
 
257 257
 		/**
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 		 *
262 262
 		 * @param Give_Emails $this The email object.
263 263
 		 */
264
-		do_action( 'give_email_body', $this );
264
+		do_action('give_email_body', $this);
265 265
 
266
-		give_get_template_part( 'emails/footer', $template, true );
266
+		give_get_template_part('emails/footer', $template, true);
267 267
 
268 268
 		/**
269 269
 		 * Fires in the email footer.
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 		 *
273 273
 		 * @param Give_Emails $this The email object.
274 274
 		 */
275
-		do_action( 'give_email_footer', $this );
275
+		do_action('give_email_footer', $this);
276 276
 
277 277
 		$body    = ob_get_clean();
278
-		$message = str_replace( '{email}', $message, $body );
278
+		$message = str_replace('{email}', $message, $body);
279 279
 
280
-		return apply_filters( 'give_email_message', $message, $this );
280
+		return apply_filters('give_email_message', $message, $this);
281 281
 	}
282 282
 
283 283
 	/**
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return bool
292 292
 	 */
293
-	public function send( $to, $subject, $message, $attachments = '' ) {
293
+	public function send($to, $subject, $message, $attachments = '') {
294 294
 
295
-		if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) {
296
-			_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null );
295
+		if ( ! did_action('init') && ! did_action('admin_init')) {
296
+			_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null);
297 297
 
298 298
 			return false;
299 299
 		}
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 		 *
306 306
 		 * @param Give_Emails $this The email object.
307 307
 		 */
308
-		do_action( 'give_email_send_before', $this );
308
+		do_action('give_email_send_before', $this);
309 309
 
310
-		$subject = $this->parse_tags( $subject );
311
-		$message = $this->parse_tags( $message );
310
+		$subject = $this->parse_tags($subject);
311
+		$message = $this->parse_tags($message);
312 312
 
313
-		$message = $this->build_email( $message );
313
+		$message = $this->build_email($message);
314 314
 
315
-		$attachments = apply_filters( 'give_email_attachments', $attachments, $this );
315
+		$attachments = apply_filters('give_email_attachments', $attachments, $this);
316 316
 
317
-		$sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments );
317
+		$sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments);
318 318
 
319 319
 		/**
320 320
 		 * Fires after sending an email.
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @param Give_Emails $this The email object.
325 325
 		 */
326
-		do_action( 'give_email_send_after', $this );
326
+		do_action('give_email_send_after', $this);
327 327
 
328 328
 		return $sent;
329 329
 
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 	 * @since 1.0
336 336
 	 */
337 337
 	public function send_before() {
338
-		add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
339
-		add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
340
-		add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
338
+		add_filter('wp_mail_from', array($this, 'get_from_address'));
339
+		add_filter('wp_mail_from_name', array($this, 'get_from_name'));
340
+		add_filter('wp_mail_content_type', array($this, 'get_content_type'));
341 341
 	}
342 342
 
343 343
 	/**
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	 * @since 1.0
347 347
 	 */
348 348
 	public function send_after() {
349
-		remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
350
-		remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
351
-		remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
349
+		remove_filter('wp_mail_from', array($this, 'get_from_address'));
350
+		remove_filter('wp_mail_from_name', array($this, 'get_from_name'));
351
+		remove_filter('wp_mail_content_type', array($this, 'get_content_type'));
352 352
 
353 353
 		// Reset heading to an empty string
354 354
 		$this->heading = '';
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 	 *
360 360
 	 * @since 1.0
361 361
 	 */
362
-	public function text_to_html( $message ) {
362
+	public function text_to_html($message) {
363 363
 
364
-		if ( 'text/html' == $this->content_type || true === $this->html ) {
365
-			$message = wpautop( $message );
364
+		if ('text/html' == $this->content_type || true === $this->html) {
365
+			$message = wpautop($message);
366 366
 		}
367 367
 
368 368
 		return $message;
Please login to merge, or discard this patch.
includes/admin/settings/class-settings-gateways.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 								'disabled' => __( 'Disabled', 'give' ),
87 87
 							)
88 88
 						),
89
-                        array(
90
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
91
-                            'id'    => 'paypal_standard_gateway_settings_docs_link',
92
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
94
-                            'type'  => 'give_docs_link',
95
-                        ),
89
+						array(
90
+							'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
91
+							'id'    => 'paypal_standard_gateway_settings_docs_link',
92
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
93
+							'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
94
+							'type'  => 'give_docs_link',
95
+						),
96 96
 						array(
97 97
 							'type' => 'sectionend',
98 98
 							'id'   => 'give_title_gateway_settings_2',
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 								'textarea_rows' => 6,
146 146
 							)
147 147
 						),
148
-                        array(
149
-                            'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
150
-                            'id'    => 'offline_gateway_settings_docs_link',
151
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
-                            'title' => __( 'Offline Gateway Settings', 'give' ),
153
-                            'type'  => 'give_docs_link',
154
-                        ),
148
+						array(
149
+							'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
150
+							'id'    => 'offline_gateway_settings_docs_link',
151
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
152
+							'title' => __( 'Offline Gateway Settings', 'give' ),
153
+							'type'  => 'give_docs_link',
154
+						),
155 155
 						array(
156 156
 							'type' => 'sectionend',
157 157
 							'id'   => 'give_title_gateway_settings_3',
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 							'id'   => 'default_gateway',
190 190
 							'type' => 'default_gateway'
191 191
 						),
192
-                        array(
193
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
194
-                            'id'    => 'gateway_settings_docs_link',
195
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
-                            'title' => __( 'Gateway Settings', 'give' ),
197
-                            'type'  => 'give_docs_link',
198
-                        ),
192
+						array(
193
+							'name'  => __( 'Gateways Docs Link', 'give' ),
194
+							'id'    => 'gateway_settings_docs_link',
195
+							'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
196
+							'title' => __( 'Gateway Settings', 'give' ),
197
+							'type'  => 'give_docs_link',
198
+						),
199 199
 						array(
200 200
 							'id'   => 'give_title_gateway_settings_1',
201 201
 							'type' => 'sectionend'
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
  * @since       1.8
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit; // Exit if accessed directly
14 14
 }
15 15
 
16
-if ( ! class_exists( 'Give_Settings_Gateways' ) ) :
16
+if ( ! class_exists('Give_Settings_Gateways')) :
17 17
 
18 18
 	/**
19 19
 	 * Give_Settings_Gateways.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 		 */
28 28
 		public function __construct() {
29 29
 			$this->id    = 'gateways';
30
-			$this->label = esc_html__( 'Payment Gateways', 'give' );
30
+			$this->label = esc_html__('Payment Gateways', 'give');
31 31
 
32 32
 			$this->default_tab = 'gateways-settings';
33 33
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$settings        = array();
45 45
 			$current_section = give_get_current_setting_section();
46 46
 
47
-			switch ( $current_section ) {
47
+			switch ($current_section) {
48 48
 				case 'paypal-standard':
49 49
 					$settings = array(
50 50
 						// Section 2: PayPal Standard.
@@ -53,55 +53,55 @@  discard block
 block discarded – undo
53 53
 							'id'   => 'give_title_gateway_settings_2',
54 54
 						),
55 55
 						array(
56
-							'name' => __( 'PayPal Email', 'give' ),
57
-							'desc' => __( 'Enter your PayPal account\'s email.', 'give' ),
56
+							'name' => __('PayPal Email', 'give'),
57
+							'desc' => __('Enter your PayPal account\'s email.', 'give'),
58 58
 							'id'   => 'paypal_email',
59 59
 							'type' => 'email',
60 60
 						),
61 61
 						array(
62
-							'name' => __( 'PayPal Page Style', 'give' ),
63
-							'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ),
62
+							'name' => __('PayPal Page Style', 'give'),
63
+							'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'),
64 64
 							'id'   => 'paypal_page_style',
65 65
 							'type' => 'text',
66 66
 						),
67 67
 						array(
68
-							'name'    => __( 'PayPal Transaction Type', 'give' ),
69
-							'desc'    => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ),
68
+							'name'    => __('PayPal Transaction Type', 'give'),
69
+							'desc'    => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'),
70 70
 							'id'      => 'paypal_button_type',
71 71
 							'type'    => 'radio_inline',
72 72
 							'options' => array(
73
-								'donation' => __( 'Donation', 'give' ),
74
-								'standard' => __( 'Standard Transaction', 'give' )
73
+								'donation' => __('Donation', 'give'),
74
+								'standard' => __('Standard Transaction', 'give')
75 75
 							),
76 76
 							'default' => 'donation',
77 77
 						),
78 78
 						array(
79
-							'name'    => __( 'Billing Details', 'give' ),
80
-							'desc'    => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ),
79
+							'name'    => __('Billing Details', 'give'),
80
+							'desc'    => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'),
81 81
 							'id'      => 'paypal_standard_billing_details',
82 82
 							'type'    => 'radio_inline',
83 83
 							'default' => 'disabled',
84 84
 							'options' => array(
85
-								'enabled'  => __( 'Enabled', 'give' ),
86
-								'disabled' => __( 'Disabled', 'give' ),
85
+								'enabled'  => __('Enabled', 'give'),
86
+								'disabled' => __('Disabled', 'give'),
87 87
 							)
88 88
 						),
89 89
 						array(
90
-							'name'    => __( 'PayPal IPN Verification', 'give' ),
91
-							'desc'    => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ),
90
+							'name'    => __('PayPal IPN Verification', 'give'),
91
+							'desc'    => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'),
92 92
 							'id'      => 'paypal_verification',
93 93
 							'type'    => 'radio_inline',
94 94
 							'default' => 'enabled',
95 95
 							'options' => array(
96
-								'enabled'  => __( 'Enabled', 'give' ),
97
-								'disabled' => __( 'Disabled', 'give' ),
96
+								'enabled'  => __('Enabled', 'give'),
97
+								'disabled' => __('Disabled', 'give'),
98 98
 							)
99 99
 						),
100 100
                         array(
101
-                            'name'  => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ),
101
+                            'name'  => __('PayPal Standard Gateway Settings Docs Link', 'give'),
102 102
                             'id'    => 'paypal_standard_gateway_settings_docs_link',
103
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ),
104
-                            'title' => __( 'PayPal Standard Gateway Settings', 'give' ),
103
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'),
104
+                            'title' => __('PayPal Standard Gateway Settings', 'give'),
105 105
                             'type'  => 'give_docs_link',
106 106
                         ),
107 107
 						array(
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 							'id'   => 'give_title_gateway_settings_3',
120 120
 						),
121 121
 						array(
122
-							'name'    => __( 'Collect Billing Details', 'give' ),
123
-							'desc'    => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ),
122
+							'name'    => __('Collect Billing Details', 'give'),
123
+							'desc'    => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'),
124 124
 							'id'      => 'give_offline_donation_enable_billing_fields',
125 125
 							'type'    => 'radio_inline',
126 126
 							'default' => 'disabled',
127 127
 							'options' => array(
128
-								'enabled'  => __( 'Enabled', 'give' ),
129
-								'disabled' => __( 'Disabled', 'give' )
128
+								'enabled'  => __('Enabled', 'give'),
129
+								'disabled' => __('Disabled', 'give')
130 130
 							)
131 131
 						),
132 132
 						array(
133
-							'name'    => __( 'Offline Donation Instructions', 'give' ),
134
-							'desc'    => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ),
133
+							'name'    => __('Offline Donation Instructions', 'give'),
134
+							'desc'    => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'),
135 135
 							'id'      => 'global_offline_donation_content',
136 136
 							'default' => give_get_default_offline_donation_content(),
137 137
 							'type'    => 'wysiwyg',
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
 							)
141 141
 						),
142 142
 						array(
143
-							'name'    => __( 'Offline Donation Email Instructions Subject', 'give' ),
144
-							'desc'    => __( 'Enter the subject line for the donation receipt email.', 'give' ),
143
+							'name'    => __('Offline Donation Email Instructions Subject', 'give'),
144
+							'desc'    => __('Enter the subject line for the donation receipt email.', 'give'),
145 145
 							'id'      => 'offline_donation_subject',
146
-							'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
146
+							'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
147 147
 							'type'    => 'text'
148 148
 						),
149 149
 						array(
150
-							'name'    => __( 'Offline Donation Email Instructions', 'give' ),
151
-							'desc'    => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(),
150
+							'name'    => __('Offline Donation Email Instructions', 'give'),
151
+							'desc'    => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(),
152 152
 							'id'      => 'global_offline_donation_email',
153 153
 							'default' => give_get_default_offline_donation_email_content(),
154 154
 							'type'    => 'wysiwyg',
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 							)
158 158
 						),
159 159
                         array(
160
-                            'name'  => __( 'Offline Donations Settings Docs Link', 'give' ),
160
+                            'name'  => __('Offline Donations Settings Docs Link', 'give'),
161 161
                             'id'    => 'offline_gateway_settings_docs_link',
162
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ),
163
-                            'title' => __( 'Offline Gateway Settings', 'give' ),
162
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateway-offline-donations'),
163
+                            'title' => __('Offline Gateway Settings', 'give'),
164 164
                             'type'  => 'give_docs_link',
165 165
                         ),
166 166
 						array(
@@ -178,33 +178,33 @@  discard block
 block discarded – undo
178 178
 							'type' => 'title'
179 179
 						),
180 180
 						array(
181
-							'name'    => __( 'Test Mode', 'give' ),
182
-							'desc'    => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ),
181
+							'name'    => __('Test Mode', 'give'),
182
+							'desc'    => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'),
183 183
 							'id'      => 'test_mode',
184 184
 							'type'    => 'radio_inline',
185 185
 							'default' => 'disabled',
186 186
 							'options' => array(
187
-								'enabled'  => __( 'Enabled', 'give' ),
188
-								'disabled' => __( 'Disabled', 'give' ),
187
+								'enabled'  => __('Enabled', 'give'),
188
+								'disabled' => __('Disabled', 'give'),
189 189
 							)
190 190
 						),
191 191
 						array(
192
-							'name' => __( 'Enabled Gateways', 'give' ),
193
-							'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ),
192
+							'name' => __('Enabled Gateways', 'give'),
193
+							'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'),
194 194
 							'id'   => 'gateways',
195 195
 							'type' => 'enabled_gateways'
196 196
 						),
197 197
 						array(
198
-							'name' => __( 'Default Gateway', 'give' ),
199
-							'desc' => __( 'The gateway that will be selected by default.', 'give' ),
198
+							'name' => __('Default Gateway', 'give'),
199
+							'desc' => __('The gateway that will be selected by default.', 'give'),
200 200
 							'id'   => 'default_gateway',
201 201
 							'type' => 'default_gateway'
202 202
 						),
203 203
                         array(
204
-                            'name'  => __( 'Gateways Docs Link', 'give' ),
204
+                            'name'  => __('Gateways Docs Link', 'give'),
205 205
                             'id'    => 'gateway_settings_docs_link',
206
-                            'url'   => esc_url( 'http://docs.givewp.com/settings-gateways' ),
207
-                            'title' => __( 'Gateway Settings', 'give' ),
206
+                            'url'   => esc_url('http://docs.givewp.com/settings-gateways'),
207
+                            'title' => __('Gateway Settings', 'give'),
208 208
                             'type'  => 'give_docs_link',
209 209
                         ),
210 210
 						array(
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			 * Filter the payment gateways settings.
220 220
 			 * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8
221 221
 			 */
222
-			$settings = apply_filters( 'give_settings_gateways', $settings );
222
+			$settings = apply_filters('give_settings_gateways', $settings);
223 223
 
224 224
 			/**
225 225
 			 * Filter the settings.
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			 *
229 229
 			 * @param  array $settings
230 230
 			 */
231
-			$settings = apply_filters( 'give_get_settings_' . $this->id, $settings );
231
+			$settings = apply_filters('give_get_settings_'.$this->id, $settings);
232 232
 
233 233
 			// Output.
234 234
 			return $settings;
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 		 */
243 243
 		public function get_sections() {
244 244
 			$sections = array(
245
-				'gateways-settings' => __( 'Gateways', 'give' ),
246
-				'paypal-standard'   => __( 'PayPal Standard', 'give' ),
247
-				'offline-donations' => __( 'Offline Donations', 'give' )
245
+				'gateways-settings' => __('Gateways', 'give'),
246
+				'paypal-standard'   => __('PayPal Standard', 'give'),
247
+				'offline-donations' => __('Offline Donations', 'give')
248 248
 			);
249 249
 
250
-			return apply_filters( 'give_get_sections_' . $this->id, $sections );
250
+			return apply_filters('give_get_sections_'.$this->id, $sections);
251 251
 		}
252 252
 	}
253 253
 
Please login to merge, or discard this patch.
includes/class-give-email-access.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 	 * @since  1.0
233 233
 	 * @access public
234 234
 	 *
235
-	 * @return bool
235
+	 * @return null|boolean
236 236
 	 */
237 237
 	public function check_for_token() {
238 238
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 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
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	public function __construct() {
97 97
 
98 98
 		// get it started
99
-		add_action( 'init', array( $this, 'init' ) );
99
+		add_action('init', array($this, 'init'));
100 100
 	}
101 101
 
102 102
 	/**
@@ -120,29 +120,29 @@  discard block
 block discarded – undo
120 120
 		 */
121 121
 		if (
122 122
 			is_user_logged_in()
123
-			|| ! give_is_setting_enabled( give_get_option( 'email_access' ) )
123
+			|| ! give_is_setting_enabled(give_get_option('email_access'))
124 124
 			|| is_admin()
125 125
 		) {
126 126
 			return;
127 127
 		}
128 128
 
129 129
 		// Are db columns setup?
130
-		$is_setup = give_get_option( 'email_access_installed' );
131
-		if ( empty( $is_setup ) ) {
130
+		$is_setup = give_get_option('email_access_installed');
131
+		if (empty($is_setup)) {
132 132
 			$this->create_columns();
133 133
 		}
134 134
 
135 135
 		// Timeouts.
136
-		$this->verify_throttle  = apply_filters( 'give_nl_verify_throttle', 300 );
137
-		$this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 );
136
+		$this->verify_throttle  = apply_filters('give_nl_verify_throttle', 300);
137
+		$this->token_expiration = apply_filters('give_nl_token_expiration', 7200);
138 138
 
139 139
 		// Setup login.
140 140
 		$this->check_for_token();
141 141
 
142
-		if ( $this->token_exists ) {
143
-			add_filter( 'give_can_view_receipt', '__return_true' );
144
-			add_filter( 'give_user_pending_verification', '__return_false' );
145
-			add_filter( 'give_get_users_donations_args', array( $this, 'users_donations_args' ) );
142
+		if ($this->token_exists) {
143
+			add_filter('give_can_view_receipt', '__return_true');
144
+			add_filter('give_user_pending_verification', '__return_false');
145
+			add_filter('give_get_users_donations_args', array($this, 'users_donations_args'));
146 146
 		}
147 147
 
148 148
 	}
@@ -157,25 +157,25 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return bool
159 159
 	 */
160
-	public function can_send_email( $customer_id ) {
160
+	public function can_send_email($customer_id) {
161 161
 		/* @var WPDB $wpdb */
162 162
 		global $wpdb;
163 163
 
164 164
 		// Prevent multiple emails within X minutes
165
-		$throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle );
165
+		$throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle);
166 166
 
167 167
 		// Does a user row exist?
168 168
 		$exists = (int) $wpdb->get_var(
169
-			$wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id )
169
+			$wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id)
170 170
 		);
171 171
 
172
-		if ( 0 < $exists ) {
172
+		if (0 < $exists) {
173 173
 			$row_id = (int) $wpdb->get_var(
174
-				$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle )
174
+				$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle)
175 175
 			);
176 176
 
177
-			if ( $row_id < 1 ) {
178
-				give_set_error( 'give_email_access_attempts_exhausted', __( 'Please wait a few minutes before requesting a new email access link.', 'give' ) );
177
+			if ($row_id < 1) {
178
+				give_set_error('give_email_access_attempts_exhausted', __('Please wait a few minutes before requesting a new email access link.', 'give'));
179 179
 
180 180
 				return false;
181 181
 			}
@@ -195,34 +195,34 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @return void
197 197
 	 */
198
-	public function send_email( $customer_id, $email ) {
198
+	public function send_email($customer_id, $email) {
199 199
 
200
-		$verify_key = wp_generate_password( 20, false );
200
+		$verify_key = wp_generate_password(20, false);
201 201
 
202 202
 		// Generate a new verify key
203
-		$this->set_verify_key( $customer_id, $email, $verify_key );
203
+		$this->set_verify_key($customer_id, $email, $verify_key);
204 204
 
205 205
 		// Get the donation history page
206
-		$page_id = give_get_option( 'history_page' );
206
+		$page_id = give_get_option('history_page');
207 207
 
208
-		$access_url = add_query_arg( array(
208
+		$access_url = add_query_arg(array(
209 209
 			'give_nl' => $verify_key,
210
-		), get_permalink( $page_id ) );
210
+		), get_permalink($page_id));
211 211
 
212 212
 		// Nice subject and message.
213
-		$subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Your Access Link to %s', 'give' ), get_bloginfo( 'name' ) ) );
213
+		$subject = apply_filters('give_email_access_token_subject', sprintf(__('Your Access Link to %s', 'give'), get_bloginfo('name')));
214 214
 
215
-		$message = __( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n";
216
-		$message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . __( 'Access Donation Details &raquo;', 'give' ) . '</a>' . "\n\n";
215
+		$message = __('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n";
216
+		$message .= '<a href="'.esc_url($access_url).'" target="_blank">'.__('Access Donation Details &raquo;', 'give').'</a>'."\n\n";
217 217
 		$message .= "\n\n";
218
-		$message .= __( 'Sincerely,', 'give' ) . "\n";
219
-		$message .= get_bloginfo( 'name' ) . "\n";
218
+		$message .= __('Sincerely,', 'give')."\n";
219
+		$message .= get_bloginfo('name')."\n";
220 220
 
221
-		$message = apply_filters( 'give_email_access_token_message', $message );
221
+		$message = apply_filters('give_email_access_token_message', $message);
222 222
 
223 223
 		// Send the email.
224
-		Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Your Access Link', 'give' ) ) );
225
-		Give()->emails->send( $email, $subject, $message );
224
+		Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Your Access Link', 'give')));
225
+		Give()->emails->send($email, $subject, $message);
226 226
 
227 227
 	}
228 228
 
@@ -236,26 +236,26 @@  discard block
 block discarded – undo
236 236
 	 */
237 237
 	public function check_for_token() {
238 238
 
239
-		$token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : '';
239
+		$token = isset($_GET['give_nl']) ? $_GET['give_nl'] : '';
240 240
 
241 241
 		// Check for cookie.
242
-		if ( empty( $token ) ) {
243
-			$token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : '';
242
+		if (empty($token)) {
243
+			$token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : '';
244 244
 		}
245 245
 
246 246
 		// Must have a token.
247
-		if ( ! empty( $token ) ) {
247
+		if ( ! empty($token)) {
248 248
 
249
-			if ( ! $this->is_valid_token( $token ) ) {
250
-				if ( ! $this->is_valid_verify_key( $token ) ) {
249
+			if ( ! $this->is_valid_token($token)) {
250
+				if ( ! $this->is_valid_verify_key($token)) {
251 251
 					return;
252 252
 				}
253 253
 			}
254 254
 
255 255
 			$this->token_exists = true;
256 256
 			// Set cookie.
257
-			$lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time();
258
-			@setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false );
257
+			$lifetime = current_time('timestamp') + Give()->session->set_expiration_time();
258
+			@setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false);
259 259
 
260 260
 			return true;
261 261
 		}
@@ -271,26 +271,26 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @return bool
273 273
 	 */
274
-	public function is_valid_token( $token ) {
274
+	public function is_valid_token($token) {
275 275
 
276 276
 		global $wpdb;
277 277
 
278 278
 		// Make sure token isn't expired.
279
-		$expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration );
279
+		$expires = date('Y-m-d H:i:s', time() - $this->token_expiration);
280 280
 
281 281
 		$email = $wpdb->get_var(
282
-			$wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires )
282
+			$wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires)
283 283
 		);
284 284
 
285
-		if ( ! empty( $email ) ) {
285
+		if ( ! empty($email)) {
286 286
 			$this->token_email = $email;
287 287
 			$this->token       = $token;
288 288
 			return true;
289 289
 		}
290 290
 
291 291
 		// Set error only if email access form isn't being submitted
292
-		if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) {
293
-			give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', __( 'Your access token has expired. Please request a new one below:', 'give' ) ) );
292
+		if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) {
293
+			give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', __('Your access token has expired. Please request a new one below:', 'give')));
294 294
 		}
295 295
 
296 296
 		return false;
@@ -309,25 +309,25 @@  discard block
 block discarded – undo
309 309
 	 *
310 310
 	 * @return void
311 311
 	 */
312
-	public function set_verify_key( $customer_id, $email, $verify_key ) {
312
+	public function set_verify_key($customer_id, $email, $verify_key) {
313 313
 		global $wpdb;
314 314
 
315
-		$now = date( 'Y-m-d H:i:s' );
315
+		$now = date('Y-m-d H:i:s');
316 316
 
317 317
 		// Insert or update?
318 318
 		$row_id = (int) $wpdb->get_var(
319
-			$wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id )
319
+			$wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id)
320 320
 		);
321 321
 
322 322
 		// Update.
323
-		if ( ! empty( $row_id ) ) {
323
+		if ( ! empty($row_id)) {
324 324
 			$wpdb->query(
325
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id )
325
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id)
326 326
 			);
327 327
 		} // Insert.
328 328
 		else {
329 329
 			$wpdb->query(
330
-				$wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now )
330
+				$wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now)
331 331
 			);
332 332
 		}
333 333
 	}
@@ -342,21 +342,21 @@  discard block
 block discarded – undo
342 342
 	 *
343 343
 	 * @return bool
344 344
 	 */
345
-	public function is_valid_verify_key( $token ) {
345
+	public function is_valid_verify_key($token) {
346 346
 		/* @var WPDB $wpdb */
347 347
 		global $wpdb;
348 348
 
349 349
 		// See if the verify_key exists.
350 350
 		$row = $wpdb->get_row(
351
-			$wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token )
351
+			$wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token)
352 352
 		);
353 353
 
354
-		$now = date( 'Y-m-d H:i:s' );
354
+		$now = date('Y-m-d H:i:s');
355 355
 
356 356
 		// Set token and remove verify key.
357
-		if ( ! empty( $row ) ) {
357
+		if ( ! empty($row)) {
358 358
 			$wpdb->query(
359
-				$wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id )
359
+				$wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id)
360 360
 			);
361 361
 
362 362
 			$this->token_email = $row->email;
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 *
381 381
 	 * @return mixed
382 382
 	 */
383
-	public function users_donations_args( $args ) {
383
+	public function users_donations_args($args) {
384 384
 		$args['user'] = $this->token_email;
385 385
 
386 386
 		return $args;
@@ -401,11 +401,11 @@  discard block
 block discarded – undo
401 401
 		global $wpdb;
402 402
 
403 403
 		// Create columns in customers table
404
-		$query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" );
404
+		$query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`");
405 405
 
406 406
 		// Columns added properly
407
-		if ( $query ) {
408
-			give_update_option( 'email_access_installed', 1 );
407
+		if ($query) {
408
+			give_update_option('email_access_installed', 1);
409 409
 		}
410 410
 
411 411
 	}
Please login to merge, or discard this patch.
includes/admin/EDD_SL_Plugin_Updater.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	 * @uses api_request()
78 78
 	 *
79 79
 	 * @param array   $_transient_data Update array build by WordPress.
80
-	 * @return array Modified update array with custom plugin data.
80
+	 * @return stdClass Modified update array with custom plugin data.
81 81
 	 */
82 82
 	public function check_update( $_transient_data ) {
83 83
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) exit;
4
+if ( ! defined( 'ABSPATH' ) ) {
5
+	exit;
6
+}
5 7
 
6 8
 /**
7 9
  * Allows plugins to use their own update API.
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Exit if accessed directly
4
-if ( ! defined( 'ABSPATH' ) ) exit;
4
+if ( ! defined('ABSPATH')) exit;
5 5
 
6 6
 /**
7 7
  * Allows plugins to use their own update API.
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 	 * @param string  $_plugin_file Path to the plugin file.
30 30
 	 * @param array   $_api_data    Optional data to send with API calls.
31 31
 	 */
32
-	public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
32
+	public function __construct($_api_url, $_plugin_file, $_api_data = null) {
33 33
 
34 34
 		global $edd_plugin_data;
35 35
 
36
-		$this->api_url     = trailingslashit( $_api_url );
36
+		$this->api_url     = trailingslashit($_api_url);
37 37
 		$this->api_data    = $_api_data;
38
-		$this->name        = plugin_basename( $_plugin_file );
39
-		$this->slug        = basename( $_plugin_file, '.php' );
38
+		$this->name        = plugin_basename($_plugin_file);
39
+		$this->slug        = basename($_plugin_file, '.php');
40 40
 		$this->version     = $_api_data['version'];
41
-		$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
42
-		$this->beta        = ! empty( $this->api_data['beta'] ) ? true : false;
43
-		$this->cache_key   = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
41
+		$this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false;
42
+		$this->beta        = ! empty($this->api_data['beta']) ? true : false;
43
+		$this->cache_key   = md5(serialize($this->slug.$this->api_data['license'].$this->beta));
44 44
 
45
-		$edd_plugin_data[ $this->slug ] = $this->api_data;
45
+		$edd_plugin_data[$this->slug] = $this->api_data;
46 46
 
47 47
 		// Set up hooks.
48 48
 		$this->init();
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public function init() {
60 60
 
61
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
62
-		add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
63
-		remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 );
64
-		add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
65
-		add_action( 'admin_init', array( $this, 'show_changelog' ) );
61
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
62
+		add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
63
+		remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10);
64
+		add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2);
65
+		add_action('admin_init', array($this, 'show_changelog'));
66 66
 
67 67
 	}
68 68
 
@@ -79,41 +79,41 @@  discard block
 block discarded – undo
79 79
 	 * @param array   $_transient_data Update array build by WordPress.
80 80
 	 * @return array Modified update array with custom plugin data.
81 81
 	 */
82
-	public function check_update( $_transient_data ) {
82
+	public function check_update($_transient_data) {
83 83
 
84 84
 		global $pagenow;
85 85
 
86
-		if ( ! is_object( $_transient_data ) ) {
86
+		if ( ! is_object($_transient_data)) {
87 87
 			$_transient_data = new stdClass;
88 88
 		}
89 89
 
90
-		if ( 'plugins.php' == $pagenow && is_multisite() ) {
90
+		if ('plugins.php' == $pagenow && is_multisite()) {
91 91
 			return $_transient_data;
92 92
 		}
93 93
 
94
-		if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
94
+		if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) {
95 95
 			return $_transient_data;
96 96
 		}
97 97
 
98 98
 		$version_info = $this->get_cached_version_info();
99 99
 
100
-		if ( false === $version_info ) {
101
-			$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
100
+		if (false === $version_info) {
101
+			$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
102 102
 
103
-			$this->set_version_info_cache( $version_info );
103
+			$this->set_version_info_cache($version_info);
104 104
 
105 105
 		}
106 106
 
107
-		if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
107
+		if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
108 108
 
109
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
109
+			if (version_compare($this->version, $version_info->new_version, '<')) {
110 110
 
111
-				$_transient_data->response[ $this->name ] = $version_info;
111
+				$_transient_data->response[$this->name] = $version_info;
112 112
 
113 113
 			}
114 114
 
115
-			$_transient_data->last_checked           = current_time( 'timestamp' );
116
-			$_transient_data->checked[ $this->name ] = $this->version;
115
+			$_transient_data->last_checked           = current_time('timestamp');
116
+			$_transient_data->checked[$this->name] = $this->version;
117 117
 
118 118
 		}
119 119
 
@@ -126,97 +126,97 @@  discard block
 block discarded – undo
126 126
 	 * @param string  $file
127 127
 	 * @param array   $plugin
128 128
 	 */
129
-	public function show_update_notification( $file, $plugin ) {
129
+	public function show_update_notification($file, $plugin) {
130 130
 
131
-		if ( is_network_admin() ) {
131
+		if (is_network_admin()) {
132 132
 			return;
133 133
 		}
134 134
 
135
-		if( ! current_user_can( 'update_plugins' ) ) {
135
+		if ( ! current_user_can('update_plugins')) {
136 136
 			return;
137 137
 		}
138 138
 
139
-		if( ! is_multisite() ) {
139
+		if ( ! is_multisite()) {
140 140
 			return;
141 141
 		}
142 142
 
143
-		if ( $this->name != $file ) {
143
+		if ($this->name != $file) {
144 144
 			return;
145 145
 		}
146 146
 
147 147
 		// Remove our filter on the site transient
148
-		remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
148
+		remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
149 149
 
150
-		$update_cache = get_site_transient( 'update_plugins' );
150
+		$update_cache = get_site_transient('update_plugins');
151 151
 
152
-		$update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
152
+		$update_cache = is_object($update_cache) ? $update_cache : new stdClass();
153 153
 
154
-		if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
154
+		if (empty($update_cache->response) || empty($update_cache->response[$this->name])) {
155 155
 
156 156
 			$version_info = $this->get_cached_version_info();
157 157
 
158
-			if ( false === $version_info ) {
159
-				$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
158
+			if (false === $version_info) {
159
+				$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
160 160
 
161
-				$this->set_version_info_cache( $version_info );
161
+				$this->set_version_info_cache($version_info);
162 162
 			}
163 163
 
164
-			if ( ! is_object( $version_info ) ) {
164
+			if ( ! is_object($version_info)) {
165 165
 				return;
166 166
 			}
167 167
 
168
-			if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
168
+			if (version_compare($this->version, $version_info->new_version, '<')) {
169 169
 
170
-				$update_cache->response[ $this->name ] = $version_info;
170
+				$update_cache->response[$this->name] = $version_info;
171 171
 
172 172
 			}
173 173
 
174
-			$update_cache->last_checked = current_time( 'timestamp' );
175
-			$update_cache->checked[ $this->name ] = $this->version;
174
+			$update_cache->last_checked = current_time('timestamp');
175
+			$update_cache->checked[$this->name] = $this->version;
176 176
 
177
-			set_site_transient( 'update_plugins', $update_cache );
177
+			set_site_transient('update_plugins', $update_cache);
178 178
 
179 179
 		} else {
180 180
 
181
-			$version_info = $update_cache->response[ $this->name ];
181
+			$version_info = $update_cache->response[$this->name];
182 182
 
183 183
 		}
184 184
 
185 185
 		// Restore our filter
186
-		add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
186
+		add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
187 187
 
188
-		if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
188
+		if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
189 189
 
190 190
 			// build a plugin list row, with update notification
191
-			$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
191
+			$wp_list_table = _get_list_table('WP_Plugins_List_Table');
192 192
 			# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
193
-			echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
193
+			echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">';
194 194
 			echo '<td colspan="3" class="plugin-update colspanchange">';
195 195
 			echo '<div class="update-message notice inline notice-warning notice-alt">';
196 196
 
197
-			$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
197
+			$changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911');
198 198
 
199
-			if ( empty( $version_info->download_link ) ) {
199
+			if (empty($version_info->download_link)) {
200 200
 				printf(
201
-					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ),
202
-					esc_html( $version_info->name ),
203
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
204
-					esc_html( $version_info->new_version ),
201
+					__('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give'),
202
+					esc_html($version_info->name),
203
+					'<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">',
204
+					esc_html($version_info->new_version),
205 205
 					'</a>'
206 206
 				);
207 207
 			} else {
208 208
 				printf(
209
-					__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ),
210
-					esc_html( $version_info->name ),
211
-					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
212
-					esc_html( $version_info->new_version ),
209
+					__('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give'),
210
+					esc_html($version_info->name),
211
+					'<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">',
212
+					esc_html($version_info->new_version),
213 213
 					'</a>',
214
-					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
214
+					'<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">',
215 215
 					'</a>'
216 216
 				);
217 217
 			}
218 218
 
219
-			do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
219
+			do_action("in_plugin_update_message-{$file}", $plugin, $version_info);
220 220
 
221 221
 			echo '</div></td></tr>';
222 222
 		}
@@ -232,15 +232,15 @@  discard block
 block discarded – undo
232 232
 	 * @param object  $_args
233 233
 	 * @return object $_data
234 234
 	 */
235
-	public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
235
+	public function plugins_api_filter($_data, $_action = '', $_args = null) {
236 236
 
237
-		if ( $_action != 'plugin_information' ) {
237
+		if ($_action != 'plugin_information') {
238 238
 
239 239
 			return $_data;
240 240
 
241 241
 		}
242 242
 
243
-		if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
243
+		if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) {
244 244
 
245 245
 			return $_data;
246 246
 
@@ -255,20 +255,20 @@  discard block
 block discarded – undo
255 255
 			)
256 256
 		);
257 257
 
258
-		$cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
258
+		$cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta));
259 259
 
260 260
 		// Get the transient where we store the api request for this plugin for 24 hours
261
-		$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
261
+		$edd_api_request_transient = $this->get_cached_version_info($cache_key);
262 262
 
263 263
 		//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
264
-		if ( empty( $edd_api_request_transient ) ) {
264
+		if (empty($edd_api_request_transient)) {
265 265
 
266
-			$api_response = $this->api_request( 'plugin_information', $to_send );
266
+			$api_response = $this->api_request('plugin_information', $to_send);
267 267
 
268 268
 			// Expires in 3 hours
269
-			$this->set_version_info_cache( $api_response, $cache_key );
269
+			$this->set_version_info_cache($api_response, $cache_key);
270 270
 
271
-			if ( false !== $api_response ) {
271
+			if (false !== $api_response) {
272 272
 				$_data = $api_response;
273 273
 			}
274 274
 
@@ -277,20 +277,20 @@  discard block
 block discarded – undo
277 277
 		}
278 278
 
279 279
 		// Convert sections into an associative array, since we're getting an object, but Core expects an array.
280
-		if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
280
+		if (isset($_data->sections) && ! is_array($_data->sections)) {
281 281
 			$new_sections = array();
282
-			foreach ( $_data->sections as $key => $value ) {
283
-				$new_sections[ $key ] = $value;
282
+			foreach ($_data->sections as $key => $value) {
283
+				$new_sections[$key] = $value;
284 284
 			}
285 285
 
286 286
 			$_data->sections = $new_sections;
287 287
 		}
288 288
 
289 289
 		// Convert banners into an associative array, since we're getting an object, but Core expects an array.
290
-		if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
290
+		if (isset($_data->banners) && ! is_array($_data->banners)) {
291 291
 			$new_banners = array();
292
-			foreach ( $_data->banners as $key => $value ) {
293
-				$new_banners[ $key ] = $value;
292
+			foreach ($_data->banners as $key => $value) {
293
+				$new_banners[$key] = $value;
294 294
 			}
295 295
 
296 296
 			$_data->banners = $new_banners;
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
 	 * @param string  $url
307 307
 	 * @return object $array
308 308
 	 */
309
-	public function http_request_args( $args, $url ) {
309
+	public function http_request_args($args, $url) {
310 310
 		// If it is an https request and we are performing a package download, disable ssl verification
311
-		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
311
+		if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
312 312
 			$args['sslverify'] = false;
313 313
 		}
314 314
 		return $args;
@@ -325,50 +325,50 @@  discard block
 block discarded – undo
325 325
 	 * @param array   $_data   Parameters for the API action.
326 326
 	 * @return false|object
327 327
 	 */
328
-	private function api_request( $_action, $_data ) {
328
+	private function api_request($_action, $_data) {
329 329
 
330 330
 		global $wp_version;
331 331
 
332
-		$data = array_merge( $this->api_data, $_data );
332
+		$data = array_merge($this->api_data, $_data);
333 333
 
334
-		if ( $data['slug'] != $this->slug ) {
334
+		if ($data['slug'] != $this->slug) {
335 335
 			return;
336 336
 		}
337 337
 
338
-		if( $this->api_url == trailingslashit (home_url() ) ) {
338
+		if ($this->api_url == trailingslashit(home_url())) {
339 339
 			return false; // Don't allow a plugin to ping itself
340 340
 		}
341 341
 
342 342
 		$api_params = array(
343 343
 			'edd_action' => 'get_version',
344
-			'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
345
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
346
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
347
-			'version'    => isset( $data['version'] ) ? $data['version'] : false,
344
+			'license'    => ! empty($data['license']) ? $data['license'] : '',
345
+			'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
346
+			'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
347
+			'version'    => isset($data['version']) ? $data['version'] : false,
348 348
 			'slug'       => $data['slug'],
349 349
 			'author'     => $data['author'],
350 350
 			'url'        => home_url(),
351
-			'beta'       => ! empty( $data['beta'] ),
351
+			'beta'       => ! empty($data['beta']),
352 352
 		);
353 353
 
354
-		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
354
+		$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
355 355
 
356
-		if ( ! is_wp_error( $request ) ) {
357
-			$request = json_decode( wp_remote_retrieve_body( $request ) );
356
+		if ( ! is_wp_error($request)) {
357
+			$request = json_decode(wp_remote_retrieve_body($request));
358 358
 		}
359 359
 
360
-		if ( $request && isset( $request->sections ) ) {
361
-			$request->sections = maybe_unserialize( $request->sections );
360
+		if ($request && isset($request->sections)) {
361
+			$request->sections = maybe_unserialize($request->sections);
362 362
 		} else {
363 363
 			$request = false;
364 364
 		}
365 365
 
366
-		if ( $request && isset( $request->banners ) ) {
367
-			$request->banners = maybe_unserialize( $request->banners );
366
+		if ($request && isset($request->banners)) {
367
+			$request->banners = maybe_unserialize($request->banners);
368 368
 		}
369 369
 
370
-		if( ! empty( $request->sections ) ) {
371
-			foreach( $request->sections as $key => $section ) {
370
+		if ( ! empty($request->sections)) {
371
+			foreach ($request->sections as $key => $section) {
372 372
 				$request->$key = (array) $section;
373 373
 			}
374 374
 		}
@@ -380,97 +380,97 @@  discard block
 block discarded – undo
380 380
 
381 381
 		global $edd_plugin_data;
382 382
 
383
-		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
383
+		if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
384 384
 			return;
385 385
 		}
386 386
 
387
-		if( empty( $_REQUEST['plugin'] ) ) {
387
+		if (empty($_REQUEST['plugin'])) {
388 388
 			return;
389 389
 		}
390 390
 
391
-		if( empty( $_REQUEST['slug'] ) ) {
391
+		if (empty($_REQUEST['slug'])) {
392 392
 			return;
393 393
 		}
394 394
 
395
-		if( ! current_user_can( 'update_plugins' ) ) {
396
-			wp_die( __( 'You do not have permission to install plugin updates', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
395
+		if ( ! current_user_can('update_plugins')) {
396
+			wp_die(__('You do not have permission to install plugin updates', 'give'), __('Error', 'give'), array('response' => 403));
397 397
 		}
398 398
 
399
-		$data         = $edd_plugin_data[ $_REQUEST['slug'] ];
400
-		$beta         = ! empty( $data['beta'] ) ? true : false;
401
-		$cache_key    = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
402
-		$version_info = $this->get_cached_version_info( $cache_key );
399
+		$data         = $edd_plugin_data[$_REQUEST['slug']];
400
+		$beta         = ! empty($data['beta']) ? true : false;
401
+		$cache_key    = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info');
402
+		$version_info = $this->get_cached_version_info($cache_key);
403 403
 
404
-		if( false === $version_info ) {
404
+		if (false === $version_info) {
405 405
 
406 406
 			$api_params = array(
407 407
 				'edd_action' => 'get_version',
408
-				'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
409
-				'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
408
+				'item_name'  => isset($data['item_name']) ? $data['item_name'] : false,
409
+				'item_id'    => isset($data['item_id']) ? $data['item_id'] : false,
410 410
 				'slug'       => $_REQUEST['slug'],
411 411
 				'author'     => $data['author'],
412 412
 				'url'        => home_url(),
413
-				'beta'       => ! empty( $data['beta'] )
413
+				'beta'       => ! empty($data['beta'])
414 414
 			);
415 415
 
416
-			$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
416
+			$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params));
417 417
 
418
-			if ( ! is_wp_error( $request ) ) {
419
-				$version_info = json_decode( wp_remote_retrieve_body( $request ) );
418
+			if ( ! is_wp_error($request)) {
419
+				$version_info = json_decode(wp_remote_retrieve_body($request));
420 420
 			}
421 421
 
422 422
 
423
-			if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
424
-				$version_info->sections = maybe_unserialize( $version_info->sections );
423
+			if ( ! empty($version_info) && isset($version_info->sections)) {
424
+				$version_info->sections = maybe_unserialize($version_info->sections);
425 425
 			} else {
426 426
 				$version_info = false;
427 427
 			}
428 428
 
429
-			if( ! empty( $version_info ) ) {
430
-				foreach( $version_info->sections as $key => $section ) {
429
+			if ( ! empty($version_info)) {
430
+				foreach ($version_info->sections as $key => $section) {
431 431
 					$version_info->$key = (array) $section;
432 432
 				}
433 433
 			}
434 434
 
435
-			$this->set_version_info_cache( $version_info, $cache_key );
435
+			$this->set_version_info_cache($version_info, $cache_key);
436 436
 
437 437
 		}
438 438
 
439
-		if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
440
-			echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
439
+		if ( ! empty($version_info) && isset($version_info->sections['changelog'])) {
440
+			echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>';
441 441
 		}
442 442
 
443 443
 		exit;
444 444
 	}
445 445
 
446
-	public function get_cached_version_info( $cache_key = '' ) {
446
+	public function get_cached_version_info($cache_key = '') {
447 447
 
448
-		if( empty( $cache_key ) ) {
448
+		if (empty($cache_key)) {
449 449
 			$cache_key = $this->cache_key;
450 450
 		}
451 451
 
452
-		$cache = get_option( $cache_key );
452
+		$cache = get_option($cache_key);
453 453
 
454
-		if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) {
454
+		if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) {
455 455
 			return false; // Cache is expired
456 456
 		}
457 457
 
458
-		return json_decode( $cache['value'] );
458
+		return json_decode($cache['value']);
459 459
 
460 460
 	}
461 461
 
462
-	public function set_version_info_cache( $value = '', $cache_key = '' ) {
462
+	public function set_version_info_cache($value = '', $cache_key = '') {
463 463
 
464
-		if( empty( $cache_key ) ) {
464
+		if (empty($cache_key)) {
465 465
 			$cache_key = $this->cache_key;
466 466
 		}
467 467
 
468 468
 		$data = array(
469
-			'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ),
470
-			'value'   => json_encode( $value )
469
+			'timeout' => strtotime('+3 hours', current_time('timestamp')),
470
+			'value'   => json_encode($value)
471 471
 		);
472 472
 
473
-		update_option( $cache_key, $data );
473
+		update_option($cache_key, $data);
474 474
 
475 475
 	}
476 476
 
Please login to merge, or discard this patch.