PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.6.1
ShopBuilder – WooCommerce Builder For Elementor v2.6.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 +24 -12 2.1.152.6.1 View file →
@@ -60,16 +60,13 @@
60 60 BuilderHooks::instance();
61 61 }
62 62
63 63 BuilderCpt::instance();
64 -
65 - $this->elementor_init();
66 - $this->both_builder_frontend();
67 -
68 - // add_action( 'elementor/init', [ $this, 'elementor_init' ] );
69 - add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'editor_scripts' ] );
70 - // add_action( 'template_redirect', [ $this, 'both_builder_frontend' ], 99 );
71 -
64 + if ( defined( 'ELEMENTOR_VERSION' ) ) {
65 + $this->elementor_init();
66 + $this->both_builder_frontend();
67 + add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'editor_scripts' ] );
68 + }
72 69 // RT Select2 Ajax.
73 70 add_action( 'wp_ajax_rtsb_select2_object_search', [ $this, 'select2_ajax_posts_filter_autocomplete' ] );
74 71 add_action( 'wp_ajax_nopriv_rtsb_select2_object_search', [ $this, 'select2_ajax_posts_filter_autocomplete' ] );
75 72 // Select2 ajax save data.
@@ -135,10 +132,10 @@
135 132 $categories,
136 133 array_slice( $other_categories, 1 )
137 134 );
138 135
139 - $set_categories = function ( $categories ) {
140 - $this->categories = $categories;
136 + $set_categories = function ( $categories ) use ( $elements_manager ) {
137 + $elements_manager->categories = $categories;
141 138 };
142 139
143 140 $set_categories->call( $elements_manager, $categories );
144 141 }
@@ -380,15 +377,18 @@
380 377 $post_type = 'post';
381 378 $source_name = 'post_type';
382 379 $paged = absint( $_POST['page'] ?? 1 );
383 380 if ( ! empty( $_POST['post_type'] ) ) {
381 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
384 382 $post_type = sanitize_text_field( $_POST['post_type'] );
385 383 }
386 384
387 385 if ( ! empty( $_POST['source_name'] ) ) {
386 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
388 387 $source_name = sanitize_text_field( $_POST['source_name'] );
389 388 }
390 389
390 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
391 391 $search = ! empty( $_POST['search'] ) ? sanitize_text_field( $_POST['search'] ) : '';
392 392 $results = $post_list = [];
393 393 switch ( $source_name ) {
394 394 case 'taxonomy':
@@ -456,13 +456,14 @@
456 456 if ( empty( $_POST['id'] ) ) {
457 457 wp_send_json_error( [] );
458 458 }
459 459
460 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
460 461 if ( empty( array_filter( $_POST['id'] ) ) ) {
461 462 wp_send_json_error( [] );
462 463 }
463 464 $ids = array_map( 'intval', $_POST['id'] );
464 - $source_name = ! empty( $_POST['source_name'] ) ? sanitize_text_field( $_POST['source_name'] ) : '';
465 + $source_name = ! empty( $_POST['source_name'] ) ? sanitize_text_field( $_POST['source_name'] ) : ''; // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash
465 466
466 467 switch ( $source_name ) {
467 468 case 'taxonomy':
468 469 $args = [
@@ -471,9 +472,11 @@
471 472 'order' => 'ASC',
472 473 'include' => implode( ',', $ids ),
473 474 ];
474 475
476 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated
475 477 if ( $_POST['post_type'] !== 'all' ) {
478 + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash
476 479 $args['taxonomy'] = sanitize_text_field( $_POST['post_type'] );
477 480 }
478 481
479 482 $response = wp_list_pluck( get_terms( $args ), 'name', 'term_id' );
@@ -491,9 +494,9 @@
491 494 break;
492 495 default:
493 496 $post_info = get_posts(
494 497 [
495 - 'post_type' => sanitize_text_field( $_POST['post_type'] ),
498 + 'post_type' => sanitize_text_field( $_POST['post_type'] ), // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotValidated
496 499 'include' => implode( ',', $ids ),
497 500 ]
498 501 );
499 502 $response = wp_list_pluck( $post_info, 'post_title', 'ID' );
@@ -549,8 +552,17 @@
549 552 }
550 553
551 554 if ( ! empty( $search ) ) {
552 555 $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title LIKE %s", '%' . esc_sql( $search ) . '%' );
556 + }
557 +
558 + // Add a query for shop_coupon post-type to check 'show on frontend' meta.
559 + if ( 'shop_coupon' === $post_type ) {
560 + $where .= " AND {$wpdb->posts}.ID IN (
561 + SELECT post_id FROM {$wpdb->postmeta}
562 + WHERE meta_key = 'rtsb_show_on_frontend'
563 + AND meta_value = 'on'
564 + )";
553 565 }
554 566
555 567 $query = "select post_title,ID from $wpdb->posts where post_status = 'publish' {$where} {$limit}";
556 568 $results = $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching