PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.2.6
ShopBuilder – WooCommerce Builder For Elementor v3.2.6
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 +45 -58 3.4.23.2.6 View file →
@@ -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;
@@ -24,9 +23,8 @@
24 23 use RadiusTheme\SB\Controllers\Hooks\FilterHooks;
25 24 use RadiusTheme\SB\Controllers\Hooks\ActionHooks;
26 25 use RadiusTheme\SB\Controllers\Frontend\Ajax\AddToCart;
27 26 use RadiusTheme\SB\Controllers\Frontend\Ajax\AjaxLogin;
28 -use RadiusTheme\SB\Controllers\Frontend\OrderReviewQuantity;
29 27 use RadiusTheme\SB\Controllers\Frontend\Ajax\UpdateCheckoutSection;
30 28
31 29 // Do not allow directly accessing this file.
32 30 if ( ! defined( 'ABSPATH' ) ) {
@@ -81,19 +79,14 @@
81 79 /**
82 80 * Class Constructor
83 81 */
84 82 private function __construct() {
83 + $this->define_constants();
85 84 $this->post_type = 'product';
86 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' ) ) ) );
87 86 add_action( 'plugins_loaded', [ $this, 'init' ], 15 );
88 87 add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 );
89 88
90 - // Runs before anything reads or writes the object cache: Installation is
91 - // on init:5 and ModuleManager on init:15. Registered here rather than in
92 - // init() so version tracking stays accurate even while a dependency is
93 - // missing and the rest of the plugin is dormant.
94 - add_action( 'init', [ Cache::class, 'maybe_rotate_group' ], 1 );
95 -
96 89 // Register Plugin Active Hook.
97 90 register_activation_hook( RTSB_FILE, [ Installation::class, 'activate' ] );
98 91
99 92 // Register Plugin Deactivate Hook.
@@ -113,8 +106,24 @@
113 106 );
114 107 }
115 108
116 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 + /**
117 126 * Assets url generate with given assets file
118 127 *
119 128 * @param string $file File.
120 129 *
@@ -162,52 +171,38 @@
162 171 *
163 172 * @return void
164 173 */
165 174 public function init() {
166 - // Plugin row links (Settings/Demo/Documentation/Get Pro) must register
167 - // regardless of dependency state so users can always reach Settings or
168 - // docs even when WooCommerce/Elementor is inactive.
169 - if ( is_admin() ) {
170 - PluginRow::instance();
171 - }
172 -
173 175 if ( ! Dependencies::instance()->check() ) {
174 176 return;
175 177 }
176 178
177 - try {
178 - do_action( 'rtsb/before/loaded' );
179 - CacheController::instance();
180 - // Include File.
181 - AssetsController::instance();
182 - ModuleManager::instance();
179 + do_action( 'rtsb/before/loaded' );
180 + CacheController::instance();
181 + // Include File.
182 + AssetsController::instance();
183 + ModuleManager::instance();
183 184
184 - // Ajax.
185 - AddToCart::instance();
186 - AjaxLogin::instance();
187 - UpdateCheckoutSection::instance();
185 + // Ajax.
186 + AddToCart::instance();
187 + AjaxLogin::instance();
188 + UpdateCheckoutSection::instance();
188 189
189 - // Checkout.
190 - OrderReviewQuantity::instance();
190 + BuilderController::instance();
191 + FilterHooks::init_hooks();
192 + ActionHooks::init_hooks();
191 193
192 - BuilderController::instance();
193 - FilterHooks::init_hooks();
194 - ActionHooks::init_hooks();
194 + Installation::init();
195 + Migration::init();
196 + AIinit::instance();
195 197
196 - Installation::init();
197 - Migration::init();
198 - AIinit::instance();
198 + if ( is_admin() ) {
199 + AdminInit::instance();
200 + }
199 201
200 - if ( is_admin() ) {
201 - AdminInit::instance();
202 - }
202 + Shortcodes::instance();
203 203
204 - Shortcodes::instance();
205 -
206 - do_action( 'rtsb/after/loaded' );
207 - } catch ( \Throwable $e ) {
208 - error_log( 'ShopBuilder init error: ' . $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
209 - }
204 + do_action( 'rtsb/after/loaded' );
210 205 }
211 206
212 207 /**
213 208 * Maybe Run After Update
@@ -221,31 +216,23 @@
221 216 if ( 'plugin' !== $options['type'] || ! in_array( $options['action'], [ 'install', 'update' ], true ) ) {
222 217 return;
223 218 }
224 219
225 - $basename = plugin_basename( RTSB_FILE );
226 - $slug = dirname( $basename );
227 -
228 - // Bulk update flow: WordPress passes every plugin in the batch.
220 + // For normal update flow.
229 221 if ( ! empty( $options['plugins'] ) ) {
230 - if ( in_array( $basename, (array) $options['plugins'], true ) ) {
231 - Cache::clear_all_cache();
222 + foreach ( $options['plugins'] as $plugin ) {
223 + if ( strpos( $plugin, 'shopbuilder' ) !== false ) {
224 + Cache::clear_all_cache();
225 + break;
226 + }
232 227 }
233 228 return;
234 229 }
235 230
236 - // Single update flow: WordPress passes the basename under `plugin`.
237 - if ( ! empty( $options['plugin'] ) ) {
238 - if ( $basename === $options['plugin'] ) {
239 - Cache::clear_all_cache();
240 - }
241 - return;
242 - }
243 -
244 - // Upload-based installation: only the destination folder name is known.
231 + // For upload-based installation.
245 232 if (
246 233 ! empty( $upgrader_object->result['destination_name'] ) &&
247 - $slug === $upgrader_object->result['destination_name']
234 + strpos( $upgrader_object->result['destination_name'], 'shopbuilder' ) !== false
248 235 ) {
249 236 Cache::clear_all_cache();
250 237 }
251 238 }