Properties

$_lang

$_lang

$_trMode

$_trMode

$_whereCategory

$_whereCategory

$_offerTranslationLink

$_offerTranslationLink

$_langWrite

$_langWrite

$_buffer

$_buffer

$_dao

$_dao

$WordMemcache

$WordMemcache

Methods

__construct()

__construct(string $category)

Parameters

string $category

optional value to set the page of the texts

             we're looking for (this needs an additional column in the
             words table)

setlangWrite()

setlangWrite( $IdLanguage)

Parameters

$IdLanguage

getTrMode()

getTrMode()

trLinkBufferSize()

trLinkBufferSize()

translationLinksEnabled()

translationLinksEnabled()

getBuffered()

getBuffered( $code) : string

Returns a translation for the keycode, and puts a translation link on the buffer.

Parameters

$code

Returns

string —

the translated word

getSilent()

getSilent( $code)

does the same as getBuffered($code, .

..) the function is here for backwards convenience

Parameters

$code

getForScript()

getForScript( $code)

Parameters

$code

__call()

__call( $code,  $args)

Parameters

$code
$args

__get()

__get( $code)

Parameters

$code

flushBuffer()

flushBuffer()

any translation items that were remembered in the buffer are now flushed!

get()

get( $code)

does the same as getFormatted($code, .

..)

Parameters

$code

getFormatted()

getFormatted(string $code) : string

Looks up (localized) texts in BW words table.

Newlines are replaced by HTML breaks, backslashes are stripped off. Takes a variable number of arguments as c-style formatted string.

Parameters

string $code

keyword for finding text, not allowed to be empty

Returns

string —

localized text, in case of no hit the word keycode, evtl with tr links

getRaw()

getRaw(string $code, array $replacements, string $language) : string

Look up texts in words table.

No newlines or slashes are replaced. Never add translation links.

Parameters

string $code

keyword for finding text, not allowed to be empty

array $replacements

strings to be inserted into the translation's %s placeholders

string $language

ShortCode of language, 2 to 4 letter

Returns

string —

localized text, in case of no hit the word keycode

getAsIs()

getAsIs(string $code) : string

Get text as is from the database no call to vsprintf (Needed for newsletter that contain links and %username% tags)

Parameters

string $code

keyword for finding text, not allowed to be empty

Returns

string —

localized text, in case of no hit the word keycode

getPurified()

getPurified(string $code, array $replacements, string $language) : string

Look up texts in words table.

Use purifier to add paragraphs and linkify. Never add translation links.

Parameters

string $code

keyword for finding text, not allowed to be empty

array $replacements

strings to be inserted into the translation's %s placeholders

string $language

ShortCode of language, 2 to 4 letter

Returns

string —

localized text, in case of no hit the word keycode

getFormattedInLang()

getFormattedInLang(string $code,  $lang) : string

Looks up (localized) texts in BW words table.

Newlines are replaced by HTML breaks, backslashes are stripped off. Takes a variable number of arguments as c-style formatted string.

Second parametter is the language

Parameters

string $code

keyword for finding text, not allowed to be empty

$lang

Returns

string —

localized text, in case of no hit the word keycode, evtl with tr links

getInLang()

getInLang(string $code, string $lang) : string

If we want another than the active language

Parameters

string $code

the word keycode

string $lang

the language code

Returns

string —

localized text, evtl with tr link

getBufferedInLang()

getBufferedInLang(string $code, string $lang) : string

If we want another than the active language

Parameters

string $code

the word keycode

string $lang

the language code

Returns

string —

localized text, evtl with tr link

deleteMTrad()

deleteMTrad( $IdTrad,  $IdOwner,  $IdLanguage)

deleteMTrad function

This delete a translations

Parameters

$IdTrad
$IdOwner
$IdLanguage

mInTrad()

mInTrad(mixed $IdTrad,  $IdLanguage, mixed $ReplaceWithBr) : string

Parameters

mixed $IdTrad

the id of a memberstrads.IdTrad record to retrieve

$IdLanguage
mixed $ReplaceWithBr

allows

Returns

string —

translated according to the best language find

mTrad()

mTrad(mixed $IdTrad, mixed $ReplaceWithBr) : string

Parameters

mixed $IdTrad

the id of a memberstrads.IdTrad record to retrieve

mixed $ReplaceWithBr

allows

Returns

string —

translated according to the best language find

fTrad()

fTrad(mixed $IdTrad, mixed $ReplaceWithBr,  $IdForceLanguage) : string

Parameters

mixed $IdTrad

the id of a translations.IdTrad record to retrieve

mixed $ReplaceWithBr

allows

$IdForceLanguage

Returns

string —

translated according to the best language find

MakeRevision()

MakeRevision( $Id,  $TableName,  $IdMemberParam,  $DoneBy)

------------------------------------------------------------------------------ function : MakeRevision this is a copy of a function allready running in Function tools this is not the best place for it, please contact jeanyves if you feel like to change this MakeRevision this function save a copy of current value of record Id in table TableName for member IdMember with Done By reason @$Id : id of the record @$TableName : table where the revision is to be done @$IdMemberParam : the member who cause the revision, the current memebr will be use if this is not set @$DoneBy : a text to say why the update was done (this must be one of the value of the enum 'DoneByMember','DoneByOtherMember","DoneByVolunteer','DoneByAdmin','DoneByModerator')

Parameters

$Id
$TableName
$IdMemberParam
$DoneBy

InsertInMTrad()

InsertInMTrad( $ss,  $TableColumn,  $IdRecord,  $_IdMember,  $_IdLanguage,  $IdTrad)

InsertInFTrad function

This InsertInFTrad create a new translatable text in MemberTrad @$ss is for the content of the text @$TableColumn refers to the table and coilumn the trad is associated to @$IdRecord is the num of the record in this table @$_IdMember ; is the id of the member who own the record @$_IdLanguage @$IdTrad is probably useless (I don't remmber why I defined it)

Warning : as default language this function will use by priority : 1) the content of $_IdLanguage if it is set to something else than -1 2) the content of an optional $_POST[IdLanguage] if it is set 3) the content of the current $_SESSION['IdLanguage'] of the current membr if it set 4) The default language (0)

returns the id of the created trad

Improvment: if the value is empty then nothing is inserted but 0 is returned

Parameters

$ss
$TableColumn
$IdRecord
$_IdMember
$_IdLanguage
$IdTrad

ReplaceInMTrad()

ReplaceInMTrad( $ss,  $TableColumn,  $IdRecord,  $IdTrad,  $IdOwner)

ReplaceInMTrad function

This ReplaceInMTrad replace or create translatable text in member Trad @$ss is for the content of the text @$TableColumn refers to the table and column the trad is associated to @$IdRecord is the num of the record in this table $IdTrad is the record in member_trads to replace they are several records with the smae IdTrad teh difference is thr language, if IdTrad is set to 0 a new record will be created, this is the usual way to insert records @$IdOwner ; is the id of the member who own the record, if set to 0 We Will use the current member

Warning : as default language this function will use:

  • the content of the current $_SESSION['IdLanguage'] of the current member

Parameters

$ss
$TableColumn
$IdRecord
$IdTrad
$IdOwner

InsertInFTrad()

InsertInFTrad( $ss,  $TableColumn,  $IdRecord,  $_IdMember,  $_IdLanguage,  $IdTrad)

InsertInfTrad function

This InsertInFTrad create a new translatable text in translations @$ss is for the content of the text @$TableColumn refers to the table and coilumn the trad is associated to @$IdRecord is the num of the record in this table @$_IdMember ; is the id of the member who own the record @$_IdLanguage @$IdTrad is probably useless (I don't remmber why I defined it)

Warning : as default language this function will use by priority : 1) the content of $_IdLanguage if it is set to something else than -1 2) the content of an optional $_POST[IdLanguage] if it is set 3) the content of the current $_SESSION['IdLanguage'] of the current membr if it set 4) The default language (0)

returns the id of the created trad

improvment if the text value is empty, nothing is inserte din the table, and 0 is retruned as an IdTrad

Parameters

$ss
$TableColumn
$IdRecord
$_IdMember
$_IdLanguage
$IdTrad

GetLanguageChoosen()

GetLanguageChoosen()

GetLanguageChoosen function

This return the language choosen by the user this function is supposed to be called after a new post, and editpost or a reply it return the language choosen if any

ReplaceInFTrad()

ReplaceInFTrad( $ss,  $TableColumn,  $IdRecord,  $IdTrad,  $IdOwner)

ReplaceInFTrad function

This ReplaceInFTrad replace or create translatable text in translations @$ss is for the content of the text @$TableColumn refers to the table and column the trad is associated to @$IdRecord is the num of the record in this table $IdTrad is the record in translations to replace (unique for each IdLanguage) @$Owner ; is the id of the member who own the record

Warning : as default language this function will use by priority : 1) the content of $_IdLanguage if it is set to something else than -1 2) the content of an optional $_POST[IdLanguage] if it is set 3) the content of the current $_SESSION['IdLanguage'] of the current membr if it set 4) The default language (0)

Parameters

$ss
$TableColumn
$IdRecord
$IdTrad
$IdOwner

_text_with_tr()

_text_with_tr(\LookedUpWord $word) : string

creates a string that contains the translated word and evtl a tr link.

Parameters

\LookedUpWord $word

an object of type LookedUpWord, containing all the stuff from DB lookup

Returns

string —

the string to be used in the webpage

_text_and_buffer()

_text_and_buffer( $word)

Parameters

$word

_lookup()

_lookup(\unknown_type $code,  $args,  $lang,  $get_raw) : \LookedUpWord

looks up a word keycode in the DB, and returns an object of type LookedUpWord.

If a translation in the intended language is not found, it uses the English version. If no English definition exists, the keycode itself is used.

Parameters

\unknown_type $code

the key code for the db lookup

$args
$lang
$get_raw

Returns

\LookedUpWord

information that is created from the word lookup

_modified_sentence_from_row()

_modified_sentence_from_row(\dbrow $row, array $args, boolean $get_raw) : string

Reads the (modified) translation sentence from a row in the database.

Modifications (if $get_raw is false):

  • stripslashes
  • n12br

Parameters

\dbrow $row
array $args
boolean $get_raw

true for raw string, false for modified string

Returns

string —

modified sentence from db

_is_obsolete()

_is_obsolete(\dbrow $row, \dbrow $row_en) : boolean

find out if a translation is obsolete - which depends on the timestamps of last update.

Parameters

\dbrow $row
\dbrow $row_en

Returns

boolean —

comparison of the word update timestamps.

_lookup_row()

_lookup_row(string $code, string $lang,  $extraWhere) : \dbrow

looks up only one row in the database

Looks up (localized) texts in BW words table according to provided language.

Parameters

string $code

keyword for finding text, not allowed to be empty

string $lang

2-letter code for language

$extraWhere

Returns

\dbrow —

an object representing one row in the database (?)

_bulk_lookup_rows()

_bulk_lookup_rows( $array_of_codes,  $lang)

Parameters

$array_of_codes
$lang

ReplaceWithBr()

ReplaceWithBr(mixed $ss,  $ReplaceWith) : string

retuns a string where

Parameters

mixed $ss

the string where to replace \n

$ReplaceWith

Returns

string —

where \n are replaced with
if the ReplaceWith parameter was true