PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.3.0
ShopBuilder – WooCommerce Builder For Elementor v3.3.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 +25 -26 3.4.23.3.0 View file →
@@ -24,9 +24,8 @@
24 24 use RadiusTheme\SB\Controllers\Hooks\FilterHooks;
25 25 use RadiusTheme\SB\Controllers\Hooks\ActionHooks;
26 26 use RadiusTheme\SB\Controllers\Frontend\Ajax\AddToCart;
27 27 use RadiusTheme\SB\Controllers\Frontend\Ajax\AjaxLogin;
28 -use RadiusTheme\SB\Controllers\Frontend\OrderReviewQuantity;
29 28 use RadiusTheme\SB\Controllers\Frontend\Ajax\UpdateCheckoutSection;
30 29
31 30 // Do not allow directly accessing this file.
32 31 if ( ! defined( 'ABSPATH' ) ) {
@@ -81,19 +80,14 @@
81 80 /**
82 81 * Class Constructor
83 82 */
84 83 private function __construct() {
84 + $this->define_constants();
85 85 $this->post_type = 'product';
86 86 $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 87 add_action( 'plugins_loaded', [ $this, 'init' ], 15 );
88 88 add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 );
89 89
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 90 // Register Plugin Active Hook.
97 91 register_activation_hook( RTSB_FILE, [ Installation::class, 'activate' ] );
98 92
99 93 // Register Plugin Deactivate Hook.
@@ -113,8 +107,24 @@
113 107 );
114 108 }
115 109
116 110 /**
111 + * Constants
112 + *
113 + * @return void
114 + */
115 + private function define_constants() {
116 + if ( ! defined( 'RTSB_ABSPATH' ) ) {
117 + define( 'RTSB_ABSPATH', dirname( RTSB_FILE ) . '/' );
118 + }
119 +
120 + if ( ! defined( 'RTSB_URL' ) ) {
121 + define( 'RTSB_URL', plugins_url( '', RTSB_FILE ) );
122 + }
123 + }
124 +
125 +
126 + /**
117 127 * Assets url generate with given assets file
118 128 *
119 129 * @param string $file File.
120 130 *
@@ -185,11 +195,8 @@
185 195 AddToCart::instance();
186 196 AjaxLogin::instance();
187 197 UpdateCheckoutSection::instance();
188 198
189 - // Checkout.
190 - OrderReviewQuantity::instance();
191 -
192 199 BuilderController::instance();
193 200 FilterHooks::init_hooks();
194 201 ActionHooks::init_hooks();
195 202
@@ -221,31 +228,23 @@
221 228 if ( 'plugin' !== $options['type'] || ! in_array( $options['action'], [ 'install', 'update' ], true ) ) {
222 229 return;
223 230 }
224 231
225 - $basename = plugin_basename( RTSB_FILE );
226 - $slug = dirname( $basename );
227 -
228 - // Bulk update flow: WordPress passes every plugin in the batch.
232 + // For normal update flow.
229 233 if ( ! empty( $options['plugins'] ) ) {
230 - if ( in_array( $basename, (array) $options['plugins'], true ) ) {
231 - Cache::clear_all_cache();
234 + foreach ( $options['plugins'] as $plugin ) {
235 + if ( strpos( $plugin, 'shopbuilder' ) !== false ) {
236 + Cache::clear_all_cache();
237 + break;
238 + }
232 239 }
233 240 return;
234 241 }
235 242
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.
243 + // For upload-based installation.
245 244 if (
246 245 ! empty( $upgrader_object->result['destination_name'] ) &&
247 - $slug === $upgrader_object->result['destination_name']
246 + strpos( $upgrader_object->result['destination_name'], 'shopbuilder' ) !== false
248 247 ) {
249 248 Cache::clear_all_cache();
250 249 }
251 250 }