Skip to content

Commit

Permalink
PLUGINS-6928
Browse files Browse the repository at this point in the history
  • Loading branch information
meteor-ec committed Aug 16, 2024
1 parent b6fe513 commit d15bce9
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
56 changes: 31 additions & 25 deletions includes/class-ecwid-config.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<?php

class Ecwid_Config {
const IS_WL = 'whitelabel_is_enabled';
const BRAND = 'whitelabel_brand';
const KB_URL = 'whitelabel_kb_url';
const CONTACT_US_URL = 'whitelabel_contact_us_url';
const REGISTRATION_URL = 'whitelabel_registration_url';
const CHANNEL_ID = 'whitelabel_channel_id';
const OAUTH_APPID = 'whitelabel_oauth_appid';
const OAUTH_APPSECRET = 'whitelabel_oauth_appsecret';
const OAUTH_TOKEN_URL = 'whitelabel_oauth_token_url';
const OAUTH_AUTH_URL = 'whitelabel_oauth_auth_url';
const TOKEN = 'config_token';
const STORE_ID = 'config_store_id';
const API_DOMAIN = 'config_api_domain';
const FRONTEND_DOMAIN = 'config_frontend_domain';
const CPANEL_DOMAIN = 'config_cpanel_domain';
const DEMO_STORE_ID = 'config_demo_store_id';
const IS_WL = 'whitelabel_is_enabled';
const BRAND = 'whitelabel_brand';
const KB_URL = 'whitelabel_kb_url';
const CONTACT_US_URL = 'whitelabel_contact_us_url';
const REGISTRATION_URL = 'whitelabel_registration_url';
const CHANNEL_ID = 'whitelabel_channel_id';
const OAUTH_APPID = 'whitelabel_oauth_appid';
const OAUTH_APPSECRET = 'whitelabel_oauth_appsecret';
const OAUTH_TOKEN_URL = 'whitelabel_oauth_token_url';
const OAUTH_AUTH_URL = 'whitelabel_oauth_auth_url';
const TOKEN = 'config_token';
const STORE_ID = 'config_store_id';
const API_DOMAIN = 'config_api_domain';
const STATIC_PAGES_API_DOMAIN = 'config_static_pages_api_domain';
const FRONTEND_DOMAIN = 'config_frontend_domain';
const CPANEL_DOMAIN = 'config_cpanel_domain';
const DEMO_STORE_ID = 'config_demo_store_id';

public static function is_wl() {
return EcwidPlatform::get( self::IS_WL, false );
Expand Down Expand Up @@ -86,6 +87,10 @@ public static function get_api_domain() {
return EcwidPlatform::get( self::API_DOMAIN, 'app.ecwid.com' );
}

public static function get_static_pages_api_domain() {
return EcwidPlatform::get( self::STATIC_PAGES_API_DOMAIN, 'storefront.ecwid.com' );
}

public static function get_scriptjs_domain() {
return EcwidPlatform::get( self::FRONTEND_DOMAIN, 'app.ecwid.com' );
}
Expand Down Expand Up @@ -171,15 +176,16 @@ protected static function _get_wl_config() {
*/
protected static function _get_common_config() {
$common_config = array(
self::OAUTH_APPID => 'oauth_appid',
self::OAUTH_APPSECRET => 'oauth_appsecret',
self::TOKEN => 'oauth_token',
self::STORE_ID => 'store_id',
self::CHANNEL_ID => 'channel_id',
self::API_DOMAIN => 'api_domain',
self::FRONTEND_DOMAIN => 'scriptjs_domain',
self::CPANEL_DOMAIN => 'cp_domain',
self::DEMO_STORE_ID => 'demo_store_id',
self::OAUTH_APPID => 'oauth_appid',
self::OAUTH_APPSECRET => 'oauth_appsecret',
self::TOKEN => 'oauth_token',
self::STORE_ID => 'store_id',
self::CHANNEL_ID => 'channel_id',
self::API_DOMAIN => 'api_domain',
self::STATIC_PAGES_API_DOMAIN => 'static_pages_api_domain',
self::FRONTEND_DOMAIN => 'scriptjs_domain',
self::CPANEL_DOMAIN => 'cp_domain',
self::DEMO_STORE_ID => 'demo_store_id',
);

return $common_config;
Expand Down
3 changes: 1 addition & 2 deletions includes/class-ecwid-static-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class Ecwid_Static_Page {
const OPTION_VALUE_AUTO = '';

const HANDLE_STATIC_PAGE = 'static-page';
const API_URL = 'https://storefront.ecwid.com/';

protected static $cache_key;

Expand Down Expand Up @@ -68,7 +67,7 @@ protected static function get_endpoint_url( $params = false ) {
$params['mode'] = 'home';
}

$url = self::API_URL;
$url = 'https://' . Ecwid_Config::get_static_pages_api_domain() . '/';
$url .= sprintf( '%s-page/', $params['mode'] );
$url .= sprintf( '%s/', get_ecwid_store_id() );

Expand Down

0 comments on commit d15bce9

Please sign in to comment.