Give_Frontend::bc_240()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This class will handle file loading for frontend.
5
 *
6
 * @package     Give
7
 * @subpackage  Frontend
8
 * @copyright   Copyright (c) 2018, GiveWP
9
 * @license     https://opensource.org/licenses/gpl-license GNU Public License
10
 * @since       2.4.0
11
 */
12
class Give_Frontend {
0 ignored issues
show
Coding Style introduced by
Since you have declared the constructor as private, maybe you should also declare the class as final.
Loading history...
13
	/**
14
	 * Instance.
15
	 *
16
	 * @since  2.4.0
17
	 * @access private
18
	 * @var
19
	 */
20
	static private $instance;
21
22
	/**
23
	 * Singleton pattern.
24
	 *
25
	 * @since  2.4.0
26
	 * @access private
27
	 */
28
	private function __construct() {
29
	}
30
31
32
	/**
33
	 * Get instance.
34
	 *
35
	 * @since  2.4.0
36
	 * @access public
37
	 * @return Give_Frontend
38
	 */
39
	public static function get_instance() {
40
		if ( null === static::$instance ) {
41
			self::$instance = new static();
42
			self::$instance->setup();
43
		}
44
45
		return self::$instance;
46
	}
47
48
	/**
49
	 * Setup Admin
50
	 *
51
	 * @sinve  2.4.0
52
	 * @access private
53
	 */
54
	private function setup() {
55
		$this->admin_loading();
56
57
		add_action( 'give_init', array( $this, 'bc_240' ), 0 );
58
	}
59
60
	/**
61
	 *  Load core file
62
	 *
63
	 * @since  2.4.0
64
	 * @access private
65
	 */
66
	private function admin_loading() {
67
		require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
68
		require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; // @todo: [refactor] can be load only for success and history page.
69
	}
70
71
	/**
72
	 * Backward compatibility GIVE_VERSION < 2.4.0
73
	 *
74
	 * @since 2.4.0
75
	 * @ccess public
76
	 *
77
	 * @param Give $give
78
	 */
79
	public function bc_240( $give ) {
80
		$give->template_loader = new Give_Template_Loader();
81
		$give->email_access    = new Give_Email_Access();
82
	}
83
}
84
85
Give_Frontend::get_instance();
86