PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.0
ShopBuilder – WooCommerce Builder For Elementor v2.6.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 +44 -80 3.4.02.6.0 View file →
@@ -6,10 +6,8 @@
6 6 */
7 7
8 8 namespace RadiusTheme\SB;
9 9
10 -use RadiusTheme\SB\AI\AIinit;
11 -use RadiusTheme\SB\Helpers\Cache;
12 10 use RadiusTheme\SB\Helpers\Migration;
13 11 use RadiusTheme\SB\Helpers\Installation;
14 12 use RadiusTheme\SB\Modules\ModuleManager;
15 13 use RadiusTheme\SB\Traits\SingletonTrait;
@@ -16,9 +14,8 @@
16 14 use RadiusTheme\SB\Controllers\Shortcodes;
17 15 use RadiusTheme\SB\Controllers\Dependencies;
18 16 use RadiusTheme\SB\Controllers\CacheController;
19 17 use RadiusTheme\SB\Controllers\Admin\AdminInit;
20 -use RadiusTheme\SB\Controllers\Admin\PluginRow;
21 18 use RadiusTheme\SB\Controllers\AssetsController;
22 19 use RadiusTheme\SB\Controllers\BuilderController;
23 20 use RadiusTheme\SB\Controllers\SupportController;
24 21 use RadiusTheme\SB\Controllers\Hooks\FilterHooks;
@@ -72,9 +69,9 @@
72 69 * URL for fetch API
73 70 *
74 71 * @var string
75 72 */
76 - public $BASE_API = 'https://shopbuilderwp.com/demo/wp-json/rtsb/v1/layouts/';
73 + public $BASE_API = 'https://shopbuilderwp.com/wp-json/rtsb/v1/layouts/';
77 74
78 75 use SingletonTrait;
79 76
80 77 /**
@@ -80,12 +77,13 @@
80 77 /**
81 78 * Class Constructor
82 79 */
83 80 private function __construct() {
81 + $this->define_constants();
84 82 $this->post_type = 'product';
85 83 $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 + add_action( 'init', [ $this, 'language' ] );
86 85 add_action( 'plugins_loaded', [ $this, 'init' ], 15 );
87 - add_action( 'upgrader_process_complete', [ $this, 'maybe_run_after_update' ], 10, 2 );
88 86
89 87 // Register Plugin Active Hook.
90 88 register_activation_hook( RTSB_FILE, [ Installation::class, 'activate' ] );
91 89
@@ -94,8 +92,9 @@
94 92
95 93 if ( Dependencies::instance()->check() ) {
96 94 SupportController::instance();
97 95 }
96 +
98 97 // HPOS Declare compatibility.
99 98 add_action(
100 99 'before_woocommerce_init',
101 100 function () {
@@ -106,31 +105,34 @@
106 105 );
107 106 }
108 107
109 108 /**
110 - * Assets url generate with given assets file
109 + * Constants
111 110 *
112 - * @param string $file File.
113 - *
114 - * @return string
111 + * @return void
115 112 */
116 - public function get_assets_uri( $file ) {
117 - $file = ltrim( $file, '/' );
113 + private function define_constants() {
114 + if ( ! defined( 'RTSB_ABSPATH' ) ) {
115 + define( 'RTSB_ABSPATH', dirname( RTSB_FILE ) . '/' );
116 + }
118 117
119 - return trailingslashit( RTSB_URL . '/assets' ) . $file;
118 + if ( ! defined( 'RTSB_URL' ) ) {
119 + define( 'RTSB_URL', plugins_url( '', RTSB_FILE ) );
120 + }
120 121 }
121 122
123 +
122 124 /**
123 - * Assets path.
125 + * Assets url generate with given assets file
124 126 *
125 127 * @param string $file File.
126 128 *
127 129 * @return string
128 130 */
129 - public function get_assets_path( $file ) {
131 + public function get_assets_uri( $file ) {
130 132 $file = ltrim( $file, '/' );
131 133
132 - return trailingslashit( RTSB_PATH . 'assets' ) . $file;
134 + return trailingslashit( RTSB_URL . '/assets' ) . $file;
133 135 }
134 136
135 137 /**
136 138 * Get the template path.
@@ -150,96 +152,58 @@
150 152 return untrailingslashit( plugin_dir_path( RTSB_FILE ) );
151 153 }
152 154
153 155 /**
156 + * Load Text Domain
157 + */
158 + public function language() {
159 + load_plugin_textdomain( 'shopbuilder', false, dirname( plugin_basename( RTSB_FILE ) ) . '/languages/' );
160 + }
161 +
162 + /**
154 163 * Init
155 164 *
156 165 * @return void
157 166 */
158 167 public function init() {
159 - // Plugin row links (Settings/Demo/Documentation/Get Pro) must register
160 - // regardless of dependency state so users can always reach Settings or
161 - // docs even when WooCommerce/Elementor is inactive.
162 - if ( is_admin() ) {
163 - PluginRow::instance();
164 - }
165 -
166 168 if ( ! Dependencies::instance()->check() ) {
167 169 return;
168 170 }
169 171
170 - try {
171 - do_action( 'rtsb/before/loaded' );
172 - CacheController::instance();
173 - // Include File.
174 - AssetsController::instance();
175 - ModuleManager::instance();
172 + do_action( 'rtsb/before/loaded' );
173 + CacheController::instance();
174 + // Include File.
175 + AssetsController::instance();
176 + ModuleManager::instance();
176 177
177 - // Ajax.
178 - AddToCart::instance();
179 - AjaxLogin::instance();
180 - UpdateCheckoutSection::instance();
178 + // Ajax.
179 + AddToCart::instance();
180 + AjaxLogin::instance();
181 + UpdateCheckoutSection::instance();
181 182
182 - BuilderController::instance();
183 - FilterHooks::init_hooks();
184 - ActionHooks::init_hooks();
183 + BuilderController::instance();
184 + FilterHooks::init_hooks();
185 + ActionHooks::init_hooks();
185 186
186 - Installation::init();
187 - Migration::init();
188 - AIinit::instance();
187 + Installation::init();
188 + Migration::init();
189 189
190 - if ( is_admin() ) {
191 - AdminInit::instance();
192 - }
193 -
194 - Shortcodes::instance();
195 -
196 - do_action( 'rtsb/after/loaded' );
197 - } catch ( \Throwable $e ) {
198 - error_log( 'ShopBuilder init error: ' . $e->getMessage() ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
190 + if ( is_admin() ) {
191 + AdminInit::instance();
199 192 }
200 - }
201 193
202 - /**
203 - * Maybe Run After Update
204 - *
205 - * @param object $upgrader_object Upgrader Object.
206 - * @param array $options Options.
207 - *
208 - * @return void
209 - */
210 - public function maybe_run_after_update( $upgrader_object, $options ) {
211 - if ( 'plugin' !== $options['type'] || ! in_array( $options['action'], [ 'install', 'update' ], true ) ) {
212 - return;
213 - }
194 + Shortcodes::instance();
214 195
215 - // For normal update flow.
216 - if ( ! empty( $options['plugins'] ) ) {
217 - foreach ( $options['plugins'] as $plugin ) {
218 - if ( strpos( $plugin, 'shopbuilder' ) !== false ) {
219 - Cache::clear_all_cache();
220 - break;
221 - }
222 - }
223 - return;
224 - }
225 -
226 - // For upload-based installation.
227 - if (
228 - ! empty( $upgrader_object->result['destination_name'] ) &&
229 - strpos( $upgrader_object->result['destination_name'], 'shopbuilder' ) !== false
230 - ) {
231 - Cache::clear_all_cache();
232 - }
196 + do_action( 'rtsb/after/loaded' );
233 197 }
234 198
235 199 /**
236 - * Checks if Pro version installed.
200 + * Checks if Pro version installed
237 201 *
238 202 * @return boolean
239 203 */
240 204 public function has_pro() {
241 - return function_exists( 'rtsbpro' ); // Fns::is_pro_authorized() will add in the future for checking pro Version Compatibility.
205 + return function_exists( 'rtsbpro' );
242 206 }
243 207
244 208 /**
245 209 * PRO Version URL.