| @@ -6,9 +6,8 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace RadiusTheme\SB; |
| 9 | 9 | |
| 10 | -use RadiusTheme\SB\AI\AIinit; | |
| 11 | 10 | use RadiusTheme\SB\Helpers\Cache; |
| 12 | 11 | use RadiusTheme\SB\Helpers\Migration; |
| 13 | 12 | use RadiusTheme\SB\Helpers\Installation; |
| 14 | 13 | use RadiusTheme\SB\Modules\ModuleManager; |
| @@ -16,9 +15,8 @@ | ||
| 16 | 15 | use RadiusTheme\SB\Controllers\Shortcodes; |
| 17 | 16 | use RadiusTheme\SB\Controllers\Dependencies; |
| 18 | 17 | use RadiusTheme\SB\Controllers\CacheController; |
| 19 | 18 | use RadiusTheme\SB\Controllers\Admin\AdminInit; |
| 20 | -use RadiusTheme\SB\Controllers\Admin\PluginRow; | |
| 21 | 19 | use RadiusTheme\SB\Controllers\AssetsController; |
| 22 | 20 | use RadiusTheme\SB\Controllers\BuilderController; |
| 23 | 21 | use RadiusTheme\SB\Controllers\SupportController; |
| 24 | 22 | use RadiusTheme\SB\Controllers\Hooks\FilterHooks; |
| @@ -72,9 +70,9 @@ | ||
| 72 | 70 | * URL for fetch API |
| 73 | 71 | * |
| 74 | 72 | * @var string |
| 75 | 73 | */ |
| 76 | - public $BASE_API = 'https://shopbuilderwp.com/demo/wp-json/rtsb/v1/layouts/'; | |
| 74 | + public $BASE_API = 'https://shopbuilderwp.com/wp-json/rtsb/v1/layouts/'; | |
| 77 | 75 | |
| 78 | 76 | use SingletonTrait; |
| 79 | 77 | |
| 80 | 78 | /** |
| @@ -80,8 +78,9 @@ | ||
| 80 | 78 | /** |
| 81 | 79 | * Class Constructor |
| 82 | 80 | */ |
| 83 | 81 | private function __construct() { |
| 82 | + $this->define_constants(); | |
| 84 | 83 | $this->post_type = 'product'; |
| 85 | 84 | $this->current_theme = wp_get_theme()->get( 'Template' ) ? wp_get_theme()->get( 'Template' ) : ( wp_get_theme()->get( 'TextDomain' ) ? wp_get_theme()->get( 'TextDomain' ) : strtolower( str_replace( ' ', '', wp_get_theme()->get( 'Name' ) ) ) ); |
| 86 | 85 | add_action( 'plugins_loaded', [ $this, 'init' ], 15 ); |
| 87 | 86 | add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 ); |
| @@ -94,8 +93,9 @@ | ||
| 94 | 93 | |
| 95 | 94 | if ( Dependencies::instance()->check() ) { |
| 96 | 95 | SupportController::instance(); |
| 97 | 96 | } |
| 97 | + | |
| 98 | 98 | // HPOS Declare compatibility. |
| 99 | 99 | add_action( |
| 100 | 100 | 'before_woocommerce_init', |
| 101 | 101 | function () { |
| @@ -106,8 +106,24 @@ | ||
| 106 | 106 | ); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | + * Constants | |
| 111 | + * | |
| 112 | + * @return void | |
| 113 | + */ | |
| 114 | + private function define_constants() { | |
| 115 | + if ( ! defined( 'RTSB_ABSPATH' ) ) { | |
| 116 | + define( 'RTSB_ABSPATH', dirname( RTSB_FILE ) . '/' ); | |
| 117 | + } | |
| 118 | + | |
| 119 | + if ( ! defined( 'RTSB_URL' ) ) { | |
| 120 | + define( 'RTSB_URL', plugins_url( '', RTSB_FILE ) ); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + | |
| 124 | + | |
| 125 | + /** | |
| 110 | 126 | * Assets url generate with given assets file |
| 111 | 127 | * |
| 112 | 128 | * @param string $file File. |
| 113 | 129 | * |
| @@ -155,49 +171,37 @@ | ||
| 155 | 171 | * |
| 156 | 172 | * @return void |
| 157 | 173 | */ |
| 158 | 174 | public function init() { |
| 159 | - // Plugin row links (Settings/Demo/Documentation/Get Pro) must register | |
| 160 | - // regardless of dependency state so users can always reach Settings or | |
| 161 | - // docs even when WooCommerce/Elementor is inactive. | |
| 162 | - if ( is_admin() ) { | |
| 163 | - PluginRow::instance(); | |
| 164 | - } | |
| 165 | - | |
| 166 | 175 | if ( ! Dependencies::instance()->check() ) { |
| 167 | 176 | return; |
| 168 | 177 | } |
| 169 | 178 | |
| 170 | - try { | |
| 171 | - do_action( 'rtsb/before/loaded' ); | |
| 172 | - CacheController::instance(); | |
| 173 | - // Include File. | |
| 174 | - AssetsController::instance(); | |
| 175 | - ModuleManager::instance(); | |
| 179 | + do_action( 'rtsb/before/loaded' ); | |
| 180 | + CacheController::instance(); | |
| 181 | + // Include File. | |
| 182 | + AssetsController::instance(); | |
| 183 | + ModuleManager::instance(); | |
| 176 | 184 | |
| 177 | - // Ajax. | |
| 178 | - AddToCart::instance(); | |
| 179 | - AjaxLogin::instance(); | |
| 180 | - UpdateCheckoutSection::instance(); | |
| 185 | + // Ajax. | |
| 186 | + AddToCart::instance(); | |
| 187 | + AjaxLogin::instance(); | |
| 188 | + UpdateCheckoutSection::instance(); | |
| 181 | 189 | |
| 182 | - BuilderController::instance(); | |
| 183 | - FilterHooks::init_hooks(); | |
| 184 | - ActionHooks::init_hooks(); | |
| 190 | + BuilderController::instance(); | |
| 191 | + FilterHooks::init_hooks(); | |
| 192 | + ActionHooks::init_hooks(); | |
| 185 | 193 | |
| 186 | - Installation::init(); | |
| 187 | - Migration::init(); | |
| 188 | - AIinit::instance(); | |
| 194 | + Installation::init(); | |
| 195 | + Migration::init(); | |
| 189 | 196 | |
| 190 | - if ( is_admin() ) { | |
| 191 | - AdminInit::instance(); | |
| 192 | - } | |
| 197 | + if ( is_admin() ) { | |
| 198 | + AdminInit::instance(); | |
| 199 | + } | |
| 193 | 200 | |
| 194 | - Shortcodes::instance(); | |
| 201 | + Shortcodes::instance(); | |
| 195 | 202 | |
| 196 | - do_action( 'rtsb/after/loaded' ); | |
| 197 | - } catch ( \Throwable $e ) { | |
| 198 | - error_log( 'ShopBuilder init error: ' . $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log | |
| 199 | - } | |
| 203 | + do_action( 'rtsb/after/loaded' ); | |
| 200 | 204 | } |
| 201 | 205 | |
| 202 | 206 | /** |
| 203 | 207 | * Maybe Run After Update |
| @@ -232,14 +236,14 @@ | ||
| 232 | 236 | } |
| 233 | 237 | } |
| 234 | 238 | |
| 235 | 239 | /** |
| 236 | - * Checks if Pro version installed. | |
| 240 | + * Checks if Pro version installed | |
| 237 | 241 | * |
| 238 | 242 | * @return boolean |
| 239 | 243 | */ |
| 240 | 244 | public function has_pro() { |
| 241 | - return function_exists( 'rtsbpro' ); // Fns::is_pro_authorized() will add in the future for checking pro Version Compatibility. | |
| 245 | + return function_exists( 'rtsbpro' ); | |
| 242 | 246 | } |
| 243 | 247 | |
| 244 | 248 | /** |
| 245 | 249 | * PRO Version URL. |