| @@ -12,9 +12,8 @@ | ||
| 12 | 12 | |
| 13 | 13 | use Templately\Admin\API\Settings as APISettings; |
| 14 | 14 | use Templately\Admin\Settings; |
| 15 | 15 | use Templately\API\AIContent; |
| 16 | -use Templately\API\LogoGeneration; | |
| 17 | 16 | use Templately\API\Conditions; |
| 18 | 17 | use Templately\API\ThemeBuilderApi; |
| 19 | 18 | use Templately\Builder\ThemeBuilder; |
| 20 | 19 | use Templately\Core\Importer\FullSiteImport; |
| @@ -26,9 +25,8 @@ | ||
| 26 | 25 | |
| 27 | 26 | use Templately\API\Tags; |
| 28 | 27 | use Templately\API\Items; |
| 29 | 28 | use Templately\API\Login; |
| 30 | -use Templately\API\Checkout; | |
| 31 | 29 | use Templately\API\SignUp; |
| 32 | 30 | use Templately\API\Profile; |
| 33 | 31 | use Templately\API\Import; |
| 34 | 32 | use Templately\API\MyClouds; |
| @@ -36,10 +34,8 @@ | ||
| 36 | 34 | use Templately\API\Categories; |
| 37 | 35 | use Templately\API\Dependencies; |
| 38 | 36 | use Templately\API\TemplateTypes; |
| 39 | 37 | use Templately\API\SavedTemplates; |
| 40 | -use Templately\API\Sites; | |
| 41 | -use Templately\API\Tour; | |
| 42 | 38 | use Templately\Core\Maintenance; |
| 43 | 39 | use Templately\Core\Migrator; |
| 44 | 40 | use Templately\Core\Platform\Gutenberg; |
| 45 | 41 | use Templately\Core\Platform\Elementor; |
| @@ -44,9 +40,9 @@ | ||
| 44 | 40 | use Templately\Core\Platform\Gutenberg; |
| 45 | 41 | use Templately\Core\Platform\Elementor; |
| 46 | 42 | |
| 47 | 43 | final class Plugin extends Base { |
| 48 | - public $version = '3.6.8'; | |
| 44 | + public $version = '3.4.6'; | |
| 49 | 45 | |
| 50 | 46 | public $admin; |
| 51 | 47 | public $settings; |
| 52 | 48 | /** |
| @@ -86,11 +82,8 @@ | ||
| 86 | 82 | $this->init_developer_functionality(); |
| 87 | 83 | |
| 88 | 84 | add_action( 'plugins_loaded', [ $this, 'plugins_loaded' ] ); |
| 89 | 85 | add_action( 'rest_api_init', [ $this, 'register_routes' ] ); |
| 90 | - | |
| 91 | - add_action( 'init', [ $this, 'google_login_handler' ] ); | |
| 92 | - | |
| 93 | 86 | /** |
| 94 | 87 | * Initialize. |
| 95 | 88 | */ |
| 96 | 89 | do_action( 'templately_init' ); |
| @@ -186,21 +179,17 @@ | ||
| 186 | 179 | Tags::get_instance(); |
| 187 | 180 | ThemeBuilderApi::get_instance(); |
| 188 | 181 | |
| 189 | 182 | AIContent::get_instance(); |
| 190 | - LogoGeneration::get_instance(); | |
| 191 | 183 | Items::get_instance(); |
| 192 | 184 | SavedTemplates::get_instance(); |
| 193 | 185 | |
| 194 | 186 | Login::get_instance(); |
| 195 | - Checkout::get_instance(); | |
| 196 | 187 | SignUp::get_instance(); |
| 197 | 188 | Import::get_instance(); |
| 198 | 189 | Profile::get_instance(); |
| 199 | 190 | MyClouds::get_instance(); |
| 200 | 191 | WorkSpaces::get_instance(); |
| 201 | - Sites::get_instance(); | |
| 202 | - Tour::get_instance(); | |
| 203 | 192 | |
| 204 | 193 | APISettings::get_instance(); |
| 205 | 194 | // Note: DeveloperSettings::get_instance() is called in Developer::init_modules() when developer functionality is available and enabled |
| 206 | 195 | } |
| @@ -262,68 +251,6 @@ | ||
| 262 | 251 | * |
| 263 | 252 | */ |
| 264 | 253 | public function load_textdomain() { |
| 265 | 254 | 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 | 255 | } |
| 329 | 256 | } |