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