| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Author Name: Liton Arefin |
| 5 |
* Author URL: https://jeweltheme.com |
| 6 |
* Date: 9/8/19 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace MasterAddons\Inc\Admin\Templates; |
| 10 |
|
| 11 |
use MasterAddons\Inc\Admin\Templates\Includes\Types; |
| 12 |
use MasterAddons\Inc\Classes\Helper; |
| 13 |
use MasterAddons\Inc\Classes\Template_Library_Cache; |
| 14 |
use MasterAddons\Inc\Classes\Template_Kit_Cache; |
| 15 |
|
| 16 |
if (!defined('ABSPATH')) exit; |
| 17 |
|
| 18 |
|
| 19 |
if (!class_exists(__NAMESPACE__ . '\\Master_Templates')) { |
| 20 |
|
| 21 |
|
| 22 |
class Master_Templates |
| 23 |
{ |
| 24 |
|
| 25 |
private static $instance = null; |
| 26 |
public $api; |
| 27 |
public $config; |
| 28 |
public $assets; |
| 29 |
public $temp_manager; |
| 30 |
public $types; |
| 31 |
|
| 32 |
public function __construct() |
| 33 |
{ |
| 34 |
// Initialize Template Kits system |
| 35 |
$this->load_template_kits(); |
| 36 |
add_action('init', array($this, 'init')); |
| 37 |
} |
| 38 |
|
| 39 |
public function init() |
| 40 |
{ |
| 41 |
|
| 42 |
$this->load_files(); |
| 43 |
|
| 44 |
$this->set_config(); |
| 45 |
|
| 46 |
$this->set_assets(); |
| 47 |
|
| 48 |
$this->set_api(); |
| 49 |
|
| 50 |
$this->set_types(); |
| 51 |
|
| 52 |
$this->set_templates_manager(); |
| 53 |
} |
| 54 |
|
| 55 |
private function load_files() |
| 56 |
{ |
| 57 |
// Template Library (no namespace, needs manual require) |
| 58 |
$plugin_path = defined('JLTMA_PATH') ? JLTMA_PATH : (defined('JLTMA_PRO_PATH') ? JLTMA_PRO_PATH : ''); |
| 59 |
require_once $plugin_path . 'inc/admin/templates/library/template-library.php'; |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
private function set_config() |
| 64 |
{ |
| 65 |
|
| 66 |
$this->config = new Includes\Classes\Config(); |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
private function set_assets() |
| 71 |
{ |
| 72 |
|
| 73 |
$this->assets = new Includes\Classes\Assets(); |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
private function set_api() |
| 78 |
{ |
| 79 |
|
| 80 |
$this->api = new Includes\Classes\API(); |
| 81 |
} |
| 82 |
|
| 83 |
|
| 84 |
private function set_types() |
| 85 |
{ |
| 86 |
|
| 87 |
$this->types = new Includes\Types\Manager(); |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
private function set_templates_manager() |
| 92 |
{ |
| 93 |
|
| 94 |
$this->temp_manager = new Includes\Classes\Manager(); |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
/** |
| 99 |
* Load Template Kits system |
| 100 |
*/ |
| 101 |
private function load_template_kits() { |
| 102 |
Kits\Kits_Loader::get_instance(); |
| 103 |
} |
| 104 |
|
| 105 |
public static function get_instance() |
| 106 |
{ |
| 107 |
if (self::$instance == null) { |
| 108 |
self::$instance = new self; |
| 109 |
} |
| 110 |
return self::$instance; |
| 111 |
} |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
if (!function_exists('master_addons_templates')) { |
| 116 |
function master_addons_templates() |
| 117 |
{ |
| 118 |
return Master_Templates::get_instance(); |
| 119 |
} |
| 120 |
} |
| 121 |
master_addons_templates(); |
| 122 |
|