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