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