PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 2.0.0
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v2.0.0
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/Plugin.php +57 -86 3.1.102.0.0 View file →
@@ -6,15 +6,10 @@
6 6 * class registers and all the components required to run the plugin.
7 7 *
8 8 * @package Templately
9 9 */
10 -
11 10 namespace Templately;
12 11
13 -use Templately\API\Conditions;
14 -use Templately\API\ThemeBuilderApi;
15 -use Templately\Builder\ThemeBuilder;
16 -use Templately\Core\Importer\FullSiteImport;
17 12 use Templately\Utils\Base;
18 13 use Templately\Utils\Enqueue;
19 14
20 15 use Templately\Core\Admin;
@@ -31,53 +26,42 @@
31 26 use Templately\API\Categories;
32 27 use Templately\API\Dependencies;
33 28 use Templately\API\TemplateTypes;
34 29 use Templately\API\SavedTemplates;
35 -use Templately\Core\Maintenance;
36 -use Templately\Core\Migrator;
30 +
37 31 use Templately\Core\Platform\Gutenberg;
38 32 use Templately\Core\Platform\Elementor;
39 33
40 34 final class Plugin extends Base {
41 - public $version = '3.1.10';
35 + public $version = '2.0.0';
42 36
43 37 public $admin;
44 - /**
45 - * Enqueue class responsible for assets
46 - * @var Enqueue
47 - */
48 - public $assets;
38 + /**
39 + * Enqueue class responsible for assets
40 + * @var Enqueue
41 + */
42 + public $assets;
43 + /**
44 + * Plugin constructor.
45 + * Initializing Templately plugin.
46 + *
47 + * @access private
48 + */
49 + public function __construct() {
50 + $this->define_constants();
51 + $this->set_locale();
49 52
50 - /**
51 - * @var ThemeBuilder
52 - */
53 - public $theme_builder;
53 + $this->assets = Enqueue::get_instance( TEMPLATELY_URL, TEMPLATELY_PATH, $this->version );
54 + $this->admin = Admin::get_instance();
54 55
55 - /**
56 - * Plugin constructor.
57 - * Initializing Templately plugin.
58 - *
59 - * @access private
60 - */
61 - public function __construct() {
62 - $this->define_constants();
63 - $this->set_locale();
64 -
65 - Maintenance::init();
66 -
67 - $this->assets = Enqueue::get_instance( TEMPLATELY_URL, TEMPLATELY_PATH, $this->version );
68 - $this->admin = Admin::get_instance();
69 - $this->theme_builder = ThemeBuilder::get_instance();
70 -
71 - add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ] );
72 - add_action( 'rest_api_init', [ $this, 'register_routes' ] );
56 + add_action( 'plugins_loaded', [$this, 'plugins_loaded'] );
57 + add_action( 'rest_api_init', [$this, 'register_routes'] );
73 58 /**
74 59 * Initialize.
75 60 */
76 - do_action( 'templately_init' );
61 + do_action( 'templately_init' );
62 + }
77 63
78 - }
79 -
80 64 /**
81 65 * Cloning is forbidden.
82 66 *
83 67 * @since 2.0
@@ -86,14 +70,14 @@
86 70 _doing_it_wrong( __FUNCTION__, __( 'Cloning is forbidden.', 'templately' ), '2.0' );
87 71 }
88 72
89 73 /**
90 - * Un-serializing instances of this class is forbidden.
74 + * Unserializing instances of this class is forbidden.
91 75 *
92 76 * @since 2.0
93 77 */
94 78 public function __wakeup() {
95 - _doing_it_wrong( __FUNCTION__, __( 'Un-serializing instances of this class is forbidden.', 'templately' ), '2.0' );
79 + _doing_it_wrong( __FUNCTION__, __( 'Unserializing instances of this class is forbidden.', 'templately' ), '2.0' );
96 80 }
97 81
98 82 /**
99 83 * Initializing Things on Plugins Loaded
@@ -98,21 +82,11 @@
98 82 /**
99 83 * Initializing Things on Plugins Loaded
100 84 * @return void
101 85 */
102 - public function plugins_loaded() {
86 + public function plugins_loaded(){
103 87 $this->platforms(); // PLATFORMS LOADED
104 88 $this->apis(); // APIs LOADED
105 -
106 - /**
107 - * Migrator for Templately
108 - */
109 - Migrator::get_instance();
110 -
111 - /**
112 - * Full Site Import
113 - */
114 - FullSiteImport::get_instance();
115 89 }
116 90
117 91 /**
118 92 * Initialize all platforms
@@ -117,12 +91,12 @@
117 91 /**
118 92 * Initialize all platforms
119 93 * @return void
120 94 */
121 - public function platforms() {
122 - Gutenberg::get_instance();
123 - Elementor::get_instance();
124 - }
95 + public function platforms(){
96 + Gutenberg::get_instance();
97 + Elementor::get_instance();
98 + }
125 99
126 100 /**
127 101 * All the API instantiated
128 102 *
@@ -127,25 +101,23 @@
127 101 * All the API instantiated
128 102 *
129 103 * @return void
130 104 */
131 - private function apis() {
132 - Conditions::get_instance();
105 + private function apis(){
133 106 Categories::get_instance();
134 - TemplateTypes::get_instance();
135 - Dependencies::get_instance();
136 - Tags::get_instance();
137 - ThemeBuilderApi::get_instance();
107 + TemplateTypes::get_instance();
108 + Dependencies::get_instance();
109 + Tags::get_instance();
138 110
139 - Items::get_instance();
140 - SavedTemplates::get_instance();
111 + Items::get_instance();
112 + SavedTemplates::get_instance();
141 113
142 - Login::get_instance();
143 - SignUp::get_instance();
144 - Import::get_instance();
145 - Profile::get_instance();
146 - MyClouds::get_instance();
147 - WorkSpaces::get_instance();
114 + Login::get_instance();
115 + SignUp::get_instance();
116 + Import::get_instance();
117 + Profile::get_instance();
118 + MyClouds::get_instance();
119 + WorkSpaces::get_instance();
148 120 }
149 121
150 122 /**
151 123 * Register all REST API endpoints
@@ -150,40 +122,39 @@
150 122 /**
151 123 * Register all REST API endpoints
152 124 * @return void
153 125 */
154 - public function register_routes() {
155 - if ( ! empty( $modules = Module::get_instance()->get( 'API' ) ) ) {
156 - foreach ( $modules as $module ) {
126 + public function register_routes(){
127 + if( ! empty( $modules = Module::get_instance()->get( 'API' ) ) ) {
128 + foreach( $modules as $module ) {
157 129 $module->object->register_routes();
158 130 }
159 131 }
160 - }
132 + }
161 133
162 134 /**
163 135 * Define CONSTANTS
164 136 *
137 + * @since 2.0.0
165 138 * @return void
166 - * @since 2.0.0
167 139 */
168 - public function define_constants() {
169 - $this->define( 'TEMPLATELY_URL', plugin_dir_url( TEMPLATELY_FILE ) );
170 - $this->define( 'TEMPLATELY_ASSETS', TEMPLATELY_URL . 'assets/' );
140 + public function define_constants() {
141 + $this->define( 'TEMPLATELY_URL', plugin_dir_url( TEMPLATELY_FILE ) );
142 + $this->define( 'TEMPLATELY_ASSETS', TEMPLATELY_URL . 'assets/' );
171 143 $this->define( 'TEMPLATELY_PLUGIN_BASENAME', plugin_basename( TEMPLATELY_FILE ) );
172 144 $this->define( 'TEMPLATELY_VERSION', $this->version );
173 - $this->define( 'TEMPLATELY_API_NAMESPACE', 'templately/v1' );
174 - $this->define( 'TEMPLATELY_VIEWS_ABSPATH', TEMPLATELY_PATH . 'views/' );
175 - }
145 + $this->define( 'TEMPLATELY_API_NAMESPACE', 'templately/v1' );
146 + }
176 147
177 148 /**
178 149 * Define constant if not already set.
179 150 *
180 - * @param string $name Constant name.
151 + * @param string $name Constant name.
181 152 * @param mixed $value Constant value.
182 153 *
183 154 * @return void
184 155 */
185 - private function define( string $name, $value ) {
156 + private function define( $name, $value ) {
186 157 if ( ! defined( $name ) ) {
187 158 define( $name, $value );
188 159 }
189 160 }
@@ -189,21 +160,21 @@
189 160 }
190 161
191 162 /**
192 163 * Setting the locale for translation availability
164 + * @since 1.0.0
193 165 * @return void
194 - * @since 1.0.0
195 166 */
196 - public function set_locale() {
167 + public function set_locale(){
197 168 add_action( 'init', [ $this, 'load_textdomain' ] );
198 169 }
199 170
200 171 /**
201 172 * Loading Text Domain on init HOOK
202 - * @return void
203 173 * @since 1.0.0
204 174 *
175 + * @return void
205 176 */
206 - public function load_textdomain() {
177 + public function load_textdomain(){
207 178 load_plugin_textdomain( 'templately', false, dirname( TEMPLATELY_PLUGIN_BASENAME ) . '/languages' );
208 179 }
209 180 }