Plugin Directory

Changeset 3264469


Ignore:
Timestamp:
03/31/2025 01:18:42 PM (12 months ago)
Author:
seuroficial
Message:

v2.2.23

Location:
seur/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • seur/trunk/core/functions/functions.php

    r3261412 r3264469  
    646646}
    647647
     648function str_ends_with_php7($haystack, $needle) {
     649    $length = strlen($needle);
     650    return $length > 0 ? substr($haystack, -$length) === $needle : false;
     651}
     652
    648653function matchPostcode($postcode, $rules) {
    649654    $rules = explode("\n", $rules); // Separar líneas en un array
     
    652657        $rule = trim($rule);
    653658
     659        if ($rule == '*') {
     660            return true;
     661        }
     662
    654663        // Comprobación por prefijo (ejemplo: 00*)
    655         if (str_ends_with($rule, '*')) {
     664        if (str_ends_with_php7($rule, '*')) {
    656665            $prefix = rtrim($rule, '*');
    657             if (strpos($postcode, $prefix) === 0) {
     666            if ($prefix && strpos($postcode, $prefix) === 0) {
    658667                return true; // Coincidencia con prefijo
    659668            }
     
    11281137function seur_clean_data( $out ) {
    11291138
    1130     $out = str_replace( 'Á', 'A', $out );
    1131     $out = str_replace( 'À', 'A', $out );
    1132     $out = str_replace( 'Ä', 'A', $out );
    1133     $out = str_replace( 'É', 'E', $out );
    1134     $out = str_replace( 'È', 'E', $out );
    1135     $out = str_replace( 'Ë', 'E', $out );
    1136     $out = str_replace( 'Í', 'I', $out );
    1137     $out = str_replace( 'Ì', 'I', $out );
    1138     $out = str_replace( 'Ï', 'I', $out );
    1139     $out = str_replace( 'Ó', 'O', $out );
    1140     $out = str_replace( 'Ò', 'O', $out );
    1141     $out = str_replace( 'Ö', 'O', $out );
    1142     $out = str_replace( 'Ú', 'U', $out );
    1143     $out = str_replace( 'Ù', 'U', $out );
    1144     $out = str_replace( 'Ü', 'U', $out );
    1145     $out = str_replace( '&', '-', $out );
    1146     $out = str_replace( '<', ' ', $out );
    1147     $out = str_replace( '>', ' ', $out );
    1148     $out = str_replace( '/', ' ', $out );
    1149     $out = str_replace( '"', ' ', $out );
    1150     $out = str_replace( "'", ' ', $out );
    1151     $out = str_replace( '"', ' ', $out );
    1152     $out = str_replace( '?', ' ', $out );
    1153     $out = str_replace( '¿', ' ', $out );
    1154 
    1155     return $out;
     1139    // Detecta y convierte a UTF-8 si es necesario
     1140    $encoding = mb_detect_encoding($out, ["UTF-8", "ISO-8859-1", "Windows-1252"], true);
     1141    if ($encoding !== "UTF-8") {
     1142        $out = mb_convert_encoding($out, "UTF-8", $encoding);
     1143    }
     1144
     1145    // Normaliza los caracteres especiales para evitar errores de codificación
     1146    $out = iconv('UTF-8', 'ASCII//TRANSLIT', $out);
     1147
     1148    // Sustituciones de caracteres específicos
     1149    $out = str_replace(['Á', 'À', 'Ä'], 'A', $out);
     1150    $out = str_replace(['É', 'È', 'Ë'], 'E', $out);
     1151    $out = str_replace(['Í', 'Ì', 'Ï'], 'I', $out);
     1152    $out = str_replace(['Ó', 'Ò', 'Ö'], 'O', $out);
     1153    $out = str_replace(['Ú', 'Ù', 'Ü'], 'U', $out);
     1154    $out = str_replace(['á', 'à', 'ä'], 'a', $out);
     1155    $out = str_replace(['é', 'è', 'ë'], 'e', $out);
     1156    $out = str_replace(['í', 'ì', 'ï'], 'i', $out);
     1157    $out = str_replace(['ó', 'ò', 'ö'], 'o', $out);
     1158    $out = str_replace(['ú', 'ù', 'ü'], 'u', $out);
     1159    $out = str_replace(['&', '<', '>', '/', '"', "'", '?', '¿'], ' ', $out);
     1160
     1161    return trim($out);
    11561162}
    11571163
  • seur/trunk/loader.php

    r3261412 r3264469  
    44 * Plugin URI: http://www.seur.com/
    55 * Description: Add SEUR shipping method to WooCommerce. The SEUR plugin for WooCommerce allows you to manage your order dispatches in a fast and easy way
    6  * Version: 2.2.22
     6 * Version: 2.2.23
    77 * Author: SEUR Oficial
    88 * Author URI: http://www.seur.com/
    9  * Tested up to: 6.6.2
     9 * Tested up to: 6.7.2
    1010 * WC requires at least: 3.0
    1111 * WC tested up to: 9.1.4
     
    2020use Automattic\WooCommerce\Utilities\FeaturesUtil;
    2121
    22 define( 'SEUR_OFFICIAL_VERSION', '2.2.22' );
     22define( 'SEUR_OFFICIAL_VERSION', '2.2.23' );
    2323define( 'SEUR_DB_VERSION', '1.0.5' );
    2424define( 'SEUR_TABLE_VERSION', '1.0.5' );
  • seur/trunk/readme.txt

    r3261412 r3264469  
    33Tags: woocommerce, shipping, seur, logistica, enviar paquete
    44Requires at least: 4.0
    5 Tested up to: 6.6.2
    6 Stable tag: 2.2.22
     5Tested up to: 6.7.2
     6Stable tag: 2.2.23
    77WC requires at least: 3.0
    88WC tested up to: 9.1.4
     
    9393
    9494== Changelog ==
     95
     96== 2.2.23 ==
     97
     98* FIXED: Clean special chars and force utf8 codification
     99* FIXED: Fix php7 compatibility
    95100
    96101== 2.2.22 ==
Note: See TracChangeset for help on using the changeset viewer.