Admidio API
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Packages

  • com
    • tecnick
      • tcpdf
  • None
  • PHPMailer
    • easypeasyics
  • PHPWavUtils
  • Securimage
    • classes

Classes

  • AutoLogin
  • Component
  • ComponentUpdate
  • ConditionParser
  • Database
  • DateTimeExtended
  • Email
  • Folder
  • FormValidation
  • FunctionClass
  • Htaccess
  • HtmlDiv
  • HtmlElement
  • HtmlForm
  • HtmlFormBasic
  • HtmlFormInstallation
  • HtmlList
  • HtmlNavbar
  • HtmlPage
  • HtmlTable
  • HtmlTableBasic
  • Image
  • Inventory
  • InventoryFields
  • Language
  • LanguageData
  • ListConfiguration
  • Menu
  • Message
  • ModuleAnnouncements
  • ModuleDates
  • ModuleLists
  • ModuleMenu
  • ModuleMessages
  • Modules
  • ModuleWeblinks
  • MyFiles
  • Navigation
  • ntlm_sasl_client_class
  • Organization
  • Participants
  • PasswordHash
  • PasswordHashing
  • ProfileFields
  • RoleDependency
  • RolesRights
  • RSSfeed
  • Session
  • SystemMail
  • TableAccess
  • TableAnnouncement
  • TableCategory
  • TableDate
  • TableFile
  • TableFolder
  • TableGuestbook
  • TableGuestbookComment
  • TableInventory
  • TableInventoryField
  • TableLists
  • TableMembers
  • TableMessage
  • TablePhotos
  • TableRoles
  • TableRooms
  • TableText
  • TableUserField
  • TableUsers
  • TableWeblink
  • UploadHandlerDownload
  • UploadHandlerPhoto
  • User
  • UserRegistration

Exceptions

  • AdmException
  • WavFileException
  • WavFormatException

Functions

  • admFuncAutoload
  • admFuncGeneratePagination
  • admFuncGetBytesFromSize
  • admFuncGetDirectoryEntries
  • admFuncMaxUploadSize
  • admFuncProcessableImageSize
  • admFuncShowCreateChangeInfoById
  • admFuncShowCreateChangeInfoByName
  • admFuncVariableIsValid
  • admReadTemplateFile
  • admStrIsValidFileName
  • admStrStripTagsSpecial
  • admStrToLower
  • admStrToUpper
  • bzip2Version
  • checkDatabaseVersion
  • checkPhpVersion
  • EmailAttachment
  • FileSizeNiceDisplay
  • FormattedTimeRemaining
  • FunctionIsDisabled
  • getFormerRolesFromDatabase
  • getFutureRolesFromDatabase
  • getmicrotime
  • getRoleMemberships
  • getRolesFromDatabase
  • gzipVersion
  • hasRole
  • hl_attrval
  • hl_bal
  • hl_cmtcd
  • hl_ent
  • hl_prot
  • hl_regex
  • hl_spec
  • hl_tag
  • hl_tag2
  • hl_tidy
  • hl_version
  • htmLawed
  • HTMLFilter
  • isGroupLeader
  • isMember
  • kses
  • kses_hook
  • MySQLdumpVersion
  • OutputInformation
  • SafeExec
  • showNotice
  • strAddSlashesDeep
  • strNextLetter
  • strStripSlashesDeep
  • strStripTags
  • strValidCharacters
  • tln_body2div
  • tln_casenormalize
  • tln_deent
  • tln_defang
  • tln_findnxreg
  • tln_findnxstr
  • tln_fixatts
  • tln_fixstyle
  • tln_fixurl
  • tln_getnxtag
  • tln_sanitize
  • tln_skipspace
  • tln_tagprint
  • tln_unspace
  • version_compare_replacement
  • version_compare_replacement_sub

Class Language

Copyright: 2004-2016 The Admidio Team
License: GNU General Public License v2.0 only **********************************************************************************************
Brief:

Reads language specific texts that are identified with text ids out of language xml files

The class will read a language specific text that is identified with their text id out of an language xml file. The access will be manages with the SimpleXMLElement which search through xml files. An object of this class can't be stored in a PHP session because it creates PHP core objects which couldn't be stored in sessions. Therefore an object of @b LanguageData should be assigned to this class that stored all necessary data and can be stored in a session.


Class: Language
Code:

// show how to use this class with the language data class and sessions script_a.php // create a language data object and assign it to the language object $language = new Language(); $languageData = new LanguageData('de'); $language->addLanguageData($languageData); $session->addObject('languageData', $languageData);

script_b.php // read language data from session and add it to language object $language = new Language(); $language->addLanguageData($session->getObject('languageData'));

// read and display a language specific text with placeholders for individual content echo $gL10n->get('MAI_EMAIL_SEND_TO_ROLE_ACTIVE', 'John Doe', 'Demo-Organization', 'Administrator');@endcode


Par: Examples
Located at language.php

Methods summary

public
# addLanguageData( LanguageData & $languageDataObject )

Adds a language data object to this class. The object contains all necessary language data that is stored in the PHP session.

Adds a language data object to this class. The object contains all necessary language data that is stored in the PHP session.

Parameters

$languageDataObject
An object of the class @b LanguageData.
public
# addLanguagePath( string $path )

Adds a new path of language files to the array with all language paths where Admidio should search for language files.

Adds a new path of language files to the array with all language paths where Admidio should search for language files.

Parameters

$path
Server path where Admidio should search for language files.
protected string
# getTextFromTextId( string $textId )

Reads a text string out of a language xml file that is identified with a unique text id e.g. SYS_COMMON.

Reads a text string out of a language xml file that is identified with a unique text id e.g. SYS_COMMON.

Parameters

$textId
Unique text id of the text that should be read e.g. SYS_COMMON

Returns

string
Returns the text string of the text id or empty string if not found.
public string
# get( string $textId )

Reads a text string out of a language xml file that is identified with a unique text id e.g. SYS_COMMON. If the text contains placeholders than you must set more parameters to replace them.

Reads a text string out of a language xml file that is identified with a unique text id e.g. SYS_COMMON. If the text contains placeholders than you must set more parameters to replace them.

Parameters

$textId

Unique text id of the text that should be read e.g. SYS_COMMON

param string $param1,$param2... The function accepts an undefined number of values which will be used to replace the placeholder in the text. $param1 will replace @b #VAR1# or @b #VAR1_BOLD#, $param2 will replace @b #VAR2# or @b #VAR2_BOLD# etc.

Returns

string
Returns the text string with replaced placeholders of the text id.

Code

// display a text without placeholders echo $gL10n->get('SYS_NUMBER');

// display a text with placeholders for individual content echo $gL10n->get('MAI_EMAIL_SEND_TO_ROLE_ACTIVE', 'John Doe', 'Demo-Organization', 'Administrator');


Endcode

Par

Examples
public string[]
# getCountries( )

Returns an array with all countries and their ISO codes

Returns an array with all countries and their ISO codes

Returns

string[]
Array with all countries and their ISO codes e.g.: array('DEU' => 'Germany' ...)
public string
# getCountryByCode( string $isoCode )

Returns the name of the country in the language of this object. The country will be identified by the ISO code e.g. 'DEU' or 'GBR' ...

Returns the name of the country in the language of this object. The country will be identified by the ISO code e.g. 'DEU' or 'GBR' ...

Parameters

$isoCode
The three digits ISO code of the country where the name should be returned.

Returns

string
Return the name of the country in the language of this object.
public string|false
# getCountryByName( string $country )

Returns the three digits ISO code of the country. The country will be identified by the name in the language of this object

Returns the three digits ISO code of the country. The country will be identified by the name in the language of this object

Parameters

$country
The name of the country in the language of this object.

Returns

string|false
Return the three digits ISO code of the country or false if country not found.
public string
# getLanguageIsoCode( boolean $referenceLanguage = false )

Returns the ISO code of the language of this object.

Returns the ISO code of the language of this object.

Parameters

$referenceLanguage
If set to @b true than the ISO code of the reference language will returned.

Returns

string
Returns the ISO code of the language of this object or the reference language e.g. @b de or @b en.
public string
# getLanguage( boolean $referenceLanguage = false )

Returns the language code of the language of this object. This is the code that is set within Admidio with some specials like de_sie. If you only want the ISO code then call getLanguageIsoCode().

Returns the language code of the language of this object. This is the code that is set within Admidio with some specials like de_sie. If you only want the ISO code then call getLanguageIsoCode().

Parameters

$referenceLanguage
If set to @b true than the language code of the reference language will returned.

Returns

string
Returns the language code of the language of this object or the reference language.
public string[]
# getAvailableLanguages( )

Creates an array with all languages that are possible in Admidio. The array will have the following syntax e.g.: array('DE' => 'deutsch' ...)

Creates an array with all languages that are possible in Admidio. The array will have the following syntax e.g.: array('DE' => 'deutsch' ...)

Returns

string[]
Return an array with all available languages.
public string
# searchLanguageText( array & $objectArray, string $languagePath, string $language, string $textId )

Search for text id in a language xml file and return the text. If no text was found than nothing is returned.

Search for text id in a language xml file and return the text. If no text was found than nothing is returned.

Parameters

$objectArray
The reference to an array where every SimpleXMLElement of each language path is stored
$languagePath
The path in which the different language xml files are.
$language
The ISO code of the language in which the text will be searched
$textId
The id of the text that will be searched in the file.

Returns

string
Return the text in the language or nothing if text id wasn't found.
public
# setLanguage( string $language )

Set a language to this object. If there was a language before than initialize the cache

Set a language to this object. If there was a language before than initialize the cache

Parameters

$language
ISO code of the language that should be set to this object.

Properties summary

private $languageData
#
private array $languages
# array()
private array $xmlLanguageObjects
# array()
private array $xmlReferenceLanguageObjects
# array()
Admidio API API documentation generated by ApiGen