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

i18n_get_indexable()

Description

For field names / values using the i18n syntax, return all language versions, as necessary for indexing.

Parameters

ColumnTypeDefaultDescription
$text string The text to process

Return

string

Location

include/language_functions.php lines 169 to 202

Definition

 
function i18n_get_indexable($text)
    {
    
// Make sure keywords don't get squashed together, then trim
    
$text=str_replace(array("<br />","<br>","\\r","\\n","&nbsp;")," ",$text);
    
$text=trim($text);
    
    
$text=preg_replace('/~(.*?):/',',',$text);// remove i18n strings, which shouldn't be in the keywords
        
    # For multiple keywords, parse each keyword.
    
if (substr($text,0,1)!="," && (strpos($text,",")!==false) && (strpos($text,"~")!==false)) {
        
$s=explode(",",$text);
        
$out="";
        for (
$n=0;$n<count($s);$n++) {
        if (
$n>0) {$out.=",";} 
        
$out.=i18n_get_indexable(trim($s[$n]));
        }
        return 
$out;
    }

    
# Split
    
$s=explode("~",$text);

    
# Not a translatable field?
    
if (count($s)<2) {return $text;}

    
$out="";
    for (
$n=1;$n<count($s);$n++)
        {
        if (
substr($s[$n],2,1)!=":") {return $text;}
        if (
$out!="") {$out.=",";}
        
$out.=substr($s[$n],3);
        }    
    return 
$out;
    }

This article was last updated 5th December 2024 08:05 Europe/London time based on the source file dated 27th November 2024 15:30 Europe/London time.