Plugin Directory

Changeset 3428672


Ignore:
Timestamp:
12/28/2025 04:46:44 PM (3 months ago)
Author:
surflabtech
Message:

v2.2.5

Location:
surflink
Files:
301 added
6 edited

Legend:

Unmodified
Added
Removed
  • surflink/trunk/includes/class-surfl-fast-sr.php

    r3428130 r3428672  
    154154
    155155    private function replace_value( $value, $search, $replace ) {
    156         $found = ( $this->case_insensitive ? stripos( (string) $value, $search ) : strpos( (string) $value, $search ) );
     156        // Ensure inputs are strings
     157        $value_str = (string) $value;
     158        // Use mb_stripos for UTF-8 aware position check
     159        if ( $this->case_insensitive ) {
     160            $found = mb_stripos( $value_str, $search );
     161        } else {
     162            $found = mb_strpos( $value_str, $search );
     163        }
    157164        if ( $found === false ) {
    158165            return $value;
     
    181188            }
    182189        }
    183         $data = ( $this->case_insensitive ? str_ireplace( $search, $replace, $value ) : str_replace( $search, $replace, $value ) );
    184         $data !== $value && $this->collect_contents( $value, $data );
     190        // MULTILINGUAL & UTF-8 COMPATIBILITY
     191        if ( $this->case_insensitive ) {
     192            // Quote the search string so regex characters (like ., *, +) are treated as text
     193            $quoted_search = preg_quote( $search, '/' );
     194            // 'u' modifier = UTF-8, 'i' modifier = Case Insensitive
     195            $data = preg_replace( '/' . $quoted_search . '/iu', $replace, $value_str );
     196        } else {
     197            // Standard str_replace is usually fine for Case-Sensitive UTF-8
     198            $data = str_replace( $search, $replace, $value_str );
     199        }
     200        if ( $data !== $value ) {
     201            $this->collect_contents( $value, $data );
     202        }
    185203        // Collect contents if modified
    186204        return $data;
     
    477495        } elseif ( is_string( $data ) ) {
    478496            $original = $data;
    479             $data = ( $insensitive ? str_ireplace( $search, $replace, $data ) : str_replace( $search, $replace, $data ) );
     497            if ( $insensitive ) {
     498                // UTF-8 Safe Case Insensitive Replace
     499                $quoted_search = preg_quote( $search, '/' );
     500                $data = preg_replace( '/' . $quoted_search . '/iu', $replace, $data );
     501            } else {
     502                $data = str_replace( $search, $replace, $data );
     503            }
    480504            if ( $data !== $original ) {
    481505                self::log( "serialized value: " . $original . ' => ' . $data );
     
    516540            return $count;
    517541        }
    518         return ( $this->case_insensitive ? substr_count( strtolower( (string) $data ), strtolower( $search ) ) : substr_count( (string) $data, $search ) );
     542        $string_data = (string) $data;
     543        if ( $this->case_insensitive ) {
     544            // Use mb_substr_count with mb_strtolower for UTF-8 safety
     545            // Requires 'mbstring' extension (Standard in WP environments)
     546            if ( function_exists( 'mb_strtolower' ) && function_exists( 'mb_substr_count' ) ) {
     547                return mb_substr_count( mb_strtolower( $string_data, 'UTF-8' ), mb_strtolower( $search, 'UTF-8' ), 'UTF-8' );
     548            }
     549            // Fallback if mbstring is missing (rare)
     550            return mb_substr_count( $string_data, $search, 'UTF-8' );
     551        }
     552        return substr_count( $string_data, $search );
    519553    }
    520554
  • surflink/trunk/readme.txt

    r3428366 r3428672  
    66**Requires PHP:** 7.4   
    77**Tested up to:** 6.9 
    8 **Stable tag:** 2.2.4 
     8**Stable tag:** 2.2.5 
    99**License:** GPLv3 or later 
    1010**License URI:** https://opensource.org/licenses/GPL-3.0 
     
    134134== Changelog ==
    135135
    136 ### 2.2.3
     136= 2.2.5 =
     137* Improved: Search & Replace now fully supports UTF-8, Emojis, and all international languages.
     138* Fixed: Case-insensitive matching for accented characters.
     139
     140### 2.2.4
    137141* **fix:** Side nav bar bug fixed.
    138142* **update:** minor css fixed.
  • surflink/trunk/surf-link.php

    r3428366 r3428672  
    77 * Author: SurfLab
    88 * Author URI: https://surflabtech.com
    9  * Version: 2.2.4
     9 * Version: 2.2.5
    1010 * Text Domain: surflink
    1111 * License: GPL-3.0-or-later
     
    6767    }
    6868    if ( !defined( 'SURFL_VERSION' ) ) {
    69         define( 'SURFL_VERSION', '2.2.4' );
     69        define( 'SURFL_VERSION', '2.2.5' );
    7070    }
    7171    if ( !defined( 'SURFL_PLUGIN' ) ) {
     
    9999        }
    100100        if ( !defined( 'SURFL_VERSION' ) ) {
    101             define( 'SURFL_VERSION', '2.2.4' );
     101            define( 'SURFL_VERSION', '2.2.5' );
    102102        }
    103103        if ( is_multisite() ) {
  • surflink/trunk/templates/surfl-410-list.php

    r3428366 r3428672  
    141141                    <p> <strong id="surfl-410-import-sample"
    142142                            style="cursor:pointer;text-decoration: underline;z-index: 999; position: relative;">Download</strong>
    143                         sample
     143                        sample csv
    144144                        file
    145145                    </p>
  • surflink/trunk/templates/surfl-redirect-list-html.php

    r3428366 r3428672  
    290290                    <p> <strong id="surfl-red-import-sample"
    291291                            style="cursor:pointer;text-decoration: underline;z-index: 999; position: relative;">Download</strong>
    292                         sample
     292                        sample csv
    293293                        file
    294294                    </p>
  • surflink/trunk/templates/surfl-shortlink-list-html.php

    r3428366 r3428672  
    538538                <p> <strong id="surfl-shortlink-import-sample"
    539539                        style="cursor:pointer;text-decoration: underline;z-index: 999; position: relative;">Download</strong>
    540                     sample
     540                    sample csv
    541541                    file
    542542                </p>
Note: See TracChangeset for help on using the changeset viewer.