PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.2.7
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.2.7
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 +1 -115 3.6.73.2.7 View file →
@@ -11,10 +11,8 @@
11 11 namespace Templately;
12 12
13 13 use Templately\Admin\API\Settings as APISettings;
14 14 use Templately\Admin\Settings;
15 -use Templately\API\AIContent;
16 -use Templately\API\LogoGeneration;
17 15 use Templately\API\Conditions;
18 16 use Templately\API\ThemeBuilderApi;
19 17 use Templately\Builder\ThemeBuilder;
20 18 use Templately\Core\Importer\FullSiteImport;
@@ -26,9 +24,8 @@
26 24
27 25 use Templately\API\Tags;
28 26 use Templately\API\Items;
29 27 use Templately\API\Login;
30 -use Templately\API\Checkout;
31 28 use Templately\API\SignUp;
32 29 use Templately\API\Profile;
33 30 use Templately\API\Import;
34 31 use Templately\API\MyClouds;
@@ -36,10 +33,8 @@
36 33 use Templately\API\Categories;
37 34 use Templately\API\Dependencies;
38 35 use Templately\API\TemplateTypes;
39 36 use Templately\API\SavedTemplates;
40 -use Templately\API\Sites;
41 -use Templately\API\Tour;
42 37 use Templately\Core\Maintenance;
43 38 use Templately\Core\Migrator;
44 39 use Templately\Core\Platform\Gutenberg;
45 40 use Templately\Core\Platform\Elementor;
@@ -44,9 +39,9 @@
44 39 use Templately\Core\Platform\Gutenberg;
45 40 use Templately\Core\Platform\Elementor;
46 41
47 42 final class Plugin extends Base {
48 - public $version = '3.6.7';
43 + public $version = '3.2.7';
49 44
50 45 public $admin;
51 46 public $settings;
52 47 /**
@@ -60,13 +55,8 @@
60 55 */
61 56 public $theme_builder;
62 57
63 58 /**
64 - * @var Developer
65 - */
66 - public $developer;
67 -
68 - /**
69 59 * Plugin constructor.
70 60 * Initializing Templately plugin.
71 61 *
72 62 * @access private
@@ -81,16 +71,10 @@
81 71 $this->admin = Admin::get_instance();
82 72 $this->settings = Settings::get_instance();
83 73 $this->theme_builder = ThemeBuilder::get_instance();
84 74
85 - // Initialize developer functionality if available
86 - $this->init_developer_functionality();
87 -
88 75 add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ] );
89 76 add_action( 'rest_api_init', [ $this, 'register_routes' ] );
90 -
91 - add_action( 'init', [ $this, 'google_login_handler' ] );
92 -
93 77 /**
94 78 * Initialize.
95 79 */
96 80 do_action( 'templately_init' );
@@ -134,38 +118,8 @@
134 118 FullSiteImport::get_instance();
135 119 }
136 120
137 121 /**
138 - * Initialize developer functionality if available
139 - *
140 - * This method safely loads developer functionality only if the developer
141 - * directory and class exist, preventing fatal errors in production builds.
142 - *
143 - * @return void
144 - */
145 - private function init_developer_functionality() {
146 - $developer_file = TEMPLATELY_PATH . 'includes/Core/Developer/Developer.php';
147 -
148 - // Check if developer file exists before attempting to load
149 - if ( file_exists( $developer_file ) ) {
150 - // Include the developer class file
151 - require_once $developer_file;
152 -
153 - // Check if the class exists after including the file
154 - if ( class_exists( '\\Templately\\Core\\Developer\\Developer' ) ) {
155 - $this->developer = \Templately\Core\Developer\Developer::get_instance();
156 - }
157 - }
158 -
159 - // If developer functionality is not available, set to null
160 - if ( ! isset( $this->developer ) ) {
161 - $this->developer = null;
162 - }
163 - }
164 -
165 -
166 -
167 - /**
168 122 * Initialize all platforms
169 123 * @return void
170 124 */
171 125 public function platforms() {
@@ -185,25 +139,19 @@
185 139 Dependencies::get_instance();
186 140 Tags::get_instance();
187 141 ThemeBuilderApi::get_instance();
188 142
189 - AIContent::get_instance();
190 - LogoGeneration::get_instance();
191 143 Items::get_instance();
192 144 SavedTemplates::get_instance();
193 145
194 146 Login::get_instance();
195 - Checkout::get_instance();
196 147 SignUp::get_instance();
197 148 Import::get_instance();
198 149 Profile::get_instance();
199 150 MyClouds::get_instance();
200 151 WorkSpaces::get_instance();
201 - Sites::get_instance();
202 - Tour::get_instance();
203 152
204 153 APISettings::get_instance();
205 - // Note: DeveloperSettings::get_instance() is called in Developer::init_modules() when developer functionality is available and enabled
206 154 }
207 155
208 156 /**
209 157 * Register all REST API endpoints
@@ -262,68 +210,6 @@
262 210 *
263 211 */
264 212 public function load_textdomain() {
265 213 load_plugin_textdomain( 'templately', false, dirname( TEMPLATELY_PLUGIN_BASENAME ) . '/languages' );
266 - }
267 -
268 - public function google_login_handler() {
269 - // Stop if not a templately google login request
270 - if ( empty( $_GET['templately_google_login'] ) ) {
271 - return;
272 - }
273 -
274 - $redirect_url = remove_query_arg( [ 'templately_google_login', 'api_key', 'error', 'state', 'redirect-to' ] );
275 -
276 - if ( ! empty( $_GET['error'] ) ) {
277 - $error_message = sanitize_text_field( $_GET['error'] );
278 - } elseif ( ! empty( $_GET['api_key'] ) ) {
279 - $request = new \WP_REST_Request( 'POST', '/templately/v1/login' );
280 - $request->set_param( 'viaAPI', true );
281 - $request->set_param( 'api_key', sanitize_text_field( $_GET['api_key'] ) );
282 -
283 - /**
284 - * @var Login $login
285 - */
286 - $login = Login::get_instance();
287 - $login->permission_check( $request );
288 - $response = $login->login();
289 -
290 - if ( ! is_wp_error( $response ) && ! empty( $response['user'] ) ) {
291 - $redirect_path = ! empty( $_GET['redirect-to'] ) ? sanitize_text_field( wp_unslash( $_GET['redirect-to'] ) ) : '';
292 - if ( ! empty( $redirect_path ) ) {
293 - if ( filter_var( $redirect_path, FILTER_VALIDATE_URL ) ) {
294 - $redirect_url = $redirect_path;
295 - } else {
296 - $is_templately = strpos( $redirect_url, 'page=templately' ) !== false;
297 - $is_elementor = strpos( $redirect_url, 'action=elementor' ) !== false;
298 - // Gutenberg editor usually has action=edit or is a block editor page
299 - $is_gutenberg = ( strpos( $redirect_url, 'action=edit' ) !== false || strpos( $redirect_url, 'post_type=' ) !== false ) && ! $is_elementor;
300 -
301 - if ( $is_templately || $is_elementor || $is_gutenberg ) {
302 - $redirect_url = add_query_arg( 'path', ltrim( $redirect_path, '/' ), $redirect_url );
303 -
304 - // Always open the modal in editors after google login
305 - if ( $is_elementor || $is_gutenberg ) {
306 - $redirect_url = add_query_arg( 'templately_open_modal', '1', $redirect_url );
307 - }
308 - }
309 - }
310 - }
311 -
312 - wp_safe_redirect( $redirect_url );
313 - exit;
314 - } else {
315 - $error_message = ( is_wp_error( $response ) ) ? $response->get_error_message() : __( 'Login failed.', 'templately' );
316 - }
317 - } else {
318 - $error_message = __( 'Missing API Key.', 'templately' );
319 - }
320 -
321 - $redirect_url = add_query_arg( [
322 - 'templately_error' => 'login_failed',
323 - 'error_message' => urlencode( $error_message ),
324 - ], $redirect_url );
325 -
326 - wp_safe_redirect( $redirect_url );
327 - exit;
328 214 }
329 215 }