Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

normalize_keyword()

Description

Normalize the text if function available

Some languages consider characters with accents to be different characters
and therefore order them after z and other consider them to be the same as the
character without the accent.
See https://www.php.net/manual/en/class.normalizer.php for more information

Parameters

ColumnTypeDefaultDescription
$keyword string Keyword to normalize
$user_language bool false Flag to enable normalizing based on the current user language.

Return

string Normalized keyword

Location

include/language_functions.php lines 351 to 367

Definition

 
function normalize_keyword ($keyword,bool $user_language false) {
    global 
$keywords_remove_diacritics,$language_normalize_mapping;
    if (
function_exists('normalizer_normalize')) {
        if (
$user_language && key_exists($GLOBALS["language"],$language_normalize_mapping)) {
            
$form $language_normalize_mapping[$GLOBALS["language"]];
        } else {
            
$form Normalizer::FORM_C;
        }

        
$keyword=normalizer_normalize($keyword,$form);
    }

    if (
$keywords_remove_diacritics) {
        
$keyword=remove_accents($keyword);
    }
    return 
$keyword;
}

This article was last updated 17th November 2024 15:05 Europe/London time based on the source file dated 28th October 2024 11:15 Europe/London time.