PluginProbe
ShopBuilder – WooCommerce Builder For Elementor / 2.1.3
ShopBuilder – WooCommerce Builder For Elementor v2.1.3
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 +22 -20 2.2.0 → 2.1.3 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,8 +106,9 @@
106 106 $field_name = isset( $default[ $field ] ) ? $default[ $field ] : '';
107 107 }
108 108
109 109 return $field_name;
110 +
110 111 }
111 112
112 113 public function display_field( $field_id, $product ) {
113 114
@@ -117,25 +118,25 @@
117 118 }
118 119 switch ( $type ) {
119 120 case 'primary':
120 121 ?>
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">
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">
126 127 <?php
127 128 if ( ! empty( $product['primary']['image'] ) ) {
128 129 echo wp_kses( $product['primary']['image'], Fns::allowedHtml( 'image' ) );
129 130 }
130 131 ?>
131 - </a>
132 - </div>
132 + </a>
133 + </div>
133 134 <?php
134 135 break;
135 136
136 137 case 'title':
137 - echo '<a href="' . esc_url( get_permalink( $product['id'] ) ) . '" class="rtsb-compare-product-title">' . esc_html( $product[ $field_id ] ) . '</a>';
138 + echo '<a href="' . get_permalink( $product['id'] ) . '" class="rtsb-compare-product-title">' . esc_html( $product[ $field_id ] ) . '</a>';
138 139 break;
139 140
140 141 case 'rating':
141 142 echo '<span class="rtsb-compare-product-rating">' . wp_kses_post( $product[ $field_id ] ) . '</span>';
@@ -145,20 +146,20 @@
145 146 echo '<div class="rtsb-compare-product-price">' . wp_kses_post( $product[ $field_id ] ) . '</div>';
146 147 break;
147 148
148 149 case 'add_to_cart':
149 - Fns::print_html( apply_filters( 'rtsb/module/compare/add_to_cart_btn', $product[ $field_id ] ) );
150 + echo apply_filters( 'rtsb/module/compare/add_to_cart_btn', $product[ $field_id ] );
150 151 break;
151 152
152 153 case 'weight':
153 154 if ( $product[ $field_id ] ) {
154 155 $unit = $product[ $field_id ] !== '-' ? get_option( 'woocommerce_weight_unit' ) : '';
155 - Fns::print_html( wc_format_localized_decimal( $product[ $field_id ] ) . ' ' . esc_attr( $unit ) );
156 + echo wc_format_localized_decimal( $product[ $field_id ] ) . ' ' . esc_attr( $unit );
156 157 }
157 158 break;
158 159
159 160 case 'description':
160 - Fns::print_html( apply_filters( 'woocommerce_short_description', $product[ $field_id ] ) );
161 + echo apply_filters( 'woocommerce_short_description', $product[ $field_id ] );
161 162 break;
162 163
163 164 default:
164 165 echo isset( $product[ $field_id ] ) ? wp_kses_post( $product[ $field_id ] ) : '';
@@ -220,12 +221,12 @@
220 221 if ( ! empty( $tax_field_ids ) ) {
221 222 foreach ( $tax_field_ids as $field_id ) {
222 223 if ( taxonomy_exists( $field_id ) ) {
223 224 $products_data[ $product->get_id() ][ $field_id ] = [];
224 - $terms = get_the_terms( $product->get_id(), $field_id );
225 + $terms = get_the_terms( $product->get_id(), $field_id );
225 226 if ( ! empty( $terms ) ) {
226 227 foreach ( $terms as $term ) {
227 - $term = sanitize_term( $term, $field_id );
228 + $term = sanitize_term( $term, $field_id );
228 229 $products_data[ $product->get_id() ][ $field_id ][] = $term->name;
229 230 }
230 231 } else {
231 232 $products_data[ $product->get_id() ][ $field_id ][] = '-';
@@ -401,15 +402,15 @@
401 402
402 403 public function reached_max_limit() {
403 404
404 405 $product_ids = $this->get_compared_product_ids();
405 - $max_limit = absint( Fns::get_option( 'modules', 'compare', 'max_limit', 10, 'checkbox' ) );
406 + $max_limit = absint( Fns::get_option( 'modules', 'compare', 'max_limit', 10, 'checkbox' ) );
406 407
407 - // Remove if product is not exist.
408 + // Remove if product is not exist.
408 409 foreach ( $product_ids as $id ) {
409 - if ( 'publish' !== get_post_status( $id ) ) {
410 + if( 'publish' !== get_post_status( $id )){
410 411 $this->remove_product( $id );
411 - unset( $product_ids[ $id ] );
412 + unset( $product_ids[$id] );
412 413 }
413 414 }
414 415
415 416 if ( $max_limit && count( $product_ids ) >= $max_limit ) {
@@ -417,5 +418,6 @@
417 418 }
418 419
419 420 return false;
420 421 }
422 +
421 423 }