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