PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.13
ShopBuilder – WooCommerce Builder For Elementor v2.1.13
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/Modules/Compare/CompareFns.php +20 -22 2.1.32.1.13 View file →
@@ -18,9 +18,9 @@
18 18 /**
19 19 * @return false|string
20 20 */
21 21 public function get_page_url() {
22 - $page_id = Fns::get_option( 'modules', 'compare', 'page' );
22 + $page_id = Fns::get_option( 'modules', 'compare', 'page' );
23 23 return get_permalink( $page_id );
24 24 }
25 25
26 26 /**
@@ -74,10 +74,10 @@
74 74 * @return array Table Field list
75 75 */
76 76 static function get_list_field_ids() {
77 77
78 - $default_show = array_keys( self::get_list_default_fields() );
79 - $fields_settings = Fns::get_option( 'modules', 'compare', 'page_show_fields', [] );
78 + $default_show = array_keys( self::get_list_default_fields() );
79 + $fields_settings = Fns::get_option( 'modules', 'compare', 'page_show_fields', [] );
80 80 if ( isset( $fields_settings ) && ( is_array( $fields_settings ) ) && count( $fields_settings ) > 1 ) {
81 81 $fields = $fields_settings;
82 82 } else {
83 83 $fields = $default_show;
@@ -106,9 +106,8 @@
106 106 $field_name = isset( $default[ $field ] ) ? $default[ $field ] : '';
107 107 }
108 108
109 109 return $field_name;
110 -
111 110 }
112 111
113 112 public function display_field( $field_id, $product ) {
114 113
@@ -118,25 +117,25 @@
118 117 }
119 118 switch ( $type ) {
120 119 case 'primary':
121 120 ?>
122 - <div class="rtsb-compare-primary-content-area">
123 - <a href="#" class="rtsb-compare-remove" data-product_id="<?php echo absint( $product['id'] ); ?>">
124 - <i class="rtsb-icon rtsb-icon-trash-empty"></i>
125 - </a>
126 - <a href="<?php echo get_permalink( $product['id'] ); ?>" class="rtsb-compare-product-image">
121 + <div class="rtsb-compare-primary-content-area">
122 + <a href="#" class="rtsb-compare-remove" data-product_id="<?php echo absint( $product['id'] ); ?>">
123 + <i class="rtsb-icon rtsb-icon-trash-empty"></i>
124 + </a>
125 + <a href="<?php echo esc_url( get_permalink( $product['id'] ) ); ?>" class="rtsb-compare-product-image">
127 126 <?php
128 127 if ( ! empty( $product['primary']['image'] ) ) {
129 128 echo wp_kses( $product['primary']['image'], Fns::allowedHtml( 'image' ) );
130 129 }
131 130 ?>
132 - </a>
133 - </div>
131 + </a>
132 + </div>
134 133 <?php
135 134 break;
136 135
137 136 case 'title':
138 - echo '<a href="' . get_permalink( $product['id'] ) . '" class="rtsb-compare-product-title">' . esc_html( $product[ $field_id ] ) . '</a>';
137 + echo '<a href="' . esc_url( get_permalink( $product['id'] ) ) . '" class="rtsb-compare-product-title">' . esc_html( $product[ $field_id ] ) . '</a>';
139 138 break;
140 139
141 140 case 'rating':
142 141 echo '<span class="rtsb-compare-product-rating">' . wp_kses_post( $product[ $field_id ] ) . '</span>';
@@ -146,20 +145,20 @@
146 145 echo '<div class="rtsb-compare-product-price">' . wp_kses_post( $product[ $field_id ] ) . '</div>';
147 146 break;
148 147
149 148 case 'add_to_cart':
150 - echo apply_filters( 'rtsb/module/compare/add_to_cart_btn', $product[ $field_id ] );
149 + Fns::print_html( apply_filters( 'rtsb/module/compare/add_to_cart_btn', $product[ $field_id ] ) );
151 150 break;
152 151
153 152 case 'weight':
154 153 if ( $product[ $field_id ] ) {
155 154 $unit = $product[ $field_id ] !== '-' ? get_option( 'woocommerce_weight_unit' ) : '';
156 - echo wc_format_localized_decimal( $product[ $field_id ] ) . ' ' . esc_attr( $unit );
155 + Fns::print_html( wc_format_localized_decimal( $product[ $field_id ] ) . ' ' . esc_attr( $unit ) );
157 156 }
158 157 break;
159 158
160 159 case 'description':
161 - echo apply_filters( 'woocommerce_short_description', $product[ $field_id ] );
160 + Fns::print_html( apply_filters( 'woocommerce_short_description', $product[ $field_id ] ) );
162 161 break;
163 162
164 163 default:
165 164 echo isset( $product[ $field_id ] ) ? wp_kses_post( $product[ $field_id ] ) : '';
@@ -221,12 +220,12 @@
221 220 if ( ! empty( $tax_field_ids ) ) {
222 221 foreach ( $tax_field_ids as $field_id ) {
223 222 if ( taxonomy_exists( $field_id ) ) {
224 223 $products_data[ $product->get_id() ][ $field_id ] = [];
225 - $terms = get_the_terms( $product->get_id(), $field_id );
224 + $terms = get_the_terms( $product->get_id(), $field_id );
226 225 if ( ! empty( $terms ) ) {
227 226 foreach ( $terms as $term ) {
228 - $term = sanitize_term( $term, $field_id );
227 + $term = sanitize_term( $term, $field_id );
229 228 $products_data[ $product->get_id() ][ $field_id ][] = $term->name;
230 229 }
231 230 } else {
232 231 $products_data[ $product->get_id() ][ $field_id ][] = '-';
@@ -402,15 +401,15 @@
402 401
403 402 public function reached_max_limit() {
404 403
405 404 $product_ids = $this->get_compared_product_ids();
406 - $max_limit = absint( Fns::get_option( 'modules', 'compare', 'max_limit', 10, 'checkbox' ) );
405 + $max_limit = absint( Fns::get_option( 'modules', 'compare', 'max_limit', 10, 'checkbox' ) );
407 406
408 - // Remove if product is not exist.
407 + // Remove if product is not exist.
409 408 foreach ( $product_ids as $id ) {
410 - if( 'publish' !== get_post_status( $id )){
409 + if ( 'publish' !== get_post_status( $id ) ) {
411 410 $this->remove_product( $id );
412 - unset( $product_ids[$id] );
411 + unset( $product_ids[ $id ] );
413 412 }
414 413 }
415 414
416 415 if ( $max_limit && count( $product_ids ) >= $max_limit ) {
@@ -418,6 +417,5 @@
418 417 }
419 418
420 419 return false;
421 420 }
422 -
423 421 }