Plugin Directory

Changeset 3410172


Ignore:
Timestamp:
12/03/2025 09:57:36 PM (4 months ago)
Author:
pokhar
Message:

Release Version 1.4.5

Location:
whistleblowing-system/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • whistleblowing-system/trunk/admin/Controller.php

    r3404400 r3410172  
    6969        $email_options = array();
    7070        if ( isset($_POST['email_options']) && is_array($_POST['email_options']) ) {
    71             $email_options = map_deep(wp_unslash($_POST['email_options']), 'sanitize_text_field');
     71            $email_options = map_deep(wp_unslash($_POST['email_options']), function($value) {
     72                return wp_kses($value, WBLSLibrary::$wp_kses_default);
     73            });
    7274        }
    7375
  • whistleblowing-system/trunk/admin/assets/js/edit.js

    r3404400 r3410172  
    976976            stop() {
    977977                self.columns_refresh();
     978                self.update_fields_order();
    978979            }
    979980        }).disableSelection();
    980981    }
     982
     983    /**
     984     * Goes through all .wblsform-row elements in the DOM (in visual order)
     985     * and updates fields_options[fieldId].order = index (0, 1, 2, ...)
     986     */
     987    update_fields_order() {
     988        let orderIndex = 0;
     989        const self = this;
     990
     991        jQuery(".wblsform-row").each(function() {
     992
     993            // Get the field ID from data-field-id
     994            const idAttr = jQuery(this).attr("data-field-id");
     995
     996            if (typeof idAttr === "undefined") {
     997                // If no ID, skip this element
     998                return;
     999            }
     1000
     1001            // Convert ID to string (fields_options keys may be strings)
     1002            const fieldId = String(idAttr);
     1003
     1004            // Update the order in fields_options if the field exists
     1005            if (self.fields_options && typeof self.fields_options[fieldId] !== "undefined") {
     1006
     1007                self.fields_options[fieldId].order = orderIndex;
     1008
     1009            } else {
     1010                // If fields_options is using numeric keys, try numeric conversion
     1011                const numericId = parseInt(fieldId, 10);
     1012
     1013                if (
     1014                    !isNaN(numericId) &&
     1015                    Array.isArray(self.fields_options) &&
     1016                    typeof self.fields_options[numericId] !== "undefined"
     1017                ) {
     1018                    self.fields_options[numericId].order = orderIndex;
     1019                } else {
     1020                    // Field not found in fields_options (optional debug)
     1021                    // console.warn('Field not found in fields_options:', fieldId);
     1022                }
     1023            }
     1024
     1025            // Optional: update DOM attribute for debugging
     1026            jQuery(this).attr('data-field-order', orderIndex);
     1027
     1028            orderIndex++;
     1029        });
     1030
     1031        // Optionally sort fields_options by order here
     1032        // Or trigger a save (AJAX) call if needed
     1033    }
     1034
    9811035
    9821036    columns_refresh() {
  • whistleblowing-system/trunk/config.php

    r3404400 r3410172  
    55
    66if (!defined('WBLS_VERSION')) {
    7     define('WBLS_VERSION', '1.4.4');
     7    define('WBLS_VERSION', '1.4.5');
    88}
    99if (!defined('WBLS_PREFIX')) {
  • whistleblowing-system/trunk/frontend/Controller.php

    r3404400 r3410172  
    541541        }
    542542
     543        // Reorder form fields as in html view using order setting in the field data
     544        if (!empty($this->form_data)) {
     545            // Sort array by 'order' value ascending
     546            usort($this->form_data, function($a, $b) {
     547                // If 'order' is missing, treat as 0
     548                $orderA = isset($a['order']) ? (int)$a['order'] : 0;
     549                $orderB = isset($b['order']) ? (int)$b['order'] : 0;
     550
     551                return $orderA <=> $orderB;
     552            });
     553        }
     554
    543555
    544556        foreach ($this->form_data as $data ) {
  • whistleblowing-system/trunk/library.php

    r3398357 r3410172  
    123123            'style' => array(),
    124124        ),
    125 
     125        'br' => array(),
     126        'hr' => array(
     127                'class' => array(),
     128                'id' => array(),
     129                'style' => array(),
     130        ),
    126131    );
    127132
  • whistleblowing-system/trunk/readme.txt

    r3404400 r3410172  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 1.4.4
     7Stable tag: 1.4.5
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    140140
    141141== Changelog ==
     142= 1.4.5 =
     143Fixed: Form fields ordering in the email
     144
    142145= 1.4.4 =
    143146Added: Status changed in logs
  • whistleblowing-system/trunk/whistleblowing.php

    r3404400 r3410172  
    44 * Plugin URI:  https://whistleblowing-form.de
    55 * Description: Whistleblowing system form is the ultimate solution for effortlessly creating and managing contact and whistleblowing forms.
    6  * Version:     1.4.4
     6 * Version:     1.4.5
    77 * Author:      Whistleblowing System Team
    88 * Author URI:  https://whistleblowing-form.de
Note: See TracChangeset for help on using the changeset viewer.