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