PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.2.1
ShopBuilder – WooCommerce Builder For Elementor v2.2.1
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 +48 -25 2.1.62.2.1 View file →
@@ -69,13 +69,13 @@
69 69 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'editor_scripts' ] );
70 70 // add_action( 'template_redirect', [ $this, 'both_builder_frontend' ], 99 );
71 71
72 72 // RT Select2 Ajax.
73 - add_action( 'wp_ajax_rt_select2_object_search', [ $this, 'select2_ajax_posts_filter_autocomplete' ] );
74 - add_action( 'wp_ajax_nopriv_rt_select2_object_search', [ $this, 'select2_ajax_posts_filter_autocomplete' ] );
73 + add_action( 'wp_ajax_rtsb_select2_object_search', [ $this, 'select2_ajax_posts_filter_autocomplete' ] );
74 + add_action( 'wp_ajax_nopriv_rtsb_select2_object_search', [ $this, 'select2_ajax_posts_filter_autocomplete' ] );
75 75 // Select2 ajax save data.
76 - add_action( 'wp_ajax_rt_select2_get_title', [ $this, 'select2_ajax_get_posts_value_titles' ] );
77 - add_action( 'wp_ajax_nopriv_rt_select2_get_title', [ $this, 'select2_ajax_get_posts_value_titles' ] );
76 + add_action( 'wp_ajax_rtsb_select2_get_title', [ $this, 'select2_ajax_get_posts_value_titles' ] );
77 + add_action( 'wp_ajax_nopriv_rtsb_select2_get_title', [ $this, 'select2_ajax_get_posts_value_titles' ] );
78 78 }
79 79
80 80 /**
81 81 * Apply for frontend.
@@ -107,21 +107,29 @@
107 107 *
108 108 * @return void
109 109 */
110 110 public function add_elementor_widget_categories( $elements_manager ) {
111 - $type = BuilderFns::builder_type( get_the_ID() );
112 - $builder_type = ! empty( BuilderFns::builder_page_types()[ $type ] ) ? BuilderFns::builder_page_types()[ $type ] : '';
113 - $builder_type = str_replace( 'My Account - ', '', $builder_type );
114 - $categories['rtsb-shopbuilder'] = [
115 - 'title' => esc_html__( 'ShopBuilder', 'shopbuilder' ) . ' - ' . ucfirst( $builder_type ),
116 - 'icon' => 'fa fa-plug',
117 - ];
118 - $categories['rtsb-shopbuilder-general'] = [
119 - 'title' => esc_html__( 'Shopbuilder - General', 'shopbuilder' ),
120 - 'icon' => 'fa fa-plug',
121 - ];
111 + $categories = [];
112 + $builder_id = get_queried_object_id();
113 + $id = Fns::wpml_object_id( $builder_id, BuilderFns::$post_type_tb, 'default' );
114 + $type = BuilderFns::builder_type( $id );
122 115
123 - $categories = apply_filters( 'rtsb_elementor_widgets_category_lists', $categories );
116 + if ( $type ) {
117 + $builder_type = ! empty( BuilderFns::builder_page_types()[ $type ] ) ? BuilderFns::builder_page_types()[ $type ] : '';
118 + $builder_type = str_replace( [ 'My Account - ', 'Endpoint: ' ], '', $builder_type );
119 + $categories['rtsb-shopbuilder'] = [
120 + 'title' => esc_html__( 'ShopBuilder', 'shopbuilder' ) . ' - ' . ucfirst( $builder_type ),
121 + 'icon' => 'fa fa-plug',
122 + ];
123 + }
124 + if ( 'quick-view' !== $type ) {
125 + $categories['rtsb-shopbuilder-general'] = [
126 + 'title' => esc_html__( 'Shopbuilder - General', 'shopbuilder' ),
127 + 'icon' => 'fa fa-plug',
128 + ];
129 + }
130 + $categories = apply_filters( 'rtsb_elementor_widgets_category_lists', $categories );
131 +
124 132 $other_categories = $elements_manager->get_categories();
125 133 $categories = array_merge(
126 134 array_slice( $other_categories, 0, 1 ),
127 135 $categories,
@@ -127,10 +135,10 @@
127 135 $categories,
128 136 array_slice( $other_categories, 1 )
129 137 );
130 138
131 - $set_categories = function ( $categories ) {
132 - $this->categories = $categories;
139 + $set_categories = function ( $categories ) use ( $elements_manager ) {
140 + $elements_manager->categories = $categories;
133 141 };
134 142
135 143 $set_categories->call( $elements_manager, $categories );
136 144 }
@@ -222,9 +230,9 @@
222 230 *
223 231 * @return array
224 232 */
225 233 public function rtsb_icons( $tabs = [] ) {
226 - $custom_icons = $this->get_icons();
234 + $custom_icons = Fns::get_custom_icon_names();
227 235
228 236 $tabs['shopbuilder-icons'] = [
229 237 'name' => 'rtsb-fonts',
230 238 'label' => esc_html__( 'ShopBuilder Icons', 'shopbuilder' ),
@@ -289,8 +297,18 @@
289 297
290 298 if ( BuilderFns::is_product() ) {
291 299 $product_id = Fns::get_prepared_product_id();
292 300 $parent_class = wc_get_product_class( $parent_class, $product_id );
301 + if ( function_exists( 'rtwpvs' ) ) {
302 + $_product = Fns::get_product();
303 + if ( $_product->is_type( 'variable' ) ) {
304 + $parent_class[] = 'rtwpvs-product';
305 + $beside_label = function_exists( 'rtwpvsp' ) && rtwpvs()->get_option( 'attribute_on_click_behavior' );
306 + if ( $beside_label ) {
307 + $parent_class[] = 'rtwpvs-selected-term-beside-label';
308 + }
309 + }
310 + }
293 311 }
294 312
295 313 if ( BuilderFns::is_shop() ) {
296 314 $parent_class[] = 'shop';
@@ -354,14 +372,15 @@
354 372 *
355 373 * @return void
356 374 */
357 375 public function select2_ajax_posts_filter_autocomplete() {
358 -
376 + if ( ! wp_verify_nonce( Fns::get_nonce(), rtsb()->nonceText ) ) {
377 + wp_send_json_error( [] );
378 + }
359 379 $query_per_page = 15;
360 380 $post_type = 'post';
361 381 $source_name = 'post_type';
362 - $paged = $_POST['page'] ?? 1;
363 -
382 + $paged = absint( $_POST['page'] ?? 1 );
364 383 if ( ! empty( $_POST['post_type'] ) ) {
365 384 $post_type = sanitize_text_field( $_POST['post_type'] );
366 385 }
367 386
@@ -429,8 +448,12 @@
429 448 * @return void
430 449 */
431 450 public function select2_ajax_get_posts_value_titles() {
432 451
452 + if ( ! wp_verify_nonce( Fns::get_nonce(), rtsb()->nonceText ) ) {
453 + wp_send_json_error( [] );
454 + }
455 +
433 456 if ( empty( $_POST['id'] ) ) {
434 457 wp_send_json_error( [] );
435 458 }
436 459
@@ -529,9 +552,9 @@
529 552 $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s", '%' . esc_sql( $search ) . '%' );
530 553 }
531 554
532 555 $query = "select post_title,ID from $wpdb->posts where post_status = 'publish' {$where} {$limit}";
533 - $results = $wpdb->get_results( $query );
556 + $results = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching
534 557
535 558 if ( ! empty( $results ) ) {
536 559 foreach ( $results as $row ) {
537 560 $data[ $row->ID ] = $row->post_title . ' [#' . $row->ID . ']';
@@ -562,10 +585,10 @@
562 585
563 586 $pro_widgets = [
564 587 [
565 588 'name' => 'rtsb-ajax-product-filters',
566 - 'title' => esc_html__( 'Ajax Product Filters', 'testimonial-slider-showcase' ),
567 - 'description' => esc_html__( 'Ajax Product Filters', 'testimonial-slider-showcase' ),
589 + 'title' => esc_html__( 'Ajax Product Filters', 'shopbuilder' ),
590 + 'description' => esc_html__( 'Ajax Product Filters', 'shopbuilder' ),
568 591 'icon' => 'rtsb-el-custom rtsb-element icon-rtsb-ajax-product-filters rtsb-promotional-element',
569 592 'categories' => '[ "rtsb-shopbuilder" ]',
570 593 ],
571 594 ];