PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 3.1.3
ShopBuilder – WooCommerce Builder For Elementor v3.1.3
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 +57 -12 2.1.133.1.3 View file →
@@ -6,8 +6,9 @@
6 6 */
7 7
8 8 namespace RadiusTheme\SB;
9 9
10 +use RadiusTheme\SB\Helpers\Cache;
10 11 use RadiusTheme\SB\Helpers\Migration;
11 12 use RadiusTheme\SB\Helpers\Installation;
12 13 use RadiusTheme\SB\Modules\ModuleManager;
13 14 use RadiusTheme\SB\Traits\SingletonTrait;
@@ -12,8 +13,9 @@
12 13 use RadiusTheme\SB\Modules\ModuleManager;
13 14 use RadiusTheme\SB\Traits\SingletonTrait;
14 15 use RadiusTheme\SB\Controllers\Shortcodes;
15 16 use RadiusTheme\SB\Controllers\Dependencies;
17 +use RadiusTheme\SB\Controllers\CacheController;
16 18 use RadiusTheme\SB\Controllers\Admin\AdminInit;
17 19 use RadiusTheme\SB\Controllers\AssetsController;
18 20 use RadiusTheme\SB\Controllers\BuilderController;
19 21 use RadiusTheme\SB\Controllers\SupportController;
@@ -20,8 +22,9 @@
20 22 use RadiusTheme\SB\Controllers\Hooks\FilterHooks;
21 23 use RadiusTheme\SB\Controllers\Hooks\ActionHooks;
22 24 use RadiusTheme\SB\Controllers\Frontend\Ajax\AddToCart;
23 25 use RadiusTheme\SB\Controllers\Frontend\Ajax\AjaxLogin;
26 +use RadiusTheme\SB\Controllers\Frontend\Ajax\UpdateCheckoutSection;
24 27
25 28 // Do not allow directly accessing this file.
26 29 if ( ! defined( 'ABSPATH' ) ) {
27 30 exit( 'This script cannot be accessed directly.' );
@@ -67,9 +70,9 @@
67 70 * URL for fetch API
68 71 *
69 72 * @var string
70 73 */
71 - public $BASE_API = 'https://shopbuilderwp.com/wp-json/rtsb/v1/layouts/';
74 + public $BASE_API = 'https://shopbuilderwp.com/demo/wp-json/rtsb/v1/layouts/';
72 75
73 76 use SingletonTrait;
74 77
75 78 /**
@@ -77,11 +80,11 @@
77 80 */
78 81 private function __construct() {
79 82 $this->define_constants();
80 83 $this->post_type = 'product';
81 - $this->current_theme = wp_get_theme()->get( 'Template' ) ? wp_get_theme()->get( 'Template' ) : wp_get_theme()->get( 'TextDomain' );
82 - add_action( 'init', [ $this, 'language' ] );
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' ) ) ) );
83 85 add_action( 'plugins_loaded', [ $this, 'init' ], 15 );
86 + add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 );
84 87
85 88 // Register Plugin Active Hook.
86 89 register_activation_hook( RTSB_FILE, [ Installation::class, 'activate' ] );
87 90
@@ -87,9 +90,11 @@
87 90
88 91 // Register Plugin Deactivate Hook.
89 92 register_deactivation_hook( RTSB_FILE, [ Installation::class, 'deactivation' ] );
90 93
91 - SupportController::instance();
94 + if ( Dependencies::instance()->check() ) {
95 + SupportController::instance();
96 + }
92 97
93 98 // HPOS Declare compatibility.
94 99 add_action(
95 100 'before_woocommerce_init',
@@ -130,8 +135,21 @@
130 135 return trailingslashit( RTSB_URL . '/assets' ) . $file;
131 136 }
132 137
133 138 /**
139 + * Assets path.
140 + *
141 + * @param string $file File.
142 + *
143 + * @return string
144 + */
145 + public function get_assets_path( $file ) {
146 + $file = ltrim( $file, '/' );
147 +
148 + return trailingslashit( RTSB_PATH . 'assets' ) . $file;
149 + }
150 +
151 + /**
134 152 * Get the template path.
135 153 *
136 154 * @return string
137 155 */
@@ -148,15 +166,8 @@
148 166 return untrailingslashit( plugin_dir_path( RTSB_FILE ) );
149 167 }
150 168
151 169 /**
152 - * Load Text Domain
153 - */
154 - public function language() {
155 - load_plugin_textdomain( 'shopbuilder', false, dirname( plugin_basename( RTSB_FILE ) ) . '/languages/' );
156 - }
157 -
158 - /**
159 170 * Init
160 171 *
161 172 * @return void
162 173 */
@@ -165,9 +176,9 @@
165 176 return;
166 177 }
167 178
168 179 do_action( 'rtsb/before/loaded' );
169 -
180 + CacheController::instance();
170 181 // Include File.
171 182 AssetsController::instance();
172 183 ModuleManager::instance();
173 184
@@ -173,8 +184,9 @@
173 184
174 185 // Ajax.
175 186 AddToCart::instance();
176 187 AjaxLogin::instance();
188 + UpdateCheckoutSection::instance();
177 189
178 190 BuilderController::instance();
179 191 FilterHooks::init_hooks();
180 192 ActionHooks::init_hooks();
@@ -188,8 +200,41 @@
188 200
189 201 Shortcodes::instance();
190 202
191 203 do_action( 'rtsb/after/loaded' );
204 + }
205 +
206 + /**
207 + * Maybe Run After Update
208 + *
209 + * @param object $upgrader_object Upgrader Object.
210 + * @param array $options Options.
211 + *
212 + * @return void
213 + */
214 + public function maybe_run_after_update( $upgrader_object, $options ) {
215 + if ( 'plugin' !== $options['type'] || ! in_array( $options['action'], [ 'install', 'update' ], true ) ) {
216 + return;
217 + }
218 +
219 + // For normal update flow.
220 + if ( ! empty( $options['plugins'] ) ) {
221 + foreach ( $options['plugins'] as $plugin ) {
222 + if ( strpos( $plugin, 'shopbuilder' ) !== false ) {
223 + Cache::clear_all_cache();
224 + break;
225 + }
226 + }
227 + return;
228 + }
229 +
230 + // For upload-based installation.
231 + if (
232 + ! empty( $upgrader_object->result['destination_name'] ) &&
233 + strpos( $upgrader_object->result['destination_name'], 'shopbuilder' ) !== false
234 + ) {
235 + Cache::clear_all_cache();
236 + }
192 237 }
193 238
194 239 /**
195 240 * Checks if Pro version installed