PluginProbe
Filter Everything — WordPress & WooCommerce Filters / 1.9.7
Filter Everything — WordPress & WooCommerce Filters v1.9.7
1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 All 52 releases
← All changes | src/Swatches.php +13 -6 1.9.2.11.9.7 View file →
@@ -87,8 +87,15 @@
87 87 public function frontend_display_swatch( $term_html, $link_attributes, $term_object, $filter ) {
88 88
89 89 $taxonomies = flrt_get_experimental_option( 'color_swatches_taxonomies', [] );
90 90
91 + // A brand term already rendered with its brand logo (wpc_term_brand_logo,
92 + // priority 5) must keep it — rebuilding here would replace the logo
93 + // markup with a swatch square
94 + if ( in_array( $filter['e_name'], flrt_brand_filter_entities() ) && flrt_get_term_brand_image( $term_object->term_id, $filter ) ) {
95 + return $term_html;
96 + }
97 +
91 98 if ( in_array( $filter['e_name'], $taxonomies ) ) {
92 99
93 100 $image_src = flrt_get_term_swatch_image( $term_object->term_id, $filter );
94 101 $wrapper_class = '';
@@ -93,14 +100,14 @@
93 100 $image_src = flrt_get_term_swatch_image( $term_object->term_id, $filter );
94 101 $wrapper_class = '';
95 102
96 103 if ( $image_src ) {
97 - $swatch = '<img src="'.$image_src.'" class="wpc-term-image" />';
104 + $swatch = '<img src="'.esc_url( $image_src ).'" class="wpc-term-image" />';
98 105 $wrapper_class = ' wpc-term-swatch-image';
99 106 } else {
100 107 $maybe_color = flrt_get_term_swatch_color( $term_object->term_id, $filter );
101 108 if ( $maybe_color ) {
102 - $swatch = '<span class="wpc-term-swatch" style="background-color: '.$maybe_color.'"></span>';
109 + $swatch = '<span class="wpc-term-swatch" style="background-color: '.esc_attr( $maybe_color ).'"></span>';
103 110 } else {
104 111 $swatch = '<span class="wpc-term-swatch wpc-no-swatch-yet"></span>';
105 112 $wrapper_class = ' wpc-term-swatch-no-image';
106 113 }
@@ -105,11 +112,11 @@
105 112 $wrapper_class = ' wpc-term-swatch-no-image';
106 113 }
107 114 }
108 115
109 - $link_attributes .= ' title="'.$term_object->name.'"';
116 + $link_attributes .= ' title="'.esc_attr( $term_object->name ).'"';
110 117 $term_html = '<a '.$link_attributes.'><span class="wpc-term-swatch-wrapper'.$wrapper_class.'">' . $swatch . '</span> ';
111 - $term_html .= '<span class="wpc-term-name">' . $term_object->name . '</span></a>';
118 + $term_html .= '<span class="wpc-term-name">' . esc_html( $term_object->name ) . '</span></a>';
112 119 }
113 120
114 121 return $term_html;
115 122 }
@@ -314,9 +321,9 @@
314 321 $image_id = get_term_meta( $term_id, $image_key, true );
315 322 if ( $image_id ) {
316 323 $maybe_image = wp_get_attachment_image_url( $image_id, 'thumbnail' );
317 324 if ( $maybe_image ) {
318 - echo '<img src="'.$maybe_image.'" class="wpc-term-preview" />'."\r\n";
325 + echo '<img src="'.esc_url( $maybe_image ).'" class="wpc-term-preview" />'."\r\n";
319 326 return true;
320 327 }
321 328 }
322 329
@@ -321,9 +328,9 @@
321 328 }
322 329
323 330 $color = get_term_meta( $term_id, $color_key, true );
324 331 if ( $color ) {
325 - echo '<div class="wpc-term-preview" style="background-color: '.$color.';"></div>'."\r\n";
332 + echo '<div class="wpc-term-preview" style="background-color: '.esc_attr( $color ).';"></div>'."\r\n";
326 333 return true;
327 334 } else {
328 335 echo '<div class="wpc-term-preview" style="background-color: transparent;"></div>'."\r\n";
329 336 return true;