Passed
Push — master ( 98ef57...3b6696 )
by Brian
05:27
created

WPInv_Plugin::autoload()   A

Complexity

Conditions 5
Paths 4

Size

Total Lines 34
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 19
c 0
b 0
f 0
dl 0
loc 34
rs 9.3222
cc 5
nc 4
nop 1
1
<?php
2
/**
3
 * Main Invoicing class.
4
 *
5
 * @package Invoicing
6
 * @since   1.0.0
7
 */
8
9
defined( 'ABSPATH' ) || exit;
10
11
/**
12
 * Main Invoicing class.
13
 *
14
 */
15
class WPInv_Plugin {
16
17
	/**
18
	 * GetPaid version.
19
	 *
20
	 * @var string
21
	 */
22
	public $version;
23
24
	/**
25
	 * Data container.
26
	 *
27
	 * @var array
28
	 */
29
	protected $data = array();
30
31
	/**
32
	 * Form elements instance.
33
	 *
34
	 * @var WPInv_Payment_Form_Elements
0 ignored issues
show
Bug introduced by
The type WPInv_Payment_Form_Elements was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
35
	 */
36
	public $form_elements;
37
38
	/**
39
	 * @param array An array of payment gateways.
40
	 */
41
	public $gateways;
42
43
	/**
44
	 * Class constructor.
45
	 */
46
	public function __construct() {
47
		$this->define_constants();
48
		$this->includes();
49
		$this->init_hooks();
50
		$this->set_properties();
51
	}
52
53
	/**
54
	 * Sets a custom data property.
55
	 * 
56
	 * @param string $prop The prop to set.
57
	 * @param mixed $value The value to retrieve.
58
	 */
59
	public function set( $prop, $value ) {
60
		$this->data[ $prop ] = $value;
61
	}
62
63
	/**
64
	 * Gets a custom data property.
65
	 *
66
	 * @param string $prop The prop to set.
67
	 * @return mixed The value.
68
	 */
69
	public function get( $prop ) {
70
71
		if ( isset( $this->data[ $prop ] ) ) {
72
			return $this->data[ $prop ];
73
		}
74
75
		return null;
76
	}
77
78
	/**
79
	 * Define class properties.
80
	 */
81
	public function set_properties() {
82
83
		// Sessions.
84
		$this->set( 'session', new WPInv_Session_Handler() );
85
		$GLOBALS['wpi_session'] = $this->get( 'session' ); // Backwards compatibility.
86
		$GLOBALS['wpinv_euvat'] = new WPInv_EUVat(); // Backwards compatibility.
0 ignored issues
show
Deprecated Code introduced by
The class WPInv_EUVat has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

86
		$GLOBALS['wpinv_euvat'] = /** @scrutinizer ignore-deprecated */ new WPInv_EUVat(); // Backwards compatibility.
Loading history...
87
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() );
101
102
	}
103
104
	 /**
105
	 * Define plugin constants.
106
	 */
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 ) );
110
		$this->version = WPINV_VERSION;
111
	}
112
113
	/**
114
	 * Hook into actions and filters.
115
	 *
116
	 * @since 1.0.19
117
	 */
118
	protected function init_hooks() {
119
		/* Internationalize the text strings used. */
120
		add_action( 'plugins_loaded', array( &$this, 'plugins_loaded' ) );
121
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 );
127
		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 11 );
128
		add_action( 'wp_footer', array( $this, 'wp_footer' ) );
129
		add_action( 'wp_head', array( $this, 'wp_head' ) );
130
		add_action( 'widgets_init', array( &$this, 'register_widgets' ) );
131
		add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'wpseo_exclude_from_sitemap_by_post_ids' ) );
132
		add_filter( 'pre_get_posts', array( &$this, 'pre_get_posts' ) );
133
134
		// Fires after registering actions.
135
		do_action( 'wpinv_actions', $this );
136
		do_action( 'getpaid_actions', $this );
137
138
	}
139
140
	public function plugins_loaded() {
141
		/* Internationalize the text strings used. */
142
		$this->load_textdomain();
143
144
		do_action( 'wpinv_loaded' );
145
146
		// Fix oxygen page builder conflict
147
		if ( function_exists( 'ct_css_output' ) ) {
148
			wpinv_oxygen_fix_conflict();
149
		}
150
	}
151
152
	/**
153
	 * Load the translation of the plugin.
154
	 *
155
	 * @since 1.0
156
	 */
157
	public function load_textdomain( $locale = NULL ) {
158
		if ( empty( $locale ) ) {
159
			$locale = is_admin() && function_exists( 'get_user_locale' ) ? get_user_locale() : get_locale();
160
		}
161
162
		$locale = apply_filters( 'plugin_locale', $locale, 'invoicing' );
0 ignored issues
show
Unused Code introduced by
The call to get_locale() has too many arguments starting with $locale. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

162
		$locale = /** @scrutinizer ignore-call */ apply_filters( 'plugin_locale', $locale, 'invoicing' );

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
163
164
		unload_textdomain( 'invoicing' );
165
		load_textdomain( 'invoicing', WP_LANG_DIR . '/invoicing/invoicing-' . $locale . '.mo' );
166
		load_plugin_textdomain( 'invoicing', false, WPINV_PLUGIN_DIR . 'languages' );
167
168
		/**
169
		 * Define language constants.
170
		 */
171
		require_once( WPINV_PLUGIN_DIR . 'language.php' );
172
	}
173
174
	/**
175
	 * Include required core files used in admin and on the frontend.
176
	 */
177
	public function includes() {
178
179
		// Start with the settings.
180
		require_once( WPINV_PLUGIN_DIR . 'includes/admin/register-settings.php' );
181
182
		// Packages/libraries.
183
		require_once( WPINV_PLUGIN_DIR . 'vendor/autoload.php' );
184
		require_once( WPINV_PLUGIN_DIR . 'vendor/ayecode/wp-ayecode-ui/ayecode-ui-loader.php' );
185
186
		// Load functions.
187
		require_once( WPINV_PLUGIN_DIR . 'includes/deprecated-functions.php' );
188
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-email-functions.php' );
189
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-general-functions.php' );
190
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-helper-functions.php' );
191
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-tax-functions.php' );
192
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-template-functions.php' );
193
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-address-functions.php' );
194
		require_once( WPINV_PLUGIN_DIR . 'includes/invoice-functions.php' );
195
		require_once( WPINV_PLUGIN_DIR . 'includes/subscription-functions.php' );
196
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-item-functions.php' );
197
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-discount-functions.php' );
198
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-gateway-functions.php' );
199
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-payment-functions.php' );
200
		require_once( WPINV_PLUGIN_DIR . 'includes/user-functions.php' );
201
		require_once( WPINV_PLUGIN_DIR . 'includes/error-functions.php' );
202
203
		// Register autoloader.
204
		try {
205
			spl_autoload_register( array( $this, 'autoload' ), true );
206
		} catch ( Exception $e ) {
207
			wpinv_error_log( $e->getMessage(), '', __FILE__, 149, true );
208
		}
209
210
		require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-session.php' );
211
		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-session-handler.php' );
212
		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-ajax.php' );
213
		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-api.php' );
214
		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cache-helper.php' );
215
		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-db.php' );
216
		require_once( WPINV_PLUGIN_DIR . 'includes/admin/subscriptions.php' );
217
		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-subscriptions-db.php' );
218
		require_once( WPINV_PLUGIN_DIR . 'includes/wpinv-subscription.php' );
219
		require_once( WPINV_PLUGIN_DIR . 'includes/abstracts/abstract-wpinv-privacy.php' );
220
		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' );
221
		require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' );
222
		require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' );
223
		require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' );
224
		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' );
225
		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' );
226
		require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' );
227
		require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' );
228
		require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' );
229
		require_once( WPINV_PLUGIN_DIR . 'widgets/getpaid.php' );
230
		require_once( WPINV_PLUGIN_DIR . 'includes/admin/admin-pages.php' );
231
232
		if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
0 ignored issues
show
Bug introduced by
The constant WP_CLI was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
233
			GetPaid_Post_Types_Admin::init();
234
235
			require_once( WPINV_PLUGIN_DIR . 'includes/admin/wpinv-admin-functions.php' );
236
			require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-payment-form.php' );
237
			require_once( WPINV_PLUGIN_DIR . 'includes/admin/meta-boxes/class-mb-invoice-notes.php' );
238
			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-admin-menus.php' );
239
			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-wpinv-users.php' );
240
			require_once( WPINV_PLUGIN_DIR . 'includes/admin/class-getpaid-admin-profile.php' );
241
			// load the user class only on the users.php page
242
			global $pagenow;
243
			if($pagenow=='users.php'){
244
				new WPInv_Admin_Users();
245
			}
246
		}
247
248
		// Register cli commands
249
		if ( defined( 'WP_CLI' ) && WP_CLI ) {
250
			require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-cli.php' );
251
			WP_CLI::add_command( 'invoicing', 'WPInv_CLI' );
0 ignored issues
show
Bug introduced by
The type WP_CLI was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
252
		}
253
254
	}
255
256
	/**
257
	 * Class autoloader
258
	 *
259
	 * @param       string $class_name The name of the class to load.
260
	 * @access      public
261
	 * @since       1.0.19
262
	 * @return      void
263
	 */
264
	public function autoload( $class_name ) {
265
266
		// Normalize the class name...
267
		$class_name  = strtolower( $class_name );
268
269
		// ... and make sure it is our class.
270
		if ( false === strpos( $class_name, 'getpaid_' ) && false === strpos( $class_name, 'wpinv_' ) ) {
271
			return;
272
		}
273
274
		// Next, prepare the file name from the class.
275
		$file_name = 'class-' . str_replace( '_', '-', $class_name ) . '.php';
276
277
		// Base path of the classes.
278
		$plugin_path = untrailingslashit( WPINV_PLUGIN_DIR );
279
280
		// And an array of possible locations in order of importance.
281
		$locations = array(
282
			"$plugin_path/includes",
283
			"$plugin_path/includes/data-stores",
284
			"$plugin_path/includes/gateways",
285
			"$plugin_path/includes/payments",
286
			"$plugin_path/includes/geolocation",
287
			"$plugin_path/includes/reports",
288
			"$plugin_path/includes/api",
289
			"$plugin_path/includes/admin",
290
			"$plugin_path/includes/admin/meta-boxes",
291
		);
292
293
		foreach ( apply_filters( 'getpaid_autoload_locations', $locations ) as $location ) {
294
295
			if ( file_exists( trailingslashit( $location ) . $file_name ) ) {
296
				include trailingslashit( $location ) . $file_name;
297
				break;
298
			}
299
300
		}
301
302
	}
303
304
	/**
305
	 * Inits hooks etc.
306
	 */
307
	public function init() {
308
309
		// Fires before getpaid inits.
310
		do_action( 'before_getpaid_init', $this );
311
312
		// Maybe upgrade.
313
		$this->maybe_upgrade_database();
314
315
		// Load default gateways.
316
		$gateways = apply_filters(
317
			'getpaid_default_gateways',
318
			array(
319
				'manual'        => 'GetPaid_Manual_Gateway',
320
				'paypal'        => 'GetPaid_Paypal_Gateway',
321
				'worldpay'      => 'GetPaid_Worldpay_Gateway',
322
				'bank_transfer' => 'GetPaid_Bank_Transfer_Gateway',
323
				'authorizenet'  => 'GetPaid_Authorize_Net_Gateway',
324
			)
325
		);
326
327
		foreach ( $gateways as $id => $class ) {
328
			$this->gateways[ $id ] = new $class();
329
		}
330
331
		// Fires after getpaid inits.
332
		do_action( 'getpaid_init', $this );
333
334
	}
335
336
	/**
337
	 * Checks if this is an IPN request and processes it.
338
	 */
339
	public function maybe_process_ipn() {
340
341
		// Ensure that this is an IPN request.
342
		if ( empty( $_GET['wpi-listener'] ) || 'IPN' !== $_GET['wpi-listener'] || empty( $_GET['wpi-gateway'] ) ) {
343
			return;
344
		}
345
346
		$gateway = wpinv_clean( $_GET['wpi-gateway'] );
347
348
		do_action( 'wpinv_verify_payment_ipn', $gateway );
349
		do_action( "wpinv_verify_{$gateway}_ipn" );
350
		exit;
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
351
352
	}
353
354
	public function enqueue_scripts() {
355
356
		// Fires before adding scripts.
357
		do_action( 'getpaid_enqueue_scripts' );
358
359
		$localize                         = array();
360
		$localize['ajax_url']             = admin_url( 'admin-ajax.php' );
361
		$localize['nonce']                = wp_create_nonce( 'wpinv-nonce' );
362
		$localize['txtComplete']          = __( 'Continue', 'invoicing' );
363
		$localize['UseTaxes']             = wpinv_use_taxes();
364
		$localize['formNonce']            = wp_create_nonce( 'getpaid_form_nonce' );
365
		$localize['loading']              = __( 'Loading...', 'invoicing' );
366
		$localize['connectionError']      = __( 'Could not establish a connection to the server.', 'invoicing' );
367
368
		$localize = apply_filters( 'wpinv_front_js_localize', $localize );
369
370
		$version = filemtime( WPINV_PLUGIN_DIR . 'assets/js/payment-forms.js' );
371
		wp_enqueue_script( 'wpinv-front-script', WPINV_PLUGIN_URL . 'assets/js/payment-forms.js', array( 'jquery' ),  $version, true );
372
		wp_localize_script( 'wpinv-front-script', 'WPInv', $localize );
373
	}
374
375
	public function wpinv_actions() {
376
		if ( isset( $_REQUEST['wpi_action'] ) ) {
377
			do_action( 'wpinv_' . wpinv_sanitize_key( $_REQUEST['wpi_action'] ), $_REQUEST );
378
		}
379
	}
380
381
	/**
382
     * Fires an action after verifying that a user can fire them.
383
	 *
384
	 * Note: If the action is on an invoice, subscription etc, esure that the
385
	 * current user owns the invoice/subscription.
386
     */
387
    public function maybe_do_authenticated_action() {
388
389
		if ( isset( $_REQUEST['getpaid-action'] ) && isset( $_REQUEST['getpaid-nonce'] ) && wp_verify_nonce( $_REQUEST['getpaid-nonce'], 'getpaid-nonce' ) ) {
390
391
			$key  = sanitize_key( $_REQUEST['getpaid-action'] );
392
			$data = wp_unslash( $_REQUEST );
393
			if ( is_user_logged_in() ) {
394
				do_action( "getpaid_authenticated_action_$key", $data );
395
			}
396
397
			do_action( "getpaid_unauthenticated_action_$key", $data );
398
399
		}
400
401
    }
402
403
	public function pre_get_posts( $wp_query ) {
404
405
		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() ) {
406
			$wp_query->query_vars['post_status'] = array_keys( wpinv_get_invoice_statuses( false, false, $wp_query->query_vars['post_type'] ) );
407
		}
408
409
		return $wp_query;
410
	}
411
412
	/**
413
	 * Register widgets
414
	 *
415
	 */
416
	public function register_widgets() {
417
418
		// Currently, UX Builder does not work particulaly well with SuperDuper.
419
		// So we disable our widgets when editing a page with UX Builder.
420
		if ( function_exists( 'ux_builder_is_active' ) && ux_builder_is_active() ) {
421
			return;
422
		}
423
424
		$widgets = apply_filters(
425
			'getpaid_widget_classes',
426
			array(
427
				'WPInv_Checkout_Widget',
428
				'WPInv_History_Widget',
429
				'WPInv_Receipt_Widget',
430
				'WPInv_Subscriptions_Widget',
431
				'WPInv_Buy_Item_Widget',
432
				'WPInv_Messages_Widget',
433
				'WPInv_GetPaid_Widget'
434
			)
435
		);
436
437
		foreach ( $widgets as $widget ) {
438
			register_widget( $widget );
439
		}
440
		
441
	}
442
443
	/**
444
	 * Upgrades the database.
445
	 *
446
	 * @since 2.0.2
447
	 */
448
	public function maybe_upgrade_database() {
449
450
		$wpi_version = get_option( 'wpinv_version', 0 );
451
452
		if ( $wpi_version == WPINV_VERSION ) {
453
			return;
454
		}
455
456
		$installer = new GetPaid_Installer();
457
458
		if ( empty( $wpi_version ) ) {
459
			return $installer->upgrade_db( 0 );
0 ignored issues
show
Bug introduced by
Are you sure the usage of $installer->upgrade_db(0) targeting GetPaid_Installer::upgrade_db() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
460
		}
461
462
		$upgrades  = array(
463
			'0.0.5' => '004',
464
			'1.0.3' => '102',
465
			'2.0.0' => '118',
466
			'2.0.8' => '207',
467
		);
468
469
		foreach ( $upgrades as $key => $method ) {
470
471
			if ( version_compare( $wpi_version, $key, '<' ) ) {
472
				return $installer->upgrade_db( $method );
0 ignored issues
show
Bug introduced by
Are you sure the usage of $installer->upgrade_db($method) targeting GetPaid_Installer::upgrade_db() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
473
			}
474
475
		}
476
477
	}
478
479
	/**
480
	 * Flushes the permalinks if needed.
481
	 *
482
	 * @since 2.0.8
483
	 */
484
	public function maybe_flush_permalinks() {
485
486
		$flush = get_option( 'wpinv_flush_permalinks', 0 );
487
488
		if ( ! empty( $flush ) ) {
489
			flush_rewrite_rules();
490
			delete_option( 'wpinv_flush_permalinks' );
491
		}
492
493
	}
494
495
	/**
496
	 * Remove our pages from yoast sitemaps.
497
	 *
498
	 * @since 1.0.19
499
	 * @param int[] $excluded_posts_ids
500
	 */
501
	public function wpseo_exclude_from_sitemap_by_post_ids( $excluded_posts_ids ){
502
503
		// Ensure that we have an array.
504
		if ( ! is_array( $excluded_posts_ids ) ) {
0 ignored issues
show
introduced by
The condition is_array($excluded_posts_ids) is always true.
Loading history...
505
			$excluded_posts_ids = array();
506
		}
507
508
		// Prepare our pages.
509
		$our_pages = array();
510
511
		// Checkout page.
512
		$our_pages[] = wpinv_get_option( 'checkout_page', false );
513
514
		// Success page.
515
		$our_pages[] = wpinv_get_option( 'success_page', false );
516
517
		// Failure page.
518
		$our_pages[] = wpinv_get_option( 'failure_page', false );
519
520
		// History page.
521
		$our_pages[] = wpinv_get_option( 'invoice_history_page', false );
522
523
		// Subscriptions page.
524
		$our_pages[] = wpinv_get_option( 'invoice_subscription_page', false );
525
526
		$our_pages   = array_map( 'intval', array_filter( $our_pages ) );
527
528
		$excluded_posts_ids = $excluded_posts_ids + $our_pages;
529
		return array_unique( $excluded_posts_ids );
530
531
	}
532
533
	/**
534
	 * Displays additional footer code.
535
	 * 
536
	 * @since 2.0.0
537
	 */
538
	public function wp_footer() {
539
		wpinv_get_template( 'frontend-footer.php' );
540
	}
541
542
	/**
543
	 * Displays additional header code.
544
	 * 
545
	 * @since 2.0.0
546
	 */
547
	public function wp_head() {
548
		wpinv_get_template( 'frontend-head.php' );
549
	}
550
551
}
552