Plugin Directory

Changeset 3375423


Ignore:
Timestamp:
10/09/2025 04:14:17 AM (6 months ago)
Author:
codemenschen
Message:

Version 4.5.8 - Released: October 08, 2025

  • Feature: Add Quotes suggestions for Personal Message (frontend & backend).
Location:
gift-voucher
Files:
975 added
10 edited

Legend:

Unmodified
Added
Removed
  • gift-voucher/trunk/assets/js/admin-script.js

    r3258145 r3375423  
    2727    });
    2828}
     29
     30(function () {
     31    var container = document.getElementById('wpgv-quotes-list');
     32    var addBtn = document.getElementById('wpgv-add-quote');
     33    if (!container || !addBtn) { return; }
     34    addBtn.addEventListener('click', function () {
     35        var div = document.createElement('div');
     36        div.className = 'wpgv-quote-row';
     37        div.style.cssText = 'display:flex;gap:8px;align-items:center;margin-bottom:6px;';
     38        div.innerHTML = '<input type="text" name="wpgv_quotes_item[]" value="" class="regular-text" style="flex:1;" />' +
     39            '<button class="button wpgv-remove-quote" type="button">&times;</button>';
     40        container.appendChild(div);
     41    });
     42    container.addEventListener('click', function (e) {
     43        if (e.target && e.target.classList.contains('wpgv-remove-quote')) {
     44            var row = e.target.closest('.wpgv-quote-row');
     45            if (row) { row.remove(); }
     46        }
     47    });
     48})();
  • gift-voucher/trunk/assets/js/item-script.js

    r3299113 r3375423  
    3232        $paynowbtnspan = $("#paynowbtn span"),
    3333        $totalpricespan = $("#totalprice span");
     34
     35    // Ensure any lists inside the gift items UI don't show bullets or left padding
     36    try {
     37        $('.wpgv-items, .wpgv-items-wrap, .wpgv-according-categories, .wpgv-according-category').find('ul').css({
     38            'list-style': 'none',
     39            'margin-left': '0',
     40            'padding-left': '0'
     41        }).addClass('wpgv-no-list');
     42    } catch (e) {
     43        // ignore
     44    }
    3445
    3546    $('.wpgv-according-category:not(:first-child)').addClass('catclose');
     
    365376        }
    366377    });
     378
     379    // Quotes click-to-fill and progressive "show more" for gift items message textarea
     380    try {
     381        var $quotesWrap = $('#wpgv-giftitems .voucher-quotes');
     382
     383        $quotesWrap.on('click', 'li.quote-item', function () {
     384            var text = $(this).text();
     385            $('#message').val(text).trigger('input').trigger('change').trigger('keyup');
     386        });
     387
     388        $quotesWrap.on('click', '.show-more-quotes', function (e) {
     389            e.preventDefault();
     390            var $btn = $(this);
     391            var shown = parseInt($btn.data('shown')) || 5;
     392            var step = parseInt($btn.data('step')) || 5;
     393            var $hidden = $quotesWrap.find('li.quote-item:hidden');
     394            $hidden.slice(0, step).fadeIn();
     395            shown += step;
     396            $btn.data('shown', shown);
     397            if ($quotesWrap.find('li.quote-item:hidden').length === 0) {
     398                $btn.hide();
     399            }
     400        });
     401    } catch (e) {
     402        // ignore if quotes area not present
     403    }
    367404});
  • gift-voucher/trunk/assets/js/voucher-script.js

    r3258145 r3375423  
    146146        $(".personalMessageCard").val(dInput);
    147147        $(".voucherMessageInfo").html(dInput);
     148    });
     149
     150    // Fill voucher message when clicking on quote suggestion items
     151    jQuery(document).on('click', '#voucher-multistep-form .voucher-quotes li', function (e) {
     152        e.preventDefault();
     153        var text = jQuery(this).text().trim();
     154        if (!text) return;
     155        jQuery('#voucherMessage').val(text).trigger('input').trigger('change').trigger('keyup');
     156        // highlight active in quotes list
     157        jQuery('#voucher-multistep-form .voucher-quotes li').removeClass('active');
     158        jQuery(this).addClass('active');
     159    });
     160
     161    // Show more quotes (reveal 5 per click)
     162    jQuery(document).on('click', '#voucher-multistep-form .voucher-quotes .show-more-quotes', function (e) {
     163        e.preventDefault();
     164        var $btn = jQuery(this);
     165        var step = parseInt($btn.data('step'), 10) || 5;
     166        var shown = parseInt($btn.data('shown'), 10) || 5;
     167        var $container = $btn.closest('.voucher-quotes');
     168        var $items = $container.find('li.quote-item');
     169        var total = $items.length;
     170
     171        var nextMax = Math.min(shown + step, total);
     172        $items.each(function (idx) {
     173            if (idx < nextMax) {
     174                jQuery(this).show();
     175            }
     176        });
     177
     178        $btn.data('shown', nextMax);
     179        if (nextMax >= total) {
     180            $btn.hide();
     181        }
    148182    });
    149183    $('#voucherFirstName').on('input blur', function () {
  • gift-voucher/trunk/assets/js/voucher-template-script.js

    r3299113 r3375423  
    2020    //show step
    2121    changeStepVoucher(step_template);
     22
     23    // Fill voucher description when clicking on suggestion items
     24    jQuery(document).on('click', '#giftvoucher-template .voucher-description-suggestions li', function (e) {
     25        e.preventDefault();
     26        var text = jQuery(this).text().trim();
     27        if (!text) return;
     28        voucher_description.val(text).trigger('input').trigger('change').trigger('keyup');
     29        // Optional: mark active item
     30        jQuery('#giftvoucher-template .voucher-description-suggestions li').removeClass('active');
     31        jQuery(this).addClass('active');
     32    });
     33
     34    // Fill voucher description when clicking on new quotes items
     35    jQuery(document).on('click', '#giftvoucher-template .voucher-quotes li', function (e) {
     36        e.preventDefault();
     37        var text = jQuery(this).text().trim();
     38        if (!text) return;
     39        voucher_description.val(text).trigger('input').trigger('change').trigger('keyup');
     40        // highlight active in quotes list
     41        jQuery('#giftvoucher-template .voucher-quotes li').removeClass('active');
     42        jQuery(this).addClass('active');
     43    });
     44
     45    // Show more quotes (reveal 5 per click)
     46    jQuery(document).on('click', '#giftvoucher-template .voucher-quotes .show-more-quotes', function (e) {
     47        e.preventDefault();
     48        var $btn = jQuery(this);
     49        var step = parseInt($btn.data('step'), 10) || 5;
     50        var shown = parseInt($btn.data('shown'), 10) || 5;
     51        var $container = $btn.closest('.voucher-quotes');
     52        var $items = $container.find('li.quote-item');
     53        var total = $items.length;
     54
     55        // Determine range to show: next [shown, shown+step)
     56        var nextMax = Math.min(shown + step, total);
     57        $items.each(function (idx) {
     58            if (idx < nextMax) {
     59                jQuery(this).show();
     60            }
     61        });
     62
     63        // Update counter, hide button if all visible
     64        $btn.data('shown', nextMax);
     65        if (nextMax >= total) {
     66            $btn.hide();
     67        }
     68    });
    2269
    2370    function sliderVoucherTemplate(number_slider) {
  • gift-voucher/trunk/front.php

    r3258145 r3375423  
    338338            </div>
    339339            ' . $buying_for_html . '
    340             <div class="form-group">
    341                 <label for="voucherAmount">' . __('Voucher Value', 'gift-voucher') . ' ' . esc_html($minVoucherValueMsg) . '<sup>*</sup></label>
    342                 <span class="currencySymbol"> ' . esc_html($setting_options->currency) . ' </span>
    343                 <input type="number" name="voucherAmount" id="voucherAmount" class="required" min="' . esc_html($minVoucherValue) . '" max="' . esc_html($maxVoucherValue) . '">
    344             </div>
    345             <div class="form-group">
    346                 <label for="voucherMessage">' . __('Personal Message (Optional)', 'gift-voucher') . ' (' . __('Max: 250 Characters', 'gift-voucher') . ')</label>
    347                 <textarea name="voucherMessage" id="voucherMessage" maxlength="250"></textarea>
    348                 <div class="maxchar"></div>
    349             </div>
    350         </div>
     340            <div class="form-group">
     341                <label for="voucherAmount">' . __('Voucher Value', 'gift-voucher') . ' ' . esc_html($minVoucherValueMsg) . '<sup>*</sup></label>
     342                <span class="currencySymbol"> ' . esc_html($setting_options->currency) . ' </span>
     343                <input type="number" name="voucherAmount" id="voucherAmount" class="required" min="' . esc_html($minVoucherValue) . '" max="' . esc_html($maxVoucherValue) . '">
     344            </div>
     345            <div class="form-group">
     346                <label for="voucherMessage">' . __('Personal Message (Optional)', 'gift-voucher') . ' (' . __('Max: 250 Characters', 'gift-voucher') . ')</label>
     347                <textarea name="voucherMessage" id="voucherMessage" maxlength="250"></textarea>
     348                <div class="maxchar"></div>';
     349
     350    // prepare border color and zebra backgrounds for quote items
     351    $voucher_brcolor_hex = ltrim($voucher_brcolor, '#');
     352    if (strlen($voucher_brcolor_hex) === 3) {
     353        $voucher_brcolor_hex = $voucher_brcolor_hex[0] . $voucher_brcolor_hex[0]
     354            . $voucher_brcolor_hex[1] . $voucher_brcolor_hex[1]
     355            . $voucher_brcolor_hex[2] . $voucher_brcolor_hex[2];
     356    }
     357    $r = hexdec(substr($voucher_brcolor_hex, 0, 2));
     358    $g = hexdec(substr($voucher_brcolor_hex, 2, 2));
     359    $b = hexdec(substr($voucher_brcolor_hex, 4, 2));
     360    $li_bg1 = "background-color: rgba($r,$g,$b,0.08);";
     361    $li_bg2 = "background-color: rgba($r,$g,$b,0.16);";
     362
     363    // Load quotes (JSON) so we can render suggestions
     364    $quotes_raw = get_option('wpgv_quotes', '');
     365    $quotes = array();
     366    if (!empty($quotes_raw)) {
     367        $decoded = json_decode($quotes_raw, true);
     368        if (is_array($decoded)) {
     369            $quotes = $decoded;
     370        }
     371    }
     372    $has_quotes = !empty($quotes);
     373
     374    $html .= '<div class="voucher-quotes" id="voucher-quotes" style="font-size: 12px;margin: 5px 0 0; font-style: italic;' . ($has_quotes ? '' : ' display:none;') . '">
     375            <span>' . __('Quotes:', 'gift-voucher') . '</span>
     376            <style>
     377              /* spacing and hover effect for voucher description suggestions */
     378              #voucher-multistep-form .voucher-quotes ul li {
     379                margin: 5px 0;
     380                cursor: pointer;
     381              }
     382              #voucher-multistep-form .voucher-quotes ul li:hover {
     383                box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
     384              }
     385              #voucher-multistep-form .voucher-quotes .show-more-quotes {
     386                display: inline-block; margin-top: 6px; font-style: normal; cursor: pointer; color: #0073aa;
     387              }
     388              #voucher-multistep-form .voucher-quotes .show-more-quotes:hover {
     389                text-decoration: underline;
     390              }
     391            </style>
     392            <ul style="margin: 5px 0 0 18px; padding: 0;">';
     393    if (!empty($quotes)) {
     394        $total_quotes = count($quotes);
     395        foreach ($quotes as $i => $qtext) {
     396            $zebra = ($i % 2 === 0) ? $li_bg1 : $li_bg2;
     397            $hidden = ($i >= 5) ? 'display:none;' : '';
     398            $html .= '<li class="quote-item" style="' . $zebra . ' ' . $hidden . ' padding: 4px 6px; list-style: none;border-left: 3px solid #' . $voucher_brcolor_hex . '; border-radius: 3px; cursor: pointer;">' . esc_html($qtext) . '</li>';
     399        }
     400    }
     401    $html .= '</ul>';
     402    if (!empty($quotes) && $total_quotes > 5) {
     403        $html .= '<a href="javascript:;" class="show-more-quotes" data-shown="5" data-step="5">' . __('Show more', 'gift-voucher') . '</a>';
     404    }
     405    $html .= '</div>
     406            </div>
     407        </div>
    351408        ' . $voucherstyle . '
    352         </div>
    353     </fieldset>
    354 
    355     <h3>' . __('Payment', 'gift-voucher') . '</h3>
     409        </div>
     410    </fieldset>';
     411
     412    $html .= '<h3>' . __('Payment', 'gift-voucher') . '</h3>
    356413    <fieldset>
    357         <legend>' . __('Payment', 'gift-voucher') . '</legend><div class="voucher-row">';
     414        <legend>' . __('Payment', 'gift-voucher') . '</legend><div class="voucher-row">';
    358415
    359416    if ($setting_options->post_shipping) {
  • gift-voucher/trunk/gift-voucher.php

    r3357576 r3375423  
    77 * Author: Codemenschen GmbH
    88 * Author URI: https://www.codemenschen.at/
    9  * Version: 4.5.7
     9 * Version: 4.5.8
    1010 * Text Domain: gift-voucher
    1111 * Domain Path: /languages
     
    2323if (!defined('ABSPATH')) exit;  // Exit if accessed directly
    2424
    25 define('WPGIFT_VERSION', '4.5.7');
     25define('WPGIFT_VERSION', '4.5.8');
    2626define('WPGIFT__MINIMUM_WP_VERSION', '4.0');
    2727define('WPGIFT__PLUGIN_DIR', untrailingslashit(plugin_dir_path(__FILE__)));
     
    153153  }
    154154
     155  // Seed default quotes JSON if not exists
     156  $existing_quotes = get_option('wpgv_quotes', '');
     157  if ($existing_quotes === '' || $existing_quotes === false) {
     158    $default_quotes = array(
     159      __('Happy Birthday! Wishing you a day filled with joy and laughter.', 'gift-voucher'),
     160      __('Congratulations on your special day! Enjoy this little treat.', 'gift-voucher'),
     161      __('Thank you for everything you do. Hope you love this gift!', 'gift-voucher'),
     162      __('Wishing you all the best—may this gift bring a smile to your face!', 'gift-voucher'),
     163      __('With love and warm wishes—enjoy every moment!', 'gift-voucher'),
     164    );
     165    update_option('wpgv_quotes', wp_json_encode($default_quotes));
     166  }
    155167
    156168  if (!current_user_can('manage_options')) {
  • gift-voucher/trunk/giftcard.php

    r3299113 r3375423  
    343343{
    344344    $setting_options = get_data_settings_voucher();
    345     $html = '<div class="voucher-template-input price-voucher">
    346         <label>' . __('Gift Value', 'gift-voucher') . '</label>
    347         <div class="price-template-voucher">
    348             <span class="currencySymbol"> ' . $setting_options->currency . ' </span>
    349             <input type="number" name="voucher_price_value" id="voucher_price_value" class="input-info-voucher" value="">
    350         </div>
    351         <span class="error-input">' . __('This field is required.', 'gift-voucher') . '</span>
     345    $html  = '<div class="voucher-template-input price-voucher">
     346    <label>' . __('Gift Value', 'gift-voucher') . '</label>
     347    <div class="price-template-voucher">
     348        <span class="currencySymbol"> ' . $setting_options->currency . ' </span>
     349        <input type="number" name="voucher_price_value" id="voucher_price_value" class="input-info-voucher" value="">
    352350    </div>
    353     <div class="voucher-template-input">
    354         <label>' . __('Gift To', 'gift-voucher') . '</label>
    355         <input maxlength="30" value="" id="voucher_gift_to" placeholder="' . __('Gift To', 'gift-voucher') . '" name="voucher_gift_to" type="text" class="input-info-voucher">
    356         <span class="error-input">' . __('This field is required.', 'gift-voucher') . '</span>
    357     </div>
    358     <div class="voucher-template-input">
    359         <label>' . __('Gift From', 'gift-voucher') . '</label>
    360         <input maxlength="30" value="" id="voucher_gift_from" placeholder="' . __('Gift From', 'gift-voucher') . '" name="voucher_gift_from" type="text" class="input-info-voucher">
    361         <span class="error-input">' . __('This field is required.', 'gift-voucher') . '</span>
    362     </div>
    363     <div class="voucher-template-input">
     351    <span class="error-input">' . __('This field is required.', 'gift-voucher') . '</span>
     352</div>';
     353
     354    $html .= '<div class="voucher-template-input">
     355    <label>' . __('Gift To', 'gift-voucher') . '</label>
     356    <input maxlength="30" value="" id="voucher_gift_to" placeholder="' . __('Gift To', 'gift-voucher') . '" name="voucher_gift_to" type="text" class="input-info-voucher">
     357    <span class="error-input">' . __('This field is required.', 'gift-voucher') . '</span>
     358</div>';
     359
     360    $html .= '<div class="voucher-template-input">
     361    <label>' . __('Gift From', 'gift-voucher') . '</label>
     362    <input maxlength="30" value="" id="voucher_gift_from" placeholder="' . __('Gift From', 'gift-voucher') . '" name="voucher_gift_from" type="text" class="input-info-voucher">
     363    <span class="error-input">' . __('This field is required.', 'gift-voucher') . '</span>
     364</div>';
     365
     366    $voucher_brcolor = get_option('wpgv_voucher_border_color') ? get_option('wpgv_voucher_border_color') : '1371ff';
     367    $voucher_brcolor_hex = ltrim($voucher_brcolor, '#');
     368    if (strlen($voucher_brcolor_hex) === 3) {
     369        $voucher_brcolor_hex = $voucher_brcolor_hex[0] . $voucher_brcolor_hex[0]
     370            . $voucher_brcolor_hex[1] . $voucher_brcolor_hex[1]
     371            . $voucher_brcolor_hex[2] . $voucher_brcolor_hex[2];
     372    }
     373    $r = hexdec(substr($voucher_brcolor_hex, 0, 2));
     374    $g = hexdec(substr($voucher_brcolor_hex, 2, 2));
     375    $b = hexdec(substr($voucher_brcolor_hex, 4, 2));
     376    $li_bg1 = "background-color: rgba($r,$g,$b,0.08);";
     377    $li_bg2 = "background-color: rgba($r,$g,$b,0.16);";
     378
     379    // Load quotes (JSON) early so we can decide visibility
     380    $quotes_raw = get_option('wpgv_quotes', '');
     381    $quotes = array();
     382    if (!empty($quotes_raw)) {
     383        $decoded = json_decode($quotes_raw, true);
     384        if (is_array($decoded)) {
     385            $quotes = $decoded;
     386        }
     387    }
     388    $has_quotes = !empty($quotes);
     389
     390    $html .= '<div class="voucher-template-input">
    364391        <label>' . __('Description (Max: 250 Characters)', 'gift-voucher') . '</label>
    365392        <textarea maxlength="250" value="" id="voucher_description" placeholder="' . __('Description (Max: 250 Characters)', 'gift-voucher') . '" name="voucher_description" class="input-info-voucher"></textarea>
    366393        <div class="maxchar"></div>
     394        <div class="voucher-quotes" id="voucher-quotes" style="font-size: 12px;margin: 5px 0 0; font-style: italic;' . ($has_quotes ? '' : ' display:none;') . '">
     395            <span>' . __('Quotes:', 'gift-voucher') . '</span>
     396            <style>
     397              /* spacing and hover effect for voucher description suggestions */
     398              #giftvoucher-template .voucher-quotes ul li {
     399                margin: 5px 0;
     400                cursor: pointer;
     401              }
     402              #giftvoucher-template .voucher-quotes ul li:hover {
     403                box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
     404              }
     405              #giftvoucher-template .voucher-quotes .show-more-quotes {
     406                display: inline-block; margin-top: 6px; font-style: normal; cursor: pointer; color: #0073aa;
     407              }
     408              #giftvoucher-template .voucher-quotes .show-more-quotes:hover {
     409                text-decoration: underline;
     410              }
     411            </style>
     412            <ul style="margin: 5px 0 0 18px; padding: 0;">
     413            ';
     414    if (!empty($quotes)) {
     415        $total_quotes = count($quotes);
     416        foreach ($quotes as $i => $qtext) {
     417            $zebra = ($i % 2 === 0) ? $li_bg1 : $li_bg2;
     418            $hidden = ($i >= 5) ? 'display:none;' : '';
     419            $html .= '<li class="quote-item" style="' . $zebra . ' ' . $hidden . ' padding: 4px 6px; border-left: 3px solid #' . $voucher_brcolor_hex . '; border-radius: 3px; cursor: pointer;">' . esc_html($qtext) . '</li>';
     420        }
     421    }
     422    $html .= '
     423            </ul>
     424';
     425    if (!empty($quotes) && $total_quotes > 5) {
     426        $html .= '<a href="javascript:;" class="show-more-quotes" data-shown="5" data-step="5">' . __('Show more', 'gift-voucher') . '</a>';
     427    }
     428    $html .= '
     429        </div>
    367430    </div>';
     431
    368432    return $html;
    369433}
  • gift-voucher/trunk/giftitems.php

    r3258145 r3375423  
    161161        #wpgv-giftitems.loading:after {
    162162            content: url(' . $custom_loader . ') !important;
     163        }
     164        /* Reset list style for any lists inside gift items UI */
     165        .wpgv-items ul,
     166        .wpgv-according-categories ul,
     167        .wpgv-according-category ul,
     168        .wpgv-items-wrap ul {
     169            list-style: none !important;
     170            margin-left: 0 !important;
     171            padding-left: 0 !important;
     172        }
     173        .wpgv-items li,
     174        .wpgv-according-category li {
     175            list-style: none !important;
    163176        }
    164177    </style>';
     
    312325                    <label for="message">' . __('Personal Message (Optional)', 'gift-voucher') . ' (' . __('Max: 250 Characters', 'gift-voucher') . ')</label>
    313326                    <span class="error">' . __('Please enter no more than 250 characters.', 'gift-voucher') . '</span>
    314                     <textarea name="message" id="message" class="form-field" maxlength="250"></textarea>
    315                     <div class="maxchar"></div>
     327                                        <textarea name="message" id="message" class="form-field" maxlength="250"></textarea>
     328                                        <div class="maxchar"></div>';
     329
     330        // prepare border color and zebra backgrounds for quote items
     331        $voucher_brcolor = get_option('wpgv_voucher_border_color') ? get_option('wpgv_voucher_border_color') : '81c6a9';
     332        $voucher_brcolor_hex = ltrim($voucher_brcolor, '#');
     333        if (strlen($voucher_brcolor_hex) === 3) {
     334                $voucher_brcolor_hex = $voucher_brcolor_hex[0] . $voucher_brcolor_hex[0]
     335                        . $voucher_brcolor_hex[1] . $voucher_brcolor_hex[1]
     336                        . $voucher_brcolor_hex[2] . $voucher_brcolor_hex[2];
     337        }
     338        $r = hexdec(substr($voucher_brcolor_hex, 0, 2));
     339        $g = hexdec(substr($voucher_brcolor_hex, 2, 2));
     340        $b = hexdec(substr($voucher_brcolor_hex, 4, 2));
     341        $li_bg1 = "background-color: rgba($r,$g,$b,0.08);";
     342        $li_bg2 = "background-color: rgba($r,$g,$b,0.16);";
     343
     344        // Load quotes (JSON)
     345        $quotes_raw = get_option('wpgv_quotes', '');
     346        $quotes = array();
     347        if (!empty($quotes_raw)) {
     348                $decoded = json_decode($quotes_raw, true);
     349                if (is_array($decoded)) {
     350                        $quotes = $decoded;
     351                }
     352        }
     353        $has_quotes = !empty($quotes);
     354
     355        $html .= '<div class="voucher-quotes" id="wpgv-voucher-quotes" style="font-size: 12px;margin: 5px 0 0; font-style: italic;' . ($has_quotes ? '' : ' display:none;') . '">
     356                        <span>' . __('Quotes:', 'gift-voucher') . '</span>
     357                        <style>
     358                            /* spacing and hover effect for message suggestions */
     359                            #wpgv-giftitems .voucher-quotes ul li {
     360                                margin: 5px 0;
     361                                cursor: pointer;
     362                            }
     363                            #wpgv-giftitems .voucher-quotes ul li:hover {
     364                                box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
     365                            }
     366                            #wpgv-giftitems .voucher-quotes .show-more-quotes {
     367                                display: inline-block; margin-top: 6px; font-style: normal; cursor: pointer; color: #0073aa;
     368                            }
     369                            #wpgv-giftitems .voucher-quotes .show-more-quotes:hover {
     370                                text-decoration: underline;
     371                            }
     372                        </style>
     373                        <ul style="margin: 5px 0 0 18px; padding: 0;">';
     374        if (!empty($quotes)) {
     375                $total_quotes = count($quotes);
     376                foreach ($quotes as $i => $qtext) {
     377                        $zebra = ($i % 2 === 0) ? $li_bg1 : $li_bg2;
     378                        $hidden = ($i >= 5) ? 'display:none;' : '';
     379                        $html .= '<li class="quote-item" style="' . $zebra . ' ' . $hidden . ' padding: 4px 6px; border-left: 3px solid #' . $voucher_brcolor_hex . '; border-radius: 3px; cursor: pointer;">' . esc_html($qtext) . '</li>';
     380                }
     381        }
     382        $html .= '</ul>';
     383        if (!empty($quotes) && $total_quotes > 5) {
     384                $html .= '<a href="javascript:;" class="show-more-quotes" data-shown="5" data-step="5">' . __('Show more', 'gift-voucher') . '</a>';
     385        }
     386        $html .= '</div>
    316387                </div>
    317388                <div class="wpgv-buttons">
  • gift-voucher/trunk/include/voucher_settings.php

    r3306945 r3375423  
    8989    if (isset($_POST['voucher_style']) && is_array($_POST['voucher_style'])) {
    9090        $voucher_styles = array_map('sanitize_text_field', wp_unslash($_POST['voucher_style']));
     91    }
     92
     93    $quotes_items = isset($_POST['wpgv_quotes_item']) && is_array($_POST['wpgv_quotes_item']) ? (array) $_POST['wpgv_quotes_item'] : array();
     94    $quotes_clean = array();
     95    if (!empty($quotes_items)) {
     96        foreach ($quotes_items as $q) {
     97            $q = sanitize_text_field(wp_unslash($q));
     98            if ($q !== '') {
     99                $quotes_clean[] = $q;
     100            }
     101        }
    91102    }
    92103
     
    162173    update_option('wpgv_leftside_notice', $leftside_notice);
    163174
     175    if (!empty($quotes_clean)) {
     176        update_option('wpgv_quotes', wp_json_encode($quotes_clean));
     177    } else {
     178        update_option('wpgv_quotes', wp_json_encode(array()));
     179    }
     180
    164181    if ($stripe && !get_option('wpgv_stripesuccesspage')) {
    165182        $stripeSuccessPage = array(
     
    264281                        <a class="nav-tab" href="#email"><?php echo esc_html_e('Email Settings', 'gift-voucher') ?></a>
    265282                        <a class="nav-tab" href="#custom"><?php echo esc_html_e('Custom CSS', 'gift-voucher') ?></a>
     283                        <a class="nav-tab" href="#quotes"><?php echo __('Quotes', 'gift-voucher') ?></a>
    266284                    </div>
    267285                    <form method="post" name="voucher-settings" id="voucher-settings" action="<?php echo esc_url(admin_url('admin.php')); ?>?page=voucher-setting">
     
    11391157                            </tbody>
    11401158                        </table>
     1159
     1160                        <?php
     1161                        // Load quotes option for UI
     1162                        $quotes_option_raw = get_option('wpgv_quotes', '');
     1163                        $quotes_option = array();
     1164                        if (!empty($quotes_option_raw)) {
     1165                            $decoded = json_decode($quotes_option_raw, true);
     1166                            if (is_array($decoded)) {
     1167                                $quotes_option = $decoded;
     1168                            }
     1169                        }
     1170                        ?>
     1171                        <table class="form-table tab-content" id="quotes">
     1172                            <tbody>
     1173                                <tr>
     1174                                    <th colspan="2" style="padding-bottom:0;padding-top: 0;">
     1175                                        <h3><?php echo __('Quotes (Suggestions for message)', 'gift-voucher'); ?></h3>
     1176                                        <p class="description"><?php echo __('Manage the list of quotes shown under the Description field on the frontend.', 'gift-voucher'); ?></p>
     1177                                    </th>
     1178                                </tr>
     1179                                <tr>
     1180                                    <th scope="row">
     1181                                        <label><?php echo __('Quotes List', 'gift-voucher'); ?></label>
     1182                                        <p class="description"><?php echo __('Add, remove or edit quotes.', 'gift-voucher'); ?></p>
     1183                                    </th>
     1184                                    <td>
     1185                                        <div id="wpgv-quotes-list">
     1186                                            <?php if (!empty($quotes_option)) : ?>
     1187                                                <?php foreach ($quotes_option as $idx => $q) : ?>
     1188                                                    <div class="wpgv-quote-row" style="display:flex;gap:8px;align-items:center;margin-bottom:6px;">
     1189                                                        <input type="text" name="wpgv_quotes_item[]" value="<?php echo esc_attr($q); ?>" class="regular-text" style="flex:1;" />
     1190                                                        <button class="button wpgv-remove-quote" type="button">&times;</button>
     1191                                                    </div>
     1192                                                <?php endforeach; ?>
     1193                                            <?php else : ?>
     1194                                                <div class="wpgv-quote-row" style="display:flex;gap:8px;align-items:center;margin-bottom:6px;">
     1195                                                    <input type="text" name="wpgv_quotes_item[]" value="" class="regular-text" style="flex:1;" />
     1196                                                    <button class="button wpgv-remove-quote" type="button">&times;</button>
     1197                                                </div>
     1198                                            <?php endif; ?>
     1199                                        </div>
     1200                                        <p>
     1201                                            <button class="button button-secondary" type="button" id="wpgv-add-quote"><?php echo __('Add Quote', 'gift-voucher'); ?></button>
     1202                                        </p>
     1203                                    </td>
     1204                                </tr>
     1205                            </tbody>
     1206                        </table>
     1207
    11411208                        <p class="submit"><?php submit_button(__('Save Settings', 'gift-voucher'), 'primary', 'submit', false); ?></p>
    11421209                    </form>
  • gift-voucher/trunk/readme.txt

    r3357576 r3375423  
    33Tags: gift cards, gift certificates, gift voucher, premium vouchers, generate gift cards
    44Requires at least: 4.0
    5 Tested up to: 6.8.2
    6 Stable tag: 4.5.7
     5Tested up to: 6.8.3
     6Stable tag: 4.5.8
    77Requires PHP: 5.6
    88License: GPLv2 or later
     
    4747> * **EASY DESIGNING -** Design templates for different themes as ‘Birthday’, ‘New Year’, ‘Valentine’s day’, ‘Independence day’ etc.
    4848> * **POSTAL DELIVERY -** You can accept postal orders for your gift cards. If you want, you can turn on the ability for your customers to buy your own printed gift cards/certificates. So you can send gift cards via post basis directly to the recipient.
     49> * **INSPIRATIONAL QUOTES -** Enhance your gift cards with meaningful quotes! The plugin now includes a collection of inspirational quotes that customers can easily add to their personal messages. This feature provides suggested quotes for various occasions, making gift cards more thoughtful and personal.
    4950
    5051**Voucher Booking Forms**
     
    6768* Purchased gift card/voucher is sent to the recipient’s email address.
    6869* Add messages to be printed on the PDF  gift card/voucher.
     70* Access to inspirational quote suggestions to enhance personal messages on gift cards.
    6971* Redeem gift cards/vouchers using unique auto-generated coupon codes.
    7072* Multiple payment gateway integrations available such as Stripe, PayPal, Sofort Pay, and Bank Transfer.
     
    8688* Export all orders from order page.
    8789* Admin can set options like sender name, email, company name along with company details on templates from plugin settings.
     90* Manage and customize inspirational quotes collection for customer use in personal messages.
    8891* Admin can customize email templates both for itself and its customers.
    8992* Admin can also enable the postal delivery options for its customers.
     
    195198* Using Loco Translate plugin
    196199* Using the PoEdit platform
     200
     201= Can customers add inspirational quotes to their gift cards?
     202
     203Yes, the plugin now includes a collection of inspirational quotes that customers can easily select and add to their personal messages when creating gift cards. This feature helps make gift cards more meaningful and personal for special occasions.
    197204
    198205== Documentation ==
     
    218225
    219226== Changelog ==
     227
     228= Version 4.5.8 - Released: October 08, 2025 =
     229* Feature: Add Quotes suggestions for Personal Message (frontend & backend).
    220230
    221231= Version 4.5.7 - Released: September 08 2025
Note: See TracChangeset for help on using the changeset viewer.