Passed
Push — master ( 883b53...6ec8f5 )
by Brian
04:13
created
includes/class-wpinv.php 1 patch
Spacing   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since   1.0.0
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * Main Invoicing class.
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 * @param string $prop The prop to set.
64 64
 	 * @param mixed $value The value to retrieve.
65 65
 	 */
66
-	public function set( $prop, $value ) {
67
-		$this->data[ $prop ] = $value;
66
+	public function set($prop, $value) {
67
+		$this->data[$prop] = $value;
68 68
 	}
69 69
 
70 70
 	/**
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 * @param string $prop The prop to set.
74 74
 	 * @return mixed The value.
75 75
 	 */
76
-	public function get( $prop ) {
76
+	public function get($prop) {
77 77
 
78
-		if ( isset( $this->data[ $prop ] ) ) {
79
-			return $this->data[ $prop ];
78
+		if (isset($this->data[$prop])) {
79
+			return $this->data[$prop];
80 80
 		}
81 81
 
82 82
 		return null;
@@ -88,24 +88,24 @@  discard block
 block discarded – undo
88 88
 	public function set_properties() {
89 89
 
90 90
 		// Sessions.
91
-		$this->set( 'session', new WPInv_Session_Handler() );
92
-		$GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility.
91
+		$this->set('session', new WPInv_Session_Handler());
92
+		$GLOBALS['wpi_session'] = $this->get('session'); // Backwards compatibility.
93 93
 		$this->tax              = new WPInv_EUVat();
94 94
 		$GLOBALS['wpinv_euvat'] = $this->tax; // Backwards compatibility.
95 95
 
96 96
 		// Init other objects.
97
-		$this->set( 'session', new WPInv_Session_Handler() );
98
-		$this->set( 'notes', new WPInv_Notes() );
99
-		$this->set( 'api', new WPInv_API() );
100
-		$this->set( 'post_types', new GetPaid_Post_Types() );
101
-		$this->set( 'template', new GetPaid_Template() );
102
-		$this->set( 'admin', new GetPaid_Admin() );
103
-		$this->set( 'subscriptions', new WPInv_Subscriptions() );
104
-		$this->set( 'invoice_emails', new GetPaid_Invoice_Notification_Emails() );
105
-		$this->set( 'subscription_emails', new GetPaid_Subscription_Notification_Emails() );
106
-		$this->set( 'daily_maintenace', new GetPaid_Daily_Maintenance() );
107
-		$this->set( 'payment_forms', new GetPaid_Payment_Forms() );
108
-		$this->set( 'maxmind', new GetPaid_MaxMind_Geolocation() );
97
+		$this->set('session', new WPInv_Session_Handler());
98
+		$this->set('notes', new WPInv_Notes());
99
+		$this->set('api', new WPInv_API());
100
+		$this->set('post_types', new GetPaid_Post_Types());
101
+		$this->set('template', new GetPaid_Template());
102
+		$this->set('admin', new GetPaid_Admin());
103
+		$this->set('subscriptions', new WPInv_Subscriptions());
104
+		$this->set('invoice_emails', new GetPaid_Invoice_Notification_Emails());
105
+		$this->set('subscription_emails', new GetPaid_Subscription_Notification_Emails());
106
+		$this->set('daily_maintenace', new GetPaid_Daily_Maintenance());
107
+		$this->set('payment_forms', new GetPaid_Payment_Forms());
108
+		$this->set('maxmind', new GetPaid_MaxMind_Geolocation());
109 109
 
110 110
 	}
111 111
 
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	 * Define plugin constants.
114 114
 	 */
115 115
 	public function define_constants() {
116
-		define( 'WPINV_PLUGIN_DIR', plugin_dir_path( WPINV_PLUGIN_FILE ) );
117
-		define( 'WPINV_PLUGIN_URL', plugin_dir_url( WPINV_PLUGIN_FILE ) );
116
+		define('WPINV_PLUGIN_DIR', plugin_dir_path(WPINV_PLUGIN_FILE));
117
+		define('WPINV_PLUGIN_URL', plugin_dir_url(WPINV_PLUGIN_FILE));
118 118
 		$this->version = WPINV_VERSION;
119 119
 	}
120 120
 
@@ -125,27 +125,27 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	protected function init_hooks() {
127 127
 		/* Internationalize the text strings used. */
128
-		add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
128
+		add_action('plugins_loaded', array(&$this, 'plugins_loaded'));
129 129
 
130 130
 		// Init the plugin after WordPress inits.
131
-		add_action( 'init', array( $this, 'init' ), 1 );
132
-		add_action( 'init', array( $this, 'maybe_process_ipn' ), 10 );
133
-		add_action( 'init', array( $this, 'wpinv_actions' ) );
134
-		add_action( 'init', array( $this, 'maybe_do_authenticated_action' ), 100 );
131
+		add_action('init', array($this, 'init'), 1);
132
+		add_action('init', array($this, 'maybe_process_ipn'), 10);
133
+		add_action('init', array($this, 'wpinv_actions'));
134
+		add_action('init', array($this, 'maybe_do_authenticated_action'), 100);
135 135
 
136
-		if ( class_exists( 'BuddyPress' ) ) {
137
-			add_action( 'bp_include', array( &$this, 'bp_invoicing_init' ) );
136
+		if (class_exists('BuddyPress')) {
137
+			add_action('bp_include', array(&$this, 'bp_invoicing_init'));
138 138
 		}
139 139
 
140
-		add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue_scripts' ) );
141
-		add_action( 'wp_footer', array( &$this, 'wp_footer' ) );
142
-		add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
143
-		add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
144
-		add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
140
+		add_action('wp_enqueue_scripts', array(&$this, 'enqueue_scripts'));
141
+		add_action('wp_footer', array(&$this, 'wp_footer'));
142
+		add_action('widgets_init', array(&$this, 'register_widgets'));
143
+		add_filter('wpseo_exclude_from_sitemap_by_post_ids', array($this, 'wpseo_exclude_from_sitemap_by_post_ids'));
144
+		add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
145 145
 
146 146
 		// Fires after registering actions.
147
-		do_action( 'wpinv_actions', $this );
148
-		do_action( 'getpaid_actions', $this );
147
+		do_action('wpinv_actions', $this);
148
+		do_action('getpaid_actions', $this);
149 149
 
150 150
 	}
151 151
 
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 		/* Internationalize the text strings used. */
154 154
 		$this->load_textdomain();
155 155
 
156
-		do_action( 'wpinv_loaded' );
156
+		do_action('wpinv_loaded');
157 157
 
158 158
 		// Fix oxygen page builder conflict
159
-		if ( function_exists( 'ct_css_output' ) ) {
159
+		if (function_exists('ct_css_output')) {
160 160
 			wpinv_oxygen_fix_conflict();
161 161
 		}
162 162
 	}
@@ -166,21 +166,21 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @since 1.0
168 168
 	 */
169
-	public function load_textdomain( $locale = NULL ) {
170
-		if ( empty( $locale ) ) {
171
-			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
169
+	public function load_textdomain($locale = NULL) {
170
+		if (empty($locale)) {
171
+			$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
172 172
 		}
173 173
 
174
-		$locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
174
+		$locale = apply_filters('plugin_locale', $locale, 'invoicing');
175 175
 
176
-		unload_textdomain( 'invoicing' );
177
-		load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
178
-		load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
176
+		unload_textdomain('invoicing');
177
+		load_textdomain('invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo');
178
+		load_plugin_textdomain('invoicing', false, WPINV_PLUGIN_DIR . 'languages');
179 179
 
180 180
 		/**
181 181
 		 * Define language constants.
182 182
 		 */
183
-		require_once( WPINV_PLUGIN_DIR . 'language.php' );
183
+		require_once(WPINV_PLUGIN_DIR . 'language.php');
184 184
 	}
185 185
 
186 186
 	/**
@@ -189,89 +189,89 @@  discard block
 block discarded – undo
189 189
 	public function includes() {
190 190
 
191 191
 		// Start with the settings.
192
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
192
+		require_once(WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php');
193 193
 
194 194
 		// Packages/libraries.
195
-		require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
196
-		require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' );
195
+		require_once(WPINV_PLUGIN_DIR . 'vendor/autoload.php');
196
+		require_once(WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php');
197 197
 
198 198
 		// Load functions.
199
-		require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' );
200
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
201
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
202
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
203
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
204
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
205
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
206
-		require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' );
207
-		require_once( WPINV_PLUGIN_DIR . 'includes/subscription-functions.php' );
208
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
209
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
210
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
211
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
212
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php' );
213
-		require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' );
199
+		require_once(WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php');
200
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php');
201
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php');
202
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php');
203
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php');
204
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php');
205
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php');
206
+		require_once(WPINV_PLUGIN_DIR . 'includes/invoice-functions.php');
207
+		require_once(WPINV_PLUGIN_DIR . 'includes/subscription-functions.php');
208
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php');
209
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php');
210
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php');
211
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php');
212
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-user-functions.php');
213
+		require_once(WPINV_PLUGIN_DIR . 'includes/error-functions.php');
214 214
 
215 215
 		// Register autoloader.
216 216
 		try {
217
-			spl_autoload_register( array( $this, 'autoload' ), true );
218
-		} catch ( Exception $e ) {
219
-			wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
217
+			spl_autoload_register(array($this, 'autoload'), true);
218
+		} catch (Exception $e) {
219
+			wpinv_error_log($e->getMessage(), '', __FILE__, 149, true);
220 220
 		}
221 221
 
222
-		require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
223
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
224
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
225
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
226
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
227
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
228
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
229
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
230
-		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
231
-		require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
232
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
233
-		require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
234
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
235
-		require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
236
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
237
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
238
-		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
239
-		require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
240
-		require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
241
-		require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' );
222
+		require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php');
223
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php');
224
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php');
225
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php');
226
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php');
227
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php');
228
+		require_once(WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php');
229
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php');
230
+		require_once(WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php');
231
+		require_once(WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php');
232
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php');
233
+		require_once(WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php');
234
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php');
235
+		require_once(WPINV_PLUGIN_DIR . 'widgets/checkout.php');
236
+		require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-history.php');
237
+		require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php');
238
+		require_once(WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php');
239
+		require_once(WPINV_PLUGIN_DIR . 'widgets/subscriptions.php');
240
+		require_once(WPINV_PLUGIN_DIR . 'widgets/buy-item.php');
241
+		require_once(WPINV_PLUGIN_DIR . 'widgets/getpaid.php');
242 242
 
243 243
 		/**
244 244
 		 * Load the tax class.
245 245
 		 */
246
-		if ( ! class_exists( 'WPInv_EUVat' ) ) {
247
-			require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' );
246
+		if (!class_exists('WPInv_EUVat')) {
247
+			require_once(WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php');
248 248
 		}
249 249
 
250
-		if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
250
+		if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
251 251
 			GetPaid_Post_Types_Admin::init();
252 252
 
253
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php' );
254
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
255
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
256
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
257
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
258
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
259
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
260
-			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' );
253
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-upgrade-functions.php');
254
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php');
255
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php');
256
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php');
257
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php');
258
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php');
259
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php');
260
+			require_once(WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php');
261 261
 			// load the user class only on the users.php page
262 262
 			global $pagenow;
263
-			if($pagenow=='users.php'){
263
+			if ($pagenow == 'users.php') {
264 264
 				new WPInv_Admin_Users();
265 265
 			}
266 266
 		}
267 267
 
268 268
 		// Register cli commands
269
-		if ( defined( 'WP_CLI' ) && WP_CLI ) {
270
-			require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
271
-			WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
269
+		if (defined('WP_CLI') && WP_CLI) {
270
+			require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php');
271
+			WP_CLI::add_command('invoicing', 'WPInv_CLI');
272 272
 		}
273 273
 
274
-		require_once( WPINV_PLUGIN_DIR . 'includes/admin/install.php' );
274
+		require_once(WPINV_PLUGIN_DIR . 'includes/admin/install.php');
275 275
 	}
276 276
 
277 277
 	/**
@@ -282,21 +282,21 @@  discard block
 block discarded – undo
282 282
 	 * @since       1.0.19
283 283
 	 * @return      void
284 284
 	 */
285
-	public function autoload( $class_name ) {
285
+	public function autoload($class_name) {
286 286
 
287 287
 		// Normalize the class name...
288
-		$class_name  = strtolower( $class_name );
288
+		$class_name = strtolower($class_name);
289 289
 
290 290
 		// ... and make sure it is our class.
291
-		if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
291
+		if (false === strpos($class_name, 'getpaid_') && false === strpos($class_name, 'wpinv_')) {
292 292
 			return;
293 293
 		}
294 294
 
295 295
 		// Next, prepare the file name from the class.
296
-		$file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
296
+		$file_name = 'class-' . str_replace('_', '-', $class_name) . '.php';
297 297
 
298 298
 		// Base path of the classes.
299
-		$plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
299
+		$plugin_path = untrailingslashit(WPINV_PLUGIN_DIR);
300 300
 
301 301
 		// And an array of possible locations in order of importance.
302 302
 		$locations = array(
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
 			"$plugin_path/includes/admin/meta-boxes",
312 312
 		);
313 313
 
314
-		foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) {
314
+		foreach (apply_filters('getpaid_autoload_locations', $locations) as $location) {
315 315
 
316
-			if ( file_exists( trailingslashit( $location ) . $file_name ) ) {
317
-				include trailingslashit( $location ) . $file_name;
316
+			if (file_exists(trailingslashit($location) . $file_name)) {
317
+				include trailingslashit($location) . $file_name;
318 318
 				break;
319 319
 			}
320 320
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	public function init() {
329 329
 
330 330
 		// Fires before getpaid inits.
331
-		do_action( 'before_getpaid_init', $this );
331
+		do_action('before_getpaid_init', $this);
332 332
 
333 333
 		// Load default gateways.
334 334
 		$gateways = apply_filters(
@@ -342,12 +342,12 @@  discard block
 block discarded – undo
342 342
 			)
343 343
 		);
344 344
 
345
-		foreach ( $gateways as $id => $class ) {
346
-			$this->gateways[ $id ] = new $class();
345
+		foreach ($gateways as $id => $class) {
346
+			$this->gateways[$id] = new $class();
347 347
 		}
348 348
 
349 349
 		// Fires after getpaid inits.
350
-		do_action( 'getpaid_init', $this );
350
+		do_action('getpaid_init', $this);
351 351
 
352 352
 	}
353 353
 
@@ -357,55 +357,55 @@  discard block
 block discarded – undo
357 357
 	public function maybe_process_ipn() {
358 358
 
359 359
 		// Ensure that this is an IPN request.
360
-		if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) {
360
+		if (empty($_GET['wpi-listener']) || 'IPN' !== $_GET['wpi-listener'] || empty($_GET['wpi-gateway'])) {
361 361
 			return;
362 362
 		}
363 363
 
364
-		$gateway = wpinv_clean( $_GET['wpi-gateway'] );
364
+		$gateway = wpinv_clean($_GET['wpi-gateway']);
365 365
 
366
-		do_action( 'wpinv_verify_payment_ipn', $gateway );
367
-		do_action( "wpinv_verify_{$gateway}_ipn" );
366
+		do_action('wpinv_verify_payment_ipn', $gateway);
367
+		do_action("wpinv_verify_{$gateway}_ipn");
368 368
 		exit;
369 369
 
370 370
 	}
371 371
 
372 372
 	public function enqueue_scripts() {
373
-		$suffix       = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
373
+		$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
374 374
 
375
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/css/invoice-front.css' );
376
-		wp_register_style( 'wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), $version );
377
-		wp_enqueue_style( 'wpinv_front_style' );
375
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/css/invoice-front.css');
376
+		wp_register_style('wpinv_front_style', WPINV_PLUGIN_URL . 'assets/css/invoice-front.css', array(), $version);
377
+		wp_enqueue_style('wpinv_front_style');
378 378
 
379 379
 		// Register scripts
380
-		wp_register_script( 'jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array( 'jquery' ), '2.70', true );
381
-		wp_register_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array( 'jquery' ),  filemtime( WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js' ) );
380
+		wp_register_script('jquery-blockui', WPINV_PLUGIN_URL . 'assets/js/jquery.blockUI.min.js', array('jquery'), '2.70', true);
381
+		wp_register_script('wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/invoice-front.js', array('jquery'), filemtime(WPINV_PLUGIN_DIR . 'assets/js/invoice-front.js'));
382 382
 
383 383
 		$localize                         = array();
384
-		$localize['ajax_url']             = admin_url( 'admin-ajax.php' );
385
-		$localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
386
-		$localize['txtComplete']          = __( 'Continue', 'invoicing' );
384
+		$localize['ajax_url']             = admin_url('admin-ajax.php');
385
+		$localize['nonce']                = wp_create_nonce('wpinv-nonce');
386
+		$localize['txtComplete']          = __('Continue', 'invoicing');
387 387
 		$localize['UseTaxes']             = wpinv_use_taxes();
388
-		$localize['checkoutNonce']        = wp_create_nonce( 'wpinv_checkout_nonce' );
389
-		$localize['formNonce']            = wp_create_nonce( 'getpaid_form_nonce' );
390
-		$localize['connectionError']      = __( 'Could not establish a connection to the server.', 'invoicing' );
388
+		$localize['checkoutNonce']        = wp_create_nonce('wpinv_checkout_nonce');
389
+		$localize['formNonce']            = wp_create_nonce('getpaid_form_nonce');
390
+		$localize['connectionError']      = __('Could not establish a connection to the server.', 'invoicing');
391 391
 
392
-		$localize = apply_filters( 'wpinv_front_js_localize', $localize );
392
+		$localize = apply_filters('wpinv_front_js_localize', $localize);
393 393
 
394
-		wp_enqueue_script( 'jquery-blockui' );
394
+		wp_enqueue_script('jquery-blockui');
395 395
 
396
-		wp_enqueue_style( "select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), WPINV_VERSION, 'all' );
397
-		wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), WPINV_VERSION );
396
+		wp_enqueue_style("select2", WPINV_PLUGIN_URL . 'assets/css/select2/select2.min.css', array(), WPINV_VERSION, 'all');
397
+		wp_enqueue_script('select2', WPINV_PLUGIN_URL . 'assets/js/select2/select2.full' . $suffix . '.js', array('jquery'), WPINV_VERSION);
398 398
 
399
-		wp_enqueue_script( 'wpinv-front-script' );
400
-		wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
399
+		wp_enqueue_script('wpinv-front-script');
400
+		wp_localize_script('wpinv-front-script', 'WPInv', $localize);
401 401
 
402
-		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
403
-		wp_enqueue_script( 'wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'wpinv-front-script', 'wp-hooks' ),  $version, true );
402
+		$version = filemtime(WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js');
403
+		wp_enqueue_script('wpinv-payment-form-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array('wpinv-front-script', 'wp-hooks'), $version, true);
404 404
 	}
405 405
 
406 406
 	public function wpinv_actions() {
407
-		if ( isset( $_REQUEST['wpi_action'] ) ) {
408
-			do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
407
+		if (isset($_REQUEST['wpi_action'])) {
408
+			do_action('wpinv_' . wpinv_sanitize_key($_REQUEST['wpi_action']), $_REQUEST);
409 409
 		}
410 410
 	}
411 411
 
@@ -417,31 +417,31 @@  discard block
 block discarded – undo
417 417
      */
418 418
     public function maybe_do_authenticated_action() {
419 419
 
420
-		if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
420
+		if (isset($_REQUEST['getpaid-action']) && isset($_REQUEST['getpaid-nonce']) && wp_verify_nonce($_REQUEST['getpaid-nonce'], 'getpaid-nonce')) {
421 421
 
422
-			$key = sanitize_key( $_REQUEST['getpaid-action'] );
423
-			if ( is_user_logged_in() ) {
424
-				do_action( "getpaid_authenticated_action_$key", $_REQUEST );
422
+			$key = sanitize_key($_REQUEST['getpaid-action']);
423
+			if (is_user_logged_in()) {
424
+				do_action("getpaid_authenticated_action_$key", $_REQUEST);
425 425
 			}
426 426
 
427
-			do_action( "getpaid_unauthenticated_action_$key", $_REQUEST );
427
+			do_action("getpaid_unauthenticated_action_$key", $_REQUEST);
428 428
 
429 429
 		}
430 430
         
431 431
 
432 432
     }
433 433
 
434
-	public function pre_get_posts( $wp_query ) {
434
+	public function pre_get_posts($wp_query) {
435 435
 
436
-		if ( ! is_admin() && ! empty( $wp_query->query_vars['post_type'] ) && getpaid_is_invoice_post_type( $wp_query->query_vars['post_type'] ) && is_user_logged_in() && is_single() && $wp_query->is_main_query() ) {
437
-			$wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) );
436
+		if (!is_admin() && !empty($wp_query->query_vars['post_type']) && getpaid_is_invoice_post_type($wp_query->query_vars['post_type']) && is_user_logged_in() && is_single() && $wp_query->is_main_query()) {
437
+			$wp_query->query_vars['post_status'] = array_keys(wpinv_get_invoice_statuses(false, false, $wp_query->query_vars['post_type']));
438 438
 		}
439 439
 
440 440
 		return $wp_query;
441 441
 	}
442 442
 
443 443
 	public function bp_invoicing_init() {
444
-		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' );
444
+		require_once(WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php');
445 445
 	}
446 446
 
447 447
 	/**
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 			)
463 463
 		);
464 464
 
465
-		foreach ( $widgets as $widget ) {
466
-			register_widget( $widget );
465
+		foreach ($widgets as $widget) {
466
+			register_widget($widget);
467 467
 		}
468 468
 		
469 469
 	}
@@ -474,10 +474,10 @@  discard block
 block discarded – undo
474 474
 	 * @since 1.0.19
475 475
 	 * @param int[] $excluded_posts_ids
476 476
 	 */
477
-	public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){
477
+	public function wpseo_exclude_from_sitemap_by_post_ids($excluded_posts_ids) {
478 478
 
479 479
 		// Ensure that we have an array.
480
-		if ( ! is_array( $excluded_posts_ids ) ) {
480
+		if (!is_array($excluded_posts_ids)) {
481 481
 			$excluded_posts_ids = array();
482 482
 		}
483 483
 
@@ -485,24 +485,24 @@  discard block
 block discarded – undo
485 485
 		$our_pages = array();
486 486
 
487 487
 		// Checkout page.
488
-		$our_pages[] = wpinv_get_option( 'checkout_page', false );
488
+		$our_pages[] = wpinv_get_option('checkout_page', false);
489 489
 
490 490
 		// Success page.
491
-		$our_pages[] = wpinv_get_option( 'success_page', false );
491
+		$our_pages[] = wpinv_get_option('success_page', false);
492 492
 
493 493
 		// Failure page.
494
-		$our_pages[] = wpinv_get_option( 'failure_page', false );
494
+		$our_pages[] = wpinv_get_option('failure_page', false);
495 495
 
496 496
 		// History page.
497
-		$our_pages[] = wpinv_get_option( 'invoice_history_page', false );
497
+		$our_pages[] = wpinv_get_option('invoice_history_page', false);
498 498
 
499 499
 		// Subscriptions page.
500
-		$our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
500
+		$our_pages[] = wpinv_get_option('invoice_subscription_page', false);
501 501
 
502
-		$our_pages   = array_map( 'intval', array_filter( $our_pages ) );
502
+		$our_pages   = array_map('intval', array_filter($our_pages));
503 503
 
504 504
 		$excluded_posts_ids = $excluded_posts_ids + $our_pages;
505
-		return array_unique( $excluded_posts_ids );
505
+		return array_unique($excluded_posts_ids);
506 506
 
507 507
 	}
508 508
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 					<div class="modal-dialog modal-dialog-centered modal-lg" role="checkout" style="max-width: 650px;">
514 514
 						<div class="modal-content">
515 515
 							<div class="modal-body">
516
-								<button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="' . esc_attr__( 'Close', 'invoicing' ) . '">
516
+								<button type="button" class="close p-2 getpaid-payment-modal-close d-sm-none" data-dismiss="modal" aria-label="' . esc_attr__('Close', 'invoicing') . '">
517 517
 									<i class="fa fa-times" aria-hidden="true"></i>
518 518
 								</button>
519 519
 								<div class="modal-body-wrapper"></div>
Please login to merge, or discard this patch.
includes/class-wpinv-subscriptions-db.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * The Subscriptions DB Class
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
             'transaction_id'    => '',
73 73
             'parent_payment_id' => 0,
74 74
             'product_id'        => 0,
75
-            'created'           => date( 'Y-m-d H:i:s' ),
76
-            'expiration'        => date( 'Y-m-d H:i:s' ),
75
+            'created'           => date('Y-m-d H:i:s'),
76
+            'expiration'        => date('Y-m-d H:i:s'),
77 77
             'trial_period'      => '',
78 78
             'status'            => '',
79 79
             'profile_id'        => '',
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
      * @access  public
87 87
      * @since   1.0.0
88 88
      */
89
-    public function get_subscriptions( $args = array() ) {
90
-        return getpaid_get_subscriptions( $args );
89
+    public function get_subscriptions($args = array()) {
90
+        return getpaid_get_subscriptions($args);
91 91
     }
92 92
 
93 93
     /**
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
      * @access  public
97 97
      * @since   1.0.0
98 98
      */
99
-    public function count( $args = array() ) {
100
-        return getpaid_get_subscriptions( $args, 'count' );
99
+    public function count($args = array()) {
100
+        return getpaid_get_subscriptions($args, 'count');
101 101
     }
102 102
 
103 103
     /**
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     public function create_table() {
110 110
 
111
-        require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
111
+        require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
112 112
 
113 113
         $sql = "CREATE TABLE " . $this->table_name . " (
114 114
         id bigint(20) NOT NULL AUTO_INCREMENT,
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
         KEY customer_and_status ( customer_id, status)
134 134
         ) CHARACTER SET utf8 COLLATE utf8_general_ci;";
135 135
 
136
-        dbDelta( $sql );
136
+        dbDelta($sql);
137 137
 
138
-        update_option( $this->table_name . '_db_version', $this->version );
138
+        update_option($this->table_name . '_db_version', $this->version);
139 139
     }
140 140
 
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.