Răsfoiți Sursa

Add custom upload info text field to product settings — v1.2.1 -> v1.2.2

- Add "Upload Info Text" textarea to Free Photo product tab
- Custom text displayed above upload area on product page
- If empty, falls back to default text with file size and formats
- Supports line breaks (nl2br)
- Add Czech translation
- Bump version

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dalibor Votruba 3 luni în urmă
părinte
comite
7e7030477b

+ 22 - 0
studiou-wc-free-photo-product/includes/class-studiou-wc-fpp-product.php

@@ -32,6 +32,7 @@ class Studiou_WC_FPP_Product {
         $enabled = get_post_meta($product_id, '_studiou_fpp_enabled', true);
         $enabled = get_post_meta($product_id, '_studiou_fpp_enabled', true);
         $media_category = get_post_meta($product_id, '_studiou_fpp_media_category', true);
         $media_category = get_post_meta($product_id, '_studiou_fpp_media_category', true);
         $max_file_size = get_post_meta($product_id, '_studiou_fpp_max_file_size', true);
         $max_file_size = get_post_meta($product_id, '_studiou_fpp_max_file_size', true);
+        $upload_info_text = get_post_meta($product_id, '_studiou_fpp_upload_info_text', true);
         $min_width = get_post_meta($product_id, '_studiou_fpp_min_width', true);
         $min_width = get_post_meta($product_id, '_studiou_fpp_min_width', true);
         $min_height = get_post_meta($product_id, '_studiou_fpp_min_height', true);
         $min_height = get_post_meta($product_id, '_studiou_fpp_min_height', true);
         $max_width = get_post_meta($product_id, '_studiou_fpp_max_width', true);
         $max_width = get_post_meta($product_id, '_studiou_fpp_max_width', true);
@@ -125,6 +126,19 @@ class Studiou_WC_FPP_Product {
                 </p>
                 </p>
             </div>
             </div>
 
 
+            <div class="options_group">
+                <?php
+                woocommerce_wp_textarea_input(array(
+                    'id'          => '_studiou_fpp_upload_info_text',
+                    'label'       => __('Upload Info Text', 'studiou-wc-free-photo-product'),
+                    'description' => __('Custom text displayed above the upload area on the product page. Leave empty for default text.', 'studiou-wc-free-photo-product'),
+                    'desc_tip'    => true,
+                    'value'       => $upload_info_text,
+                    'style'       => 'height:80px;',
+                ));
+                ?>
+            </div>
+
             <div class="options_group">
             <div class="options_group">
                 <p class="form-field">
                 <p class="form-field">
                     <label><?php esc_html_e('Shortcode', 'studiou-wc-free-photo-product'); ?></label>
                     <label><?php esc_html_e('Shortcode', 'studiou-wc-free-photo-product'); ?></label>
@@ -151,6 +165,10 @@ class Studiou_WC_FPP_Product {
             update_post_meta($product_id, '_studiou_fpp_max_file_size', $max_size);
             update_post_meta($product_id, '_studiou_fpp_max_file_size', $max_size);
         }
         }
 
 
+        if (isset($_POST['_studiou_fpp_upload_info_text'])) {
+            update_post_meta($product_id, '_studiou_fpp_upload_info_text', sanitize_textarea_field($_POST['_studiou_fpp_upload_info_text']));
+        }
+
         // Resolution limits (0 or empty = no limit)
         // Resolution limits (0 or empty = no limit)
         $res_fields = array('_studiou_fpp_min_width', '_studiou_fpp_min_height', '_studiou_fpp_max_width', '_studiou_fpp_max_height');
         $res_fields = array('_studiou_fpp_min_width', '_studiou_fpp_min_height', '_studiou_fpp_max_width', '_studiou_fpp_max_height');
         foreach ($res_fields as $field) {
         foreach ($res_fields as $field) {
@@ -194,6 +212,10 @@ class Studiou_WC_FPP_Product {
         return !empty($size) ? (int) $size : 50;
         return !empty($size) ? (int) $size : 50;
     }
     }
 
 
+    public static function get_product_upload_info_text($product_id) {
+        return get_post_meta($product_id, '_studiou_fpp_upload_info_text', true);
+    }
+
     public static function get_product_media_category($product_id) {
     public static function get_product_media_category($product_id) {
         return (int) get_post_meta($product_id, '_studiou_fpp_media_category', true);
         return (int) get_post_meta($product_id, '_studiou_fpp_media_category', true);
     }
     }

+ 7 - 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.
 # This file is distributed under the GPL v2 or later.
 msgid ""
 msgid ""
 msgstr ""
 msgstr ""
-"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.2.1\n"
+"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.2.2\n"
 "Report-Msgid-Bugs-To: https://www.quadarax.com\n"
 "Report-Msgid-Bugs-To: https://www.quadarax.com\n"
 "POT-Creation-Date: 2026-04-02 00:00+0000\n"
 "POT-Creation-Date: 2026-04-02 00:00+0000\n"
 "PO-Revision-Date: 2026-04-02 00:00+0000\n"
 "PO-Revision-Date: 2026-04-02 00:00+0000\n"
@@ -148,6 +148,12 @@ msgstr "Shortcode"
 msgid "Use this shortcode to display this product with photo upload on any page."
 msgid "Use this shortcode to display this product with photo upload on any page."
 msgstr "Použijte tento shortcode pro zobrazení tohoto produktu s nahráváním fotografií na jakékoli stránce."
 msgstr "Použijte tento shortcode pro zobrazení tohoto produktu s nahráváním fotografií na jakékoli stránce."
 
 
+msgid "Upload Info Text"
+msgstr "Text informací o nahrávání"
+
+msgid "Custom text displayed above the upload area on the product page. Leave empty for default text."
+msgstr "Vlastní text zobrazený nad oblastí nahrávání na stránce produktu. Ponechte prázdné pro výchozí text."
+
 msgid "Min Image Resolution (px)"
 msgid "Min Image Resolution (px)"
 msgstr "Min. rozlišení obrázku (px)"
 msgstr "Min. rozlišení obrázku (px)"
 
 

+ 9 - 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.
 # This file is distributed under the GPL v2 or later.
 msgid ""
 msgid ""
 msgstr ""
 msgstr ""
-"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.2.1\n"
+"Project-Id-Version: QDR - Studiou WC Free Photo Product 1.2.2\n"
 "Report-Msgid-Bugs-To: https://www.quadarax.com\n"
 "Report-Msgid-Bugs-To: https://www.quadarax.com\n"
 "POT-Creation-Date: 2026-04-02 00:00+0000\n"
 "POT-Creation-Date: 2026-04-02 00:00+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
@@ -190,6 +190,14 @@ msgstr ""
 msgid "Use this shortcode to display this product with photo upload on any page."
 msgid "Use this shortcode to display this product with photo upload on any page."
 msgstr ""
 msgstr ""
 
 
+#: includes/class-studiou-wc-fpp-product.php
+msgid "Upload Info Text"
+msgstr ""
+
+#: includes/class-studiou-wc-fpp-product.php
+msgid "Custom text displayed above the upload area on the product page. Leave empty for default text."
+msgstr ""
+
 #: includes/class-studiou-wc-fpp-product.php
 #: includes/class-studiou-wc-fpp-product.php
 msgid "Min Image Resolution (px)"
 msgid "Min Image Resolution (px)"
 msgstr ""
 msgstr ""

+ 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 Name: QDR - Studiou WC Free Photo Product
  * Plugin URI: https://www.quadarax.com/plugins/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
  * Description: Allows publishing special WooCommerce products with variants and custom raw image upload for photo printing
- * Version: 1.2.1
+ * Version: 1.2.2
  * Requires at least: 6.9.4
  * Requires at least: 6.9.4
  * Requires PHP: 8.2
  * Requires PHP: 8.2
  * Author: Dalibor Votruba
  * Author: Dalibor Votruba
@@ -21,7 +21,7 @@ if (!defined('WPINC')) {
     die;
     die;
 }
 }
 
 
-if (!defined('STUDIOU_WCFPP_VERSION')) define('STUDIOU_WCFPP_VERSION', '1.2.1');
+if (!defined('STUDIOU_WCFPP_VERSION')) define('STUDIOU_WCFPP_VERSION', '1.2.2');
 if (!defined('STUDIOU_WCFPP_PLUGIN_DIR')) define('STUDIOU_WCFPP_PLUGIN_DIR', plugin_dir_path(__FILE__));
 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_URL')) define('STUDIOU_WCFPP_PLUGIN_URL', plugin_dir_url(__FILE__));
 if (!defined('STUDIOU_WCFPP_PLUGIN_BASENAME')) define('STUDIOU_WCFPP_PLUGIN_BASENAME', plugin_basename(__FILE__));
 if (!defined('STUDIOU_WCFPP_PLUGIN_BASENAME')) define('STUDIOU_WCFPP_PLUGIN_BASENAME', plugin_basename(__FILE__));

+ 13 - 6
studiou-wc-free-photo-product/views/single-product-upload.php

@@ -9,12 +9,19 @@ if (!defined('WPINC')) {
 <div class="studiou-fpp-upload-wrap" data-product-id="<?php echo esc_attr($product_id); ?>" data-max-file-size="<?php echo esc_attr($max_file_size); ?>">
 <div class="studiou-fpp-upload-wrap" data-product-id="<?php echo esc_attr($product_id); ?>" data-max-file-size="<?php echo esc_attr($max_file_size); ?>">
 
 
     <h3><?php esc_html_e('Upload Your Photo', 'studiou-wc-free-photo-product'); ?></h3>
     <h3><?php esc_html_e('Upload Your Photo', 'studiou-wc-free-photo-product'); ?></h3>
-    <p class="studiou-fpp-upload-info">
-        <?php echo esc_html(sprintf(
-            __('Maximum file size: %s MB. Accepted formats: JPEG, PNG, TIFF, BMP, PSD, RAW (CR2, NEF, ARW, DNG, ORF, RW2, RAF), WebP.', 'studiou-wc-free-photo-product'),
-            $max_file_size
-        )); ?>
-    </p>
+    <?php
+    $custom_info = Studiou_WC_FPP_Product::get_product_upload_info_text($product_id);
+    if (!empty($custom_info)) :
+    ?>
+        <p class="studiou-fpp-upload-info"><?php echo nl2br(esc_html($custom_info)); ?></p>
+    <?php else : ?>
+        <p class="studiou-fpp-upload-info">
+            <?php echo esc_html(sprintf(
+                __('Maximum file size: %s MB. Accepted formats: JPEG, PNG, TIFF, BMP, PSD, RAW (CR2, NEF, ARW, DNG, ORF, RW2, RAF), WebP.', 'studiou-wc-free-photo-product'),
+                $max_file_size
+            )); ?>
+        </p>
+    <?php endif; ?>
 
 
     <div class="studiou-fpp-upload-area" id="studiou-fpp-dropzone">
     <div class="studiou-fpp-upload-area" id="studiou-fpp-dropzone">
         <div class="studiou-fpp-upload-prompt">
         <div class="studiou-fpp-upload-prompt">