PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.5.2
ShopBuilder – WooCommerce Builder For Elementor v2.5.2
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/Controllers/AssetsController.php +86 -30 2.0.22.5.2 View file →
@@ -86,9 +86,9 @@
86 86 *
87 87 * @return object
88 88 */
89 89 private function get_public_styles() {
90 - $rtl_suffix = is_rtl() ? '-rtl' : '';
90 + $rtl_suffix = is_rtl() ? '-rtl' : '';
91 91 $this->styles[] = [
92 92 'handle' => 'rtsb-fonts',
93 93 'src' => rtsb()->get_assets_uri( 'css/frontend/rtsb-fonts.css' ),
94 94 ];
@@ -104,12 +104,14 @@
104 104 'handle' => 'rtsb-frontend',
105 105 'src' => rtsb()->get_assets_uri( 'css/frontend/frontend' . $rtl_suffix . '.css' ),
106 106 ];
107 107
108 + /*
108 109 $this->styles[] = [
109 110 'handle' => 'swiper',
110 111 'src' => rtsb()->get_assets_uri( 'vendor/swiper/css/swiper-bundle.min.css' ),
111 112 ];
113 + */
112 114
113 115 if ( BuilderFns::is_builder_preview() && 'elementor' == Fns::page_edit_with( get_the_ID() ) ) {
114 116 $this->styles[] = [
115 117 'handle' => 'photoswipe',
@@ -136,11 +138,30 @@
136 138 *
137 139 * @return object
138 140 */
139 141 private function get_public_scripts() {
142 +
143 + $default_swiper_path = rtsb()->get_assets_uri( 'vendor/swiper/js/swiper-bundle.min.js' );
144 +
145 + if ( defined( 'ELEMENTOR_ASSETS_PATH' ) ) {
146 + $is_swiper8_enable = get_option( 'elementor_experiment-e_swiper_latest' );
147 +
148 + if ( 'active' === $is_swiper8_enable || 'default' === $is_swiper8_enable ) {
149 + $el_swiper_path = 'lib/swiper/v8/swiper.min.js';
150 + } else {
151 + $el_swiper_path = 'lib/swiper/swiper.min.js';
152 + }
153 +
154 + $elementor_swiper_path = ELEMENTOR_ASSETS_PATH . $el_swiper_path;
155 +
156 + if ( file_exists( $elementor_swiper_path ) ) {
157 + $default_swiper_path = ELEMENTOR_ASSETS_URL . $el_swiper_path;
158 + }
159 + }
160 +
140 161 $this->scripts[] = [
141 162 'handle' => 'swiper',
142 - 'src' => rtsb()->get_assets_uri( 'vendor/swiper/js/swiper-bundle.min.js' ),
163 + 'src' => esc_url( $default_swiper_path ),
143 164 'deps' => [ 'jquery' ],
144 165 'footer' => true,
145 166 ];
146 167
@@ -250,8 +271,9 @@
250 271 /**
251 272 * Register scripts.
252 273 */
253 274 $this->register_public_scripts();
275 + // wp_enqueue_style( 'swiper' );
254 276 /**
255 277 * Enqueue scripts.
256 278 */
257 279 if ( BuilderFns::is_builder_preview() && 'elementor' === Fns::page_edit_with( get_the_ID() ) ) {
@@ -257,9 +279,8 @@
257 279 if ( BuilderFns::is_builder_preview() && 'elementor' === Fns::page_edit_with( get_the_ID() ) ) {
258 280 /**
259 281 * Styles.
260 282 */
261 - wp_enqueue_style( 'swiper' );
262 283 wp_enqueue_style( 'photoswipe' );
263 284 wp_enqueue_style( 'photoswipe-default-skin' );
264 285 wp_enqueue_style( 'elementor-editor-style-fix' );
265 286 wp_enqueue_style( 'woocommerce-general' );
@@ -303,18 +324,20 @@
303 324 wp_localize_script(
304 325 'rtsb-public',
305 326 'rtsbPublicParams',
306 327 [
307 - 'ajaxUrl' => esc_url( self::$ajaxurl ),
308 - 'homeurl' => home_url(),
309 - 'wcCartUrl' => wc_get_cart_url(),
310 - 'addedToCartText' => esc_html__( 'Product Added', 'shopbuilder' ),
311 - 'browseCartText' => esc_html__( 'Browse Cart', 'shopbuilder' ),
312 - 'noProductsText' => apply_filters( 'rtsb/global/no_products_text', esc_html__( 'No more products to load', 'shopbuilder' ) ),
313 - 'notice' => [
328 + 'ajaxUrl' => esc_url( self::$ajaxurl ),
329 + 'homeurl' => home_url(),
330 + 'wcCartUrl' => wc_get_cart_url(),
331 + 'addedToCartText' => esc_html__( 'Product Added', 'shopbuilder' ),
332 + 'singleCartToastrText' => esc_html__( 'Successfully Added', 'shopbuilder' ),
333 + 'singleCartBtnText' => apply_filters( 'rtsb/global/single_add_to_cart_success', esc_html__( 'Added to Cart', 'shopbuilder' ) ),
334 + 'browseCartText' => esc_html__( 'Browse Cart', 'shopbuilder' ),
335 + 'noProductsText' => apply_filters( 'rtsb/global/no_products_text', esc_html__( 'No more products to load', 'shopbuilder' ) ),
336 + 'notice' => [
314 337 'position' => Fns::get_option( 'general', 'notification', 'notification_position', 'center-center' ),
315 338 ],
316 - rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
339 + rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
317 340 ]
318 341 );
319 342 }
320 343
@@ -327,9 +350,20 @@
327 350 /**
328 351 * Styles.
329 352 */
330 353 wp_register_style( 'rtsb-admin-app', rtsb()->get_assets_uri( 'css/backend/admin-settings.css' ), '', $this->version );
331 - wp_register_style( 'rtsb-admin-global', rtsb()->get_assets_uri( 'css/backend/admin-global.css' ), '', $this->version );
354 + wp_register_style( 'rtsb-fonts', rtsb()->get_assets_uri( 'css/frontend/rtsb-fonts.css' ), '', $this->version );
355 +
356 + $current_screen = get_current_screen();
357 +
358 + if ( 'edit-rtsb_builder' === $current_screen->id ) {
359 + if ( ! function_exists( 'woocommerce_get_asset_url' ) ) {
360 + include_once WC_ABSPATH . 'includes/wc-template-functions.php';
361 + }
362 +
363 + wp_deregister_style( 'select2' );
364 + wp_register_style( 'select2', plugins_url( 'assets/css/select2.css', WC_PLUGIN_FILE ) ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
365 + }
332 366 wp_register_style( 'rtsb-templatebuilder', rtsb()->get_assets_uri( 'css/backend/template-builder.css' ), '', $this->version );
333 367
334 368 /**
335 369 * Scripts.
@@ -335,9 +369,8 @@
335 369 * Scripts.
336 370 */
337 371 wp_register_script( 'rtsb-admin-app', rtsb()->get_assets_uri( 'js/backend/admin-settings.js' ), '', $this->version, true );
338 372 wp_register_script( 'rtsb-templatebuilder', rtsb()->get_assets_uri( 'js/backend/template-builder.js' ), '', $this->version, true );
339 -
340 373 }
341 374
342 375 /**
343 376 * Enqueues admin scripts.
@@ -346,14 +379,39 @@
346 379 *
347 380 * @return void
348 381 */
349 382 public function enqueue_backend_scripts( $hook ) {
383 + ob_start(); ?>
384 + #adminmenu .toplevel_page_rtsb .wp-menu-image img {
385 + width: auto;
386 + height: 22px;
387 + padding: 4px 0;
388 + }
389 + .post-type-rtsb_builder li#wp-admin-bar-WPML_ALS_all,
390 + .post-type-rtsb_builder li.language_all{
391 + display: none;
392 + }
350 393
351 - wp_enqueue_style( 'rtsb-admin-global' );
394 + <?php
395 + $admin_global_style = ob_get_clean();
396 + // Speed Optimization.
397 + wp_add_inline_style( 'admin-menu', $admin_global_style );
398 + // wp_enqueue_style( 'rtsb-admin-global' );
352 399
353 400 global $pagenow;
354 401
355 - if ( 'admin.php' === $pagenow && ! empty( $_GET['page'] ) && 'rtsb-settings' === $_GET['page'] ) {
402 + $whitelisted_pages = [ 'rtsb-settings', 'rtsb-get-help', 'rtsb-themes' ];
403 + $current_page = ! empty( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
404 +
405 + if ( 'admin.php' === $pagenow && ! empty( $_GET['page'] ) && in_array( $current_page, $whitelisted_pages, true ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
406 + /**
407 + * Styles.
408 + */
409 + wp_enqueue_style( 'rtsb-admin-app' );
410 + wp_enqueue_style( 'rtsb-fonts' );
411 + }
412 +
413 + if ( 'admin.php' === $pagenow && ! empty( $_GET['page'] ) && 'rtsb-settings' === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
356 414 // Elementor Console Error Fixed For "rtsb-settings" Page.
357 415 wp_dequeue_script( 'elementor-admin-top-bar' );
358 416 wp_dequeue_script( 'elementor-common' );
359 417 wp_dequeue_script( 'elementor-dev-tools' );
@@ -368,13 +426,8 @@
368 426 wp_dequeue_style( 'e-theme-ui-light' );
369 427 wp_dequeue_style( 'elementor-common' );
370 428
371 429 /**
372 - * Styles.
373 - */
374 - wp_enqueue_style( 'rtsb-admin-app' );
375 -
376 - /**
377 430 * Scripts.
378 431 */
379 432 wp_enqueue_script( 'updates' );
380 433 wp_enqueue_script( 'rtsb-admin-app' );
@@ -381,16 +434,19 @@
381 434 wp_localize_script(
382 435 'rtsb-admin-app',
383 436 'rtsbParams',
384 437 [
385 - 'ajaxurl' => esc_url( self::$ajaxurl ),
386 - 'homeurl' => home_url(),
387 - 'restApiUrl' => esc_url_raw( rest_url() ),
388 - 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
389 - 'nonce' => wp_create_nonce( rtsb()->nonceText ),
390 - 'sections' => Settings::instance()->get_sections(),
391 - 'pages' => Fns::get_pages(),
392 - 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no'
438 + 'ajaxurl' => esc_url( self::$ajaxurl ),
439 + 'homeurl' => home_url(),
440 + 'adminLogo' => rtsb()->get_assets_uri( 'images/icon/ShopBuilder-Logo.svg' ),
441 + 'restApiUrl' => esc_url_raw( rest_url() ),
442 + 'rest_nonce' => wp_create_nonce( 'wp_rest' ),
443 + 'nonce' => wp_create_nonce( rtsb()->nonceText ),
444 + 'pages' => Fns::get_pages(),
445 + 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
446 + 'updateRates' => esc_html__( 'Update All Rates', 'shopbuilder' ),
447 + 'sections' => Settings::instance()->get_sections(),
448 + 'userRoles' => Fns::get_all_user_roles(),
393 449 ]
394 450 );
395 451 } else {
396 452 $current_screen = get_current_screen();
@@ -403,9 +459,9 @@
403 459 * Styles.
404 460 */
405 461 wp_enqueue_style( 'rtsb-templatebuilder' );
406 462
407 - wp_enqueue_style( 'select2', plugins_url( 'assets/css/select2.css', WC_PLUGIN_FILE ) );
463 + wp_enqueue_style( 'select2', plugins_url( 'assets/css/select2.css', WC_PLUGIN_FILE ) ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
408 464
409 465 wp_enqueue_script( 'selectWoo' );
410 466 /**
411 467 * Scripts.
@@ -418,9 +474,9 @@
418 474 [
419 475 'ajaxurl' => esc_url( self::$ajaxurl ),
420 476 'homeurl' => home_url(),
421 477 rtsb()->nonceId => wp_create_nonce( rtsb()->nonceText ),
422 - 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no'
478 + 'hasPro' => rtsb()->has_pro() ? 'yes' : 'no',
423 479 ]
424 480 );
425 481 }
426 482 }