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