PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.5.2
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.5.2
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 +9 -30 3.6.33.5.2 View file →
@@ -36,9 +36,8 @@
36 36 use Templately\API\Dependencies;
37 37 use Templately\API\TemplateTypes;
38 38 use Templately\API\SavedTemplates;
39 39 use Templately\API\Sites;
40 -use Templately\API\Tour;
41 40 use Templately\Core\Maintenance;
42 41 use Templately\Core\Migrator;
43 42 use Templately\Core\Platform\Gutenberg;
44 43 use Templately\Core\Platform\Elementor;
@@ -43,9 +42,9 @@
43 42 use Templately\Core\Platform\Gutenberg;
44 43 use Templately\Core\Platform\Elementor;
45 44
46 45 final class Plugin extends Base {
47 - public $version = '3.6.3';
46 + public $version = '3.5.2';
48 47
49 48 public $admin;
50 49 public $settings;
51 50 /**
@@ -86,9 +85,10 @@
86 85
87 86 add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ] );
88 87 add_action( 'rest_api_init', [ $this, 'register_routes' ] );
89 88
90 - add_action( 'init', [ $this, 'google_login_handler' ] );
89 + add_action( 'wp_ajax_templately_google_login', [ $this, 'google_login_handler' ] );
90 + add_action( 'wp_ajax_nopriv_templately_google_login', [ $this, 'google_login_handler' ] );
91 91
92 92 /**
93 93 * Initialize.
94 94 */
@@ -196,9 +196,8 @@
196 196 Profile::get_instance();
197 197 MyClouds::get_instance();
198 198 WorkSpaces::get_instance();
199 199 Sites::get_instance();
200 - Tour::get_instance();
201 200
202 201 APISettings::get_instance();
203 202 // Note: DeveloperSettings::get_instance() is called in Developer::init_modules() when developer functionality is available and enabled
204 203 }
@@ -263,15 +262,10 @@
263 262 load_plugin_textdomain( 'templately', false, dirname( TEMPLATELY_PLUGIN_BASENAME ) . '/languages' );
264 263 }
265 264
266 265 public function google_login_handler() {
267 - // Stop if not a templately google login request
268 - if ( empty( $_GET['templately_google_login'] ) ) {
269 - return;
270 - }
266 + $redirect_url = admin_url( 'admin.php?page=templately' );
271 267
272 - $redirect_url = remove_query_arg( [ 'templately_google_login', 'api_key', 'error', 'state', 'redirect-to' ] );
273 -
274 268 if ( ! empty( $_GET['error'] ) ) {
275 269 $error_message = sanitize_text_field( $_GET['error'] );
276 270 } elseif ( ! empty( $_GET['api_key'] ) ) {
277 271 $request = new \WP_REST_Request( 'POST', '/templately/v1/login' );
@@ -285,27 +279,12 @@
285 279 $login->permission_check( $request );
286 280 $response = $login->login();
287 281
288 282 if ( ! is_wp_error( $response ) && ! empty( $response['user'] ) ) {
289 - $redirect_path = ! empty( $_GET['redirect-to'] ) ? sanitize_text_field( wp_unslash( $_GET['redirect-to'] ) ) : '';
283 + $redirect_path = ! empty( $_GET['redirect-to'] ) ? sanitize_text_field( $_GET['redirect-to'] ) : '';
284 +
290 285 if ( ! empty( $redirect_path ) ) {
291 - if ( filter_var( $redirect_path, FILTER_VALIDATE_URL ) ) {
292 - $redirect_url = $redirect_path;
293 - } else {
294 - $is_templately = strpos( $redirect_url, 'page=templately' ) !== false;
295 - $is_elementor = strpos( $redirect_url, 'action=elementor' ) !== false;
296 - // Gutenberg editor usually has action=edit or is a block editor page
297 - $is_gutenberg = ( strpos( $redirect_url, 'action=edit' ) !== false || strpos( $redirect_url, 'post_type=' ) !== false ) && ! $is_elementor;
298 -
299 - if ( $is_templately || $is_elementor || $is_gutenberg ) {
300 - $redirect_url = add_query_arg( 'path', ltrim( $redirect_path, '/' ), $redirect_url );
301 -
302 - // Always open the modal in editors after google login
303 - if ( $is_elementor || $is_gutenberg ) {
304 - $redirect_url = add_query_arg( 'templately_open_modal', '1', $redirect_url );
305 - }
306 - }
307 - }
286 + $redirect_url = add_query_arg( 'path', $redirect_path, $redirect_url );
308 287 }
309 288
310 289 wp_safe_redirect( $redirect_url );
311 290 exit;
@@ -316,10 +295,10 @@
316 295 $error_message = __( 'Missing API Key.', 'templately' );
317 296 }
318 297
319 298 $redirect_url = add_query_arg( [
320 - 'templately_error' => 'login_failed',
321 - 'error_message' => urlencode( $error_message ),
299 + 'path' => 'sign-in',
300 + 'error_message' => $error_message,
322 301 ], $redirect_url );
323 302
324 303 wp_safe_redirect( $redirect_url );
325 304 exit;