| @@ -16,9 +16,8 @@ | ||
| 16 | 16 | use RadiusTheme\SB\Controllers\Shortcodes; |
| 17 | 17 | use RadiusTheme\SB\Controllers\Dependencies; |
| 18 | 18 | use RadiusTheme\SB\Controllers\CacheController; |
| 19 | 19 | use RadiusTheme\SB\Controllers\Admin\AdminInit; |
| 20 | -use RadiusTheme\SB\Controllers\Admin\PluginRow; | |
| 21 | 20 | use RadiusTheme\SB\Controllers\AssetsController; |
| 22 | 21 | use RadiusTheme\SB\Controllers\BuilderController; |
| 23 | 22 | use RadiusTheme\SB\Controllers\SupportController; |
| 24 | 23 | use RadiusTheme\SB\Controllers\Hooks\FilterHooks; |
| @@ -80,8 +79,9 @@ | ||
| 80 | 79 | /** |
| 81 | 80 | * Class Constructor |
| 82 | 81 | */ |
| 83 | 82 | private function __construct() { |
| 83 | + $this->define_constants(); | |
| 84 | 84 | $this->post_type = 'product'; |
| 85 | 85 | $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 | 86 | add_action( 'plugins_loaded', [ $this, 'init' ], 15 ); |
| 87 | 87 | add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 ); |
| @@ -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,38 @@ | ||
| 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(); | |
| 196 | + AIinit::instance(); | |
| 189 | 197 | |
| 190 | - if ( is_admin() ) { | |
| 191 | - AdminInit::instance(); | |
| 192 | - } | |
| 198 | + if ( is_admin() ) { | |
| 199 | + AdminInit::instance(); | |
| 200 | + } | |
| 193 | 201 | |
| 194 | - Shortcodes::instance(); | |
| 202 | + Shortcodes::instance(); | |
| 195 | 203 | |
| 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 | - } | |
| 204 | + do_action( 'rtsb/after/loaded' ); | |
| 200 | 205 | } |
| 201 | 206 | |
| 202 | 207 | /** |
| 203 | 208 | * Maybe Run After Update |
| @@ -232,14 +237,14 @@ | ||
| 232 | 237 | } |
| 233 | 238 | } |
| 234 | 239 | |
| 235 | 240 | /** |
| 236 | - * Checks if Pro version installed. | |
| 241 | + * Checks if Pro version installed | |
| 237 | 242 | * |
| 238 | 243 | * @return boolean |
| 239 | 244 | */ |
| 240 | 245 | public function has_pro() { |
| 241 | - return function_exists( 'rtsbpro' ); // Fns::is_pro_authorized() will add in the future for checking pro Version Compatibility. | |
| 246 | + return function_exists( 'rtsbpro' ); | |
| 242 | 247 | } |
| 243 | 248 | |
| 244 | 249 | /** |
| 245 | 250 | * PRO Version URL. |