PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.0.0
ShopBuilder – WooCommerce Builder For Elementor v2.0.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/Controllers/BuilderController.php +25 -66 2.1.12.0.0 View file →
@@ -6,8 +6,9 @@
6 6 */
7 7
8 8 namespace RadiusTheme\SB\Controllers;
9 9
10 +use Elementor\Plugin;
10 11 use RadiusTheme\SB\Helpers\Fns;
11 12 use RadiusTheme\SB\Helpers\BuilderFns;
12 13 use RadiusTheme\SB\Traits\SingletonTrait;
13 14 use RadiusTheme\SB\Controllers\Builder\BuilderCpt;
@@ -14,9 +15,8 @@
14 15 use RadiusTheme\SB\Controllers\Hooks\BuilderHooks;
15 16 use RadiusTheme\SB\Elementor\Controls\ImageSelectorControl;
16 17 use RadiusTheme\SB\Elementor\Controls\Select2AjaxControl;
17 18 use RadiusTheme\SB\Models\ElementList;
18 -use RadiusTheme\SBPRO\Helpers\FnsPro;
19 19
20 20 // Do not allow directly accessing this file.
21 21 if ( ! defined( 'ABSPATH' ) ) {
22 22 exit( 'This script cannot be accessed directly.' );
@@ -26,13 +26,8 @@
26 26 * Builder Controller
27 27 */
28 28 class BuilderController {
29 29 /**
30 - * @var array
31 - */
32 - private static $cache = [];
33 -
34 - /**
35 30 * Builder page id.
36 31 *
37 32 * @var integer
38 33 */
@@ -62,14 +57,11 @@
62 57 }
63 58
64 59 BuilderCpt::instance();
65 60
66 - $this->elementor_init();
67 - $this->both_builder_frontend();
68 -
69 - // add_action( 'elementor/init', [ $this, 'elementor_init' ] );
61 + add_action( 'elementor/init', [ $this, 'elementor_init' ] );
70 62 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'editor_scripts' ] );
71 - // add_action( 'template_redirect', [ $this, 'both_builder_frontend' ], 99 );
63 + add_action( 'template_redirect', [ $this, 'both_builder_frontend' ], 99 );
72 64
73 65 // RT Select2 Ajax.
74 66 add_action( 'wp_ajax_rt_select2_object_search', [ $this, 'select2_ajax_posts_filter_autocomplete' ] );
75 67 add_action( 'wp_ajax_nopriv_rt_select2_object_search', [ $this, 'select2_ajax_posts_filter_autocomplete' ] );
@@ -157,11 +149,16 @@
157 149 *
158 150 * @since 1.0.0
159 151 */
160 152 public function init_widgets( $widgets_manager ) {
153 + $product = Fns::get_product();
161 154
162 - $get_list = ElementList::instance()->get_list( true, 'active' );
163 - foreach ( $get_list as $element ) {
155 + // TODO: Need to remove below condition and make compitability in each widgets.
156 + if ( ! $product ) {
157 + return;
158 + }
159 +
160 + foreach ( ElementList::instance()->get_list( true, 'active' ) as $element ) {
164 161 if ( isset( $element['active'] ) && 'on' !== $element['active'] ) {
165 162 continue;
166 163 }
167 164
@@ -223,10 +220,23 @@
223 220 *
224 221 * @return array
225 222 */
226 223 public function rtsb_icons( $tabs = [] ) {
227 - $custom_icons = $this->get_icons();
224 + $fonts = rtsb()->get_assets_uri( 'fonts/rtsb-icons.json' );
228 225
226 + $response = wp_remote_get( $fonts );
227 +
228 + if ( is_wp_error( $response ) ) {
229 + return $tabs;
230 + }
231 +
232 + $icons_json = wp_remote_retrieve_body( $response );
233 + $custom_icons = json_decode( $icons_json, true );
234 +
235 + if ( null === $custom_icons ) {
236 + return $tabs;
237 + }
238 +
229 239 $tabs['shopbuilder-icons'] = [
230 240 'name' => 'rtsb-fonts',
231 241 'label' => esc_html__( 'ShopBuilder Icons', 'shopbuilder' ),
232 242 'labelIcon' => 'fab fa-elementor',
@@ -307,14 +317,9 @@
307 317
308 318 ?>
309 319 <!-- Before Content start -->
310 320 <div class="<?php echo esc_attr( implode( ' ', $parent_class ) ); ?>">
311 - <?php
312 - if ( BuilderFns::is_checkout() ) {
313 - if ( ! apply_filters( 'rtsb/multi/step/checkout/widget', true ) ) {
314 - return;
315 - }
316 - ?>
321 + <?php if ( BuilderFns::is_checkout() ) { ?>
317 322 <form name="checkout" method="post" class="rtsb-woocommerce-checkout checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">
318 323 <?php
319 324 }
320 325 }
@@ -336,11 +341,8 @@
336 341 do_action( 'elementor/page_templates/header-footer/after_content' );
337 342 }
338 343
339 344 if ( BuilderFns::is_checkout() ) {
340 - if ( ! apply_filters( 'rtsb/multi/step/checkout/widget', true ) ) {
341 - return;
342 - }
343 345 ?>
344 346 </form>
345 347 <?php
346 348 }
@@ -577,49 +579,6 @@
577 579 }
578 580 }
579 581
580 582 return $config;
581 - }
582 -
583 - /**
584 - * Get Icons.
585 - *
586 - * @return array
587 - */
588 - public function get_icons() {
589 - return [
590 - 'heart-empty',
591 - 'heart',
592 - 'eye',
593 - 'exchange',
594 - 'plus',
595 - 'minus',
596 - 'avatar',
597 - 'pay',
598 - 'share',
599 - 'clock',
600 - 'check-alt',
601 - 'check',
602 - 'delete',
603 - 'marker',
604 - 'list',
605 - 'list-2',
606 - 'power',
607 - 'cart',
608 - 'cart-2',
609 - 'cart-3',
610 - 'downloads',
611 - 'zoom',
612 - 'user-edit',
613 - 'grid',
614 - 'filter',
615 - 'billing',
616 - 'login',
617 - 'payment',
618 - 'search',
619 - 'edit',
620 - 'coupon',
621 - 'arrows-cw',
622 - 'trash-empty',
623 - ];
624 583 }
625 584 }