Ver código fonte

Fix HTML entities leaking into variant combobox labels — v1.5.8 -> v1.5.9

Term names stored in the DB can carry HTML entities ( , K,
&aacute;, …) pasted in from rich editors. <option> text is literal, so
they rendered as-is in the variant selector. Same issue on the
order-overview panel. Decode entities (and urldecode non-taxonomy
values) before handing the label to JS / before echoing in the template.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Dalibor Votruba 2 meses atrás
pai
commit
5e6b80b47e

+ 1 - 1
studiou-wc-free-photo-product/CLAUDE.md

@@ -2,7 +2,7 @@
 
 ## Project Overview
 
-WordPress/WooCommerce plugin called **studiou-wc-free-photo-product** (QDR - Studiou WC Free Photo Product) v1.5.8.
+WordPress/WooCommerce plugin called **studiou-wc-free-photo-product** (QDR - Studiou WC Free Photo Product) v1.5.9.
 Allows publishing special variable products where customers upload custom raw images to be printed for a price.
 
 ## Initial Requirements

+ 7 - 3
studiou-wc-free-photo-product/includes/class-studiou-wc-fpp-single-product.php

@@ -156,9 +156,13 @@ class Studiou_WC_FPP_Single_Product {
                 if ($attr_value === '') {
                     continue;
                 }
-                $taxonomy  = str_replace('attribute_', '', $attr_name);
-                $term      = taxonomy_exists($taxonomy) ? get_term_by('slug', $attr_value, $taxonomy) : null;
-                $label_parts[] = $term ? $term->name : $attr_value;
+                $taxonomy = str_replace('attribute_', '', $attr_name);
+                $term     = taxonomy_exists($taxonomy) ? get_term_by('slug', $attr_value, $taxonomy) : null;
+                // Term names or non-tax values may carry HTML entities (&nbsp;, &#75;,
+                // &aacute;, …) pasted in by admins. <option> text is literal, so entities
+                // would render as-is. Decode before handing to JS.
+                $raw = $term ? $term->name : urldecode((string) $attr_value);
+                $label_parts[] = html_entity_decode($raw, ENT_QUOTES | ENT_HTML5, 'UTF-8');
             }
             $tiers = class_exists('Studiou_WC_FPP_Pricing')
                 ? Studiou_WC_FPP_Pricing::get_tiers($variation_id)

BIN
studiou-wc-free-photo-product/languages/studiou-wc-free-photo-product-cs_CZ.mo


+ 1 - 1
studiou-wc-free-photo-product/languages/studiou-wc-free-photo-product-cs_CZ.po

@@ -3,7 +3,7 @@
 # This file is distributed under the GPL v2 or later.
 msgid ""
 msgstr ""
-"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.5.8\n"
+"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.5.9\n"
 "Report-Msgid-Bugs-To: https://www.quadarax.com\n"
 "POT-Creation-Date: 2026-04-02 00:00+0000\n"
 "PO-Revision-Date: 2026-04-02 00:00+0000\n"

+ 1 - 1
studiou-wc-free-photo-product/languages/studiou-wc-free-photo-product.pot

@@ -2,7 +2,7 @@
 # This file is distributed under the GPL v2 or later.
 msgid ""
 msgstr ""
-"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.5.8\n"
+"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.5.9\n"
 "Report-Msgid-Bugs-To: https://www.quadarax.com\n"
 "POT-Creation-Date: 2026-04-02 00:00+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

+ 2 - 2
studiou-wc-free-photo-product/studiou-wc-free-photo-product.php

@@ -3,7 +3,7 @@
  * Plugin Name: QDR - Studiou WC Free Photo Product
  * Plugin URI: https://www.quadarax.com/plugins/studiou-wc-free-photo-product
  * Description: Allows publishing special WooCommerce products with variants and custom raw image upload for photo printing
- * Version: 1.5.8
+ * Version: 1.5.9
  * Requires at least: 6.9.4
  * Requires PHP: 8.2
  * Requires Plugins: woocommerce, product-variant-table-for-woocommerce
@@ -22,7 +22,7 @@ if (!defined('WPINC')) {
     die;
 }
 
-if (!defined('STUDIOU_WCFPP_VERSION')) define('STUDIOU_WCFPP_VERSION', '1.5.8');
+if (!defined('STUDIOU_WCFPP_VERSION')) define('STUDIOU_WCFPP_VERSION', '1.5.9');
 if (!defined('STUDIOU_WCFPP_PLUGIN_DIR')) define('STUDIOU_WCFPP_PLUGIN_DIR', plugin_dir_path(__FILE__));
 if (!defined('STUDIOU_WCFPP_PLUGIN_URL')) define('STUDIOU_WCFPP_PLUGIN_URL', plugin_dir_url(__FILE__));
 if (!defined('STUDIOU_WCFPP_PLUGIN_BASENAME')) define('STUDIOU_WCFPP_PLUGIN_BASENAME', plugin_basename(__FILE__));

+ 2 - 1
studiou-wc-free-photo-product/views/single-product-order-overview.php

@@ -54,7 +54,8 @@ if ($cart && $cart instanceof WC_Cart) {
                         if ($v === '') continue;
                         $tax = str_replace('attribute_', '', $k);
                         $term = taxonomy_exists($tax) ? get_term_by('slug', $v, $tax) : null;
-                        $bits[] = $term ? $term->name : $v;
+                        $raw = $term ? $term->name : urldecode((string) $v);
+                        $bits[] = html_entity_decode($raw, ENT_QUOTES | ENT_HTML5, 'UTF-8');
                     }
                     $variant_label = implode(' / ', $bits);
                 }