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 +56 -12 2.2.03.1.3 View file →
@@ -6,9 +6,9 @@
6 6 */
7 7
8 8 namespace RadiusTheme\SB;
9 9
10 -use RadiusTheme\SB\Controllers\CacheController;
10 +use RadiusTheme\SB\Helpers\Cache;
11 11 use RadiusTheme\SB\Helpers\Migration;
12 12 use RadiusTheme\SB\Helpers\Installation;
13 13 use RadiusTheme\SB\Modules\ModuleManager;
14 14 use RadiusTheme\SB\Traits\SingletonTrait;
@@ -13,8 +13,9 @@
13 13 use RadiusTheme\SB\Modules\ModuleManager;
14 14 use RadiusTheme\SB\Traits\SingletonTrait;
15 15 use RadiusTheme\SB\Controllers\Shortcodes;
16 16 use RadiusTheme\SB\Controllers\Dependencies;
17 +use RadiusTheme\SB\Controllers\CacheController;
17 18 use RadiusTheme\SB\Controllers\Admin\AdminInit;
18 19 use RadiusTheme\SB\Controllers\AssetsController;
19 20 use RadiusTheme\SB\Controllers\BuilderController;
20 21 use RadiusTheme\SB\Controllers\SupportController;
@@ -21,8 +22,9 @@
21 22 use RadiusTheme\SB\Controllers\Hooks\FilterHooks;
22 23 use RadiusTheme\SB\Controllers\Hooks\ActionHooks;
23 24 use RadiusTheme\SB\Controllers\Frontend\Ajax\AddToCart;
24 25 use RadiusTheme\SB\Controllers\Frontend\Ajax\AjaxLogin;
26 +use RadiusTheme\SB\Controllers\Frontend\Ajax\UpdateCheckoutSection;
25 27
26 28 // Do not allow directly accessing this file.
27 29 if ( ! defined( 'ABSPATH' ) ) {
28 30 exit( 'This script cannot be accessed directly.' );
@@ -68,9 +70,9 @@
68 70 * URL for fetch API
69 71 *
70 72 * @var string
71 73 */
72 - public $BASE_API = 'https://shopbuilderwp.com/wp-json/rtsb/v1/layouts/';
74 + public $BASE_API = 'https://shopbuilderwp.com/demo/wp-json/rtsb/v1/layouts/';
73 75
74 76 use SingletonTrait;
75 77
76 78 /**
@@ -78,11 +80,11 @@
78 80 */
79 81 private function __construct() {
80 82 $this->define_constants();
81 83 $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' ] );
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' ) ) ) );
84 85 add_action( 'plugins_loaded', [ $this, 'init' ], 15 );
86 + add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 );
85 87
86 88 // Register Plugin Active Hook.
87 89 register_activation_hook( RTSB_FILE, [ Installation::class, 'activate' ] );
88 90
@@ -88,9 +90,11 @@
88 90
89 91 // Register Plugin Deactivate Hook.
90 92 register_deactivation_hook( RTSB_FILE, [ Installation::class, 'deactivation' ] );
91 93
92 - SupportController::instance();
94 + if ( Dependencies::instance()->check() ) {
95 + SupportController::instance();
96 + }
93 97
94 98 // HPOS Declare compatibility.
95 99 add_action(
96 100 'before_woocommerce_init',
@@ -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();
@@ -189,8 +200,41 @@
189 200
190 201 Shortcodes::instance();
191 202
192 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 + }
193 237 }
194 238
195 239 /**
196 240 * Checks if Pro version installed