forked from LearnPress/learnpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass-lp-template.php
76 lines (63 loc) · 1.51 KB
/
class-lp-template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* Class LP_Template
*
* @since 3.3.0
*/
class LP_Template {
/**
* @var LP_Template
*/
protected static $instance = null;
public $templates = array();
/**
* LP_Template constructor.
*/
protected function __construct() {
include_once 'templates/class-lp-template-general.php';
include_once 'templates/class-lp-template-course.php';
include_once 'templates/class-lp-template-checkout.php';
include_once 'templates/class-lp-template-profile.php';
$this->templates = apply_filters(
'learn-press/templates-classes',
array(
'general' => new LP_Template_General(),
'course' => new LP_Template_Course(),
'checkout' => new LP_Template_Checkout(),
'profile' => new LP_Template_Profile(),
)
);
}
public function get_templates() {
return $this->templates;
}
public function get_template( $name ) {
return $this->templates[ $name ] ?? '';
}
public function has_content( $where ) {
return has_action( $where );
}
public function offsetGet( $offset ) {
return ! empty( $this->templates[ $offset ] ) ? $this->templates[ $offset ] : false;
}
public function offsetSet( $offset, $value ) {
return false;
}
public function offsetExists( $offset ) {
return ! empty( $this->templates[ $offset ] );
}
public function offsetUnset( $offset ) {
return false;
}
/**
* Instance lp template
*
* @return LP_Template
*/
public static function instance() {
if ( ! self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
}