PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.4.0
ShopBuilder – WooCommerce Builder For Elementor v2.4.0
3.4.2 3.4.1 3.4.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 All 63 releases
← All changes | app/ShopBuilder.php +47 -86 3.4.12.4.0 View file →
@@ -6,10 +6,9 @@
6 6 */
7 7
8 8 namespace RadiusTheme\SB;
9 9
10 -use RadiusTheme\SB\AI\AIinit;
11 -use RadiusTheme\SB\Helpers\Cache;
10 +use RadiusTheme\SB\Controllers\CacheController;
12 11 use RadiusTheme\SB\Helpers\Migration;
13 12 use RadiusTheme\SB\Helpers\Installation;
14 13 use RadiusTheme\SB\Modules\ModuleManager;
15 14 use RadiusTheme\SB\Traits\SingletonTrait;
@@ -14,11 +13,9 @@
14 13 use RadiusTheme\SB\Modules\ModuleManager;
15 14 use RadiusTheme\SB\Traits\SingletonTrait;
16 15 use RadiusTheme\SB\Controllers\Shortcodes;
17 16 use RadiusTheme\SB\Controllers\Dependencies;
18 -use RadiusTheme\SB\Controllers\CacheController;
19 17 use RadiusTheme\SB\Controllers\Admin\AdminInit;
20 -use RadiusTheme\SB\Controllers\Admin\PluginRow;
21 18 use RadiusTheme\SB\Controllers\AssetsController;
22 19 use RadiusTheme\SB\Controllers\BuilderController;
23 20 use RadiusTheme\SB\Controllers\SupportController;
24 21 use RadiusTheme\SB\Controllers\Hooks\FilterHooks;
@@ -24,9 +21,8 @@
24 21 use RadiusTheme\SB\Controllers\Hooks\FilterHooks;
25 22 use RadiusTheme\SB\Controllers\Hooks\ActionHooks;
26 23 use RadiusTheme\SB\Controllers\Frontend\Ajax\AddToCart;
27 24 use RadiusTheme\SB\Controllers\Frontend\Ajax\AjaxLogin;
28 -use RadiusTheme\SB\Controllers\Frontend\Ajax\UpdateCheckoutSection;
29 25
30 26 // Do not allow directly accessing this file.
31 27 if ( ! defined( 'ABSPATH' ) ) {
32 28 exit( 'This script cannot be accessed directly.' );
@@ -72,9 +68,9 @@
72 68 * URL for fetch API
73 69 *
74 70 * @var string
75 71 */
76 - public $BASE_API = 'https://shopbuilderwp.com/demo/wp-json/rtsb/v1/layouts/';
72 + public $BASE_API = 'https://shopbuilderwp.com/wp-json/rtsb/v1/layouts/';
77 73
78 74 use SingletonTrait;
79 75
80 76 /**
@@ -80,12 +76,13 @@
80 76 /**
81 77 * Class Constructor
82 78 */
83 79 private function __construct() {
80 + $this->define_constants();
84 81 $this->post_type = 'product';
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' ) ) ) );
82 + $this->current_theme = wp_get_theme()->get( 'Template' ) ? wp_get_theme()->get( 'Template' ) : wp_get_theme()->get( 'TextDomain' );
83 + add_action( 'init', [ $this, 'language' ] );
86 84 add_action( 'plugins_loaded', [ $this, 'init' ], 15 );
87 - add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 );
88 85
89 86 // Register Plugin Active Hook.
90 87 register_activation_hook( RTSB_FILE, [ Installation::class, 'activate' ] );
91 88
@@ -91,11 +88,10 @@
91 88
92 89 // Register Plugin Deactivate Hook.
93 90 register_deactivation_hook( RTSB_FILE, [ Installation::class, 'deactivation' ] );
94 91
95 - if ( Dependencies::instance()->check() ) {
96 - SupportController::instance();
97 - }
92 + SupportController::instance();
93 +
98 94 // HPOS Declare compatibility.
99 95 add_action(
100 96 'before_woocommerce_init',
101 97 function () {
@@ -106,31 +102,34 @@
106 102 );
107 103 }
108 104
109 105 /**
110 - * Assets url generate with given assets file
106 + * Constants
111 107 *
112 - * @param string $file File.
113 - *
114 - * @return string
108 + * @return void
115 109 */
116 - public function get_assets_uri( $file ) {
117 - $file = ltrim( $file, '/' );
110 + private function define_constants() {
111 + if ( ! defined( 'RTSB_ABSPATH' ) ) {
112 + define( 'RTSB_ABSPATH', dirname( RTSB_FILE ) . '/' );
113 + }
118 114
119 - return trailingslashit( RTSB_URL . '/assets' ) . $file;
115 + if ( ! defined( 'RTSB_URL' ) ) {
116 + define( 'RTSB_URL', plugins_url( '', RTSB_FILE ) );
117 + }
120 118 }
121 119
120 +
122 121 /**
123 - * Assets path.
122 + * Assets url generate with given assets file
124 123 *
125 124 * @param string $file File.
126 125 *
127 126 * @return string
128 127 */
129 - public function get_assets_path( $file ) {
128 + public function get_assets_uri( $file ) {
130 129 $file = ltrim( $file, '/' );
131 130
132 - return trailingslashit( RTSB_PATH . 'assets' ) . $file;
131 + return trailingslashit( RTSB_URL . '/assets' ) . $file;
133 132 }
134 133
135 134 /**
136 135 * Get the template path.
@@ -150,96 +149,57 @@
150 149 return untrailingslashit( plugin_dir_path( RTSB_FILE ) );
151 150 }
152 151
153 152 /**
153 + * Load Text Domain
154 + */
155 + public function language() {
156 + load_plugin_textdomain( 'shopbuilder', false, dirname( plugin_basename( RTSB_FILE ) ) . '/languages/' );
157 + }
158 +
159 + /**
154 160 * Init
155 161 *
156 162 * @return void
157 163 */
158 164 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 165 if ( ! Dependencies::instance()->check() ) {
167 166 return;
168 167 }
169 168
170 - try {
171 - do_action( 'rtsb/before/loaded' );
172 - CacheController::instance();
173 - // Include File.
174 - AssetsController::instance();
175 - ModuleManager::instance();
169 + do_action( 'rtsb/before/loaded' );
170 + CacheController::instance();
171 + // Include File.
172 + AssetsController::instance();
173 + ModuleManager::instance();
176 174
177 - // Ajax.
178 - AddToCart::instance();
179 - AjaxLogin::instance();
180 - UpdateCheckoutSection::instance();
175 + // Ajax.
176 + AddToCart::instance();
177 + AjaxLogin::instance();
181 178
182 - BuilderController::instance();
183 - FilterHooks::init_hooks();
184 - ActionHooks::init_hooks();
179 + BuilderController::instance();
180 + FilterHooks::init_hooks();
181 + ActionHooks::init_hooks();
185 182
186 - Installation::init();
187 - Migration::init();
188 - AIinit::instance();
183 + Installation::init();
184 + Migration::init();
189 185
190 - if ( is_admin() ) {
191 - AdminInit::instance();
192 - }
193 -
194 - Shortcodes::instance();
195 -
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
186 + if ( is_admin() ) {
187 + AdminInit::instance();
199 188 }
200 - }
201 189
202 - /**
203 - * Maybe Run After Update
204 - *
205 - * @param object $upgrader_object Upgrader Object.
206 - * @param array $options Options.
207 - *
208 - * @return void
209 - */
210 - public function maybe_run_after_update( $upgrader_object, $options ) {
211 - if ( 'plugin' !== $options['type'] || ! in_array( $options['action'], [ 'install', 'update' ], true ) ) {
212 - return;
213 - }
190 + Shortcodes::instance();
214 191
215 - // For normal update flow.
216 - if ( ! empty( $options['plugins'] ) ) {
217 - foreach ( $options['plugins'] as $plugin ) {
218 - if ( strpos( $plugin, 'shopbuilder' ) !== false ) {
219 - Cache::clear_all_cache();
220 - break;
221 - }
222 - }
223 - return;
224 - }
225 -
226 - // For upload-based installation.
227 - if (
228 - ! empty( $upgrader_object->result['destination_name'] ) &&
229 - strpos( $upgrader_object->result['destination_name'], 'shopbuilder' ) !== false
230 - ) {
231 - Cache::clear_all_cache();
232 - }
192 + do_action( 'rtsb/after/loaded' );
233 193 }
234 194
235 195 /**
236 - * Checks if Pro version installed.
196 + * Checks if Pro version installed
237 197 *
238 198 * @return boolean
239 199 */
240 200 public function has_pro() {
241 - return function_exists( 'rtsbpro' ); // Fns::is_pro_authorized() will add in the future for checking pro Version Compatibility.
201 + return function_exists( 'rtsbpro' );
242 202 }
243 203
244 204 /**
245 205 * PRO Version URL.
@@ -249,4 +209,5 @@
249 209 public function pro_version_link() {
250 210 return 'https://shopbuilderwp.com/';
251 211 }
252 212 }
213 +