Translation2
[ class tree: Translation2 ] [ index: Translation2 ] [ all elements ]

Class: Translation2_Decorator_CacheLiteFunction

Source Location: /Translation2-2.0.4/Translation2/Decorator/CacheLiteFunction.php

Class Overview

Translation2
   |
   --Translation2_Decorator
      |
      --Translation2_Decorator_CacheLiteFunction

Decorator to cache fetched data using the Cache_Lite_Function class.


Author(s):

Version:

  • CVS: $Id: CacheLiteFunction.php 305985 2010-12-05 22:55:33Z clockwerx $

Copyright:

  • 2004-2007 Lorenzo Alberton

Variables

Methods


Inherited Variables

Inherited Methods

Class: Translation2_Decorator

Translation2_Decorator::Translation2_Decorator()
Constructor Constructs the Translation2_Decorator
Translation2_Decorator::get()
Get translated string
Translation2_Decorator::getDecorator()
Return an instance of a decorator
Translation2_Decorator::getLang()
Get language info
Translation2_Decorator::getLangs()
Get languages
Translation2_Decorator::getPage()
Same as getRawPage, but resort to fallback language and replace parameters when needed
Translation2_Decorator::getRaw()
Get translated string
Translation2_Decorator::getRawPage()
Get the array of strings in a page
Translation2_Decorator::getStringID()
Get the stringID for the given string. This method is the reverse of get().
Translation2_Decorator::replaceEmptyStringsWithKeys()
Replace empty strings with their stringID
Translation2_Decorator::setCharset()
Set charset used to read/store the translations
Translation2_Decorator::setContainerOptions()
Set some storage driver options
Translation2_Decorator::setLang()
Set default language
Translation2_Decorator::setOption()
set Decorator option
Translation2_Decorator::setOptions()
set Decorator options
Translation2_Decorator::setPageID()
Set default page
Translation2_Decorator::setParams()
Set parameters for next string
Translation2_Decorator::_replaceParams()
Replace parameters in strings
Translation2_Decorator::__clone()
Clone internal object references

Class: Translation2

Translation2::Translation2()
Constructor
Translation2::factory()
Return a Translation2 instance already initialized
Translation2::get()
Get translated string
Translation2::getDecorator()
Return an instance of a decorator
Translation2::getLang()
get lang info
Translation2::getLangs()
get langs
Translation2::getPage()
Get an entire group of strings
Translation2::getRaw()
Get translated string (as-is)
Translation2::getRawPage()
Get the array of strings in a page
Translation2::getStringID()
Get the stringID for the given string. This method is the reverse of get().
Translation2::replaceEmptyStringsWithKeys()
Replace empty strings with their stringID
Translation2::setCharset()
Set charset used to read/store the translations
Translation2::setContainerOptions()
Set some storage driver options
Translation2::setLang()
Set default lang
Translation2::setPageID()
Set default page
Translation2::setParams()
Set parameters for next string
Translation2::_replaceParams()
Replace parameters in strings
Translation2::__clone()
Clone internal object references

Class Details

[line 57]
Decorator to cache fetched data using the Cache_Lite_Function class.


[ Top ]


Class Variables

$cacheLiteFunction =  null

[line 65]

Cache_Lite_Function object

Type:   object


[ Top ]

$caching =  true

[line 107]

Enable / disable caching

(can be very useful to debug cached scripts)


Type:   boolean


[ Top ]

$cleaningFrequency =  0

[line 115]

Frequency of cache cleaning.

Higher values mean lower cleaning probability. Set 0 to disable. Set 1 to clean at every request.


Type:   boolean


[ Top ]

$defaultGroup =  'Translation2'

[line 121]

Name of default cache group.

Type:   string


[ Top ]



Method Detail

get   [line 319]

string get( string $stringID, [string $pageID = TRANSLATION2_DEFAULT_PAGEID], [string $langID = null], [string $defaultText = ''])

Get translated string

First check if the string is cached, if not => fetch the page from the container and cache it for later use.


Overrides Translation2_Decorator::get() (Get translated string)

Parameters:

string   $stringID     string ID
string   $pageID     page/group ID
string   $langID     language ID
string   $defaultText     Text to display when the strings in both the default and the fallback lang are empty

[ Top ]

getLang   [line 217]

mixed getLang( [string $langID = null], [string $format = 'name'])

get lang info

Get some extra information about the language (its full name, the localized error text, ...)

  • Return: [string | array], depending on $format

Overrides Translation2_Decorator::getLang() (Get language info)

Parameters:

string   $langID     language ID
string   $format     ['name', 'meta', 'error_text', 'array']

[ Top ]

getLangs   [line 255]

array getLangs( [string $format = 'name'])

get langs

Get some extra information about the languages (their full names, the localized error text, their codes, ...)


Overrides Translation2_Decorator::getLangs() (Get languages)

Parameters:

string   $format     ['ids', 'names', 'array']

[ Top ]

getPage   [line 385]

array getPage( [string $pageID = TRANSLATION2_DEFAULT_PAGEID], [string $langID = null])

Same as getRawPage, but resort to fallback language and replace parameters when needed

Overrides Translation2_Decorator::getPage() (Same as getRawPage, but resort to fallback language and replace parameters when needed)

Parameters:

string   $pageID     page/group ID
string   $langID     language ID

[ Top ]

getRaw   [line 284]

string getRaw( string $stringID, [string $pageID = TRANSLATION2_DEFAULT_PAGEID], [string $langID = null], [string $defaultText = ''])

Get translated string (as-is)

First check if the string is cached, if not => fetch the page from the container and cache it for later use.


Overrides Translation2_Decorator::getRaw() (Get translated string)

Parameters:

string   $stringID     string ID
string   $pageID     page/group ID
string   $langID     language ID
string   $defaultText     Text to display when the strings in both the default and the fallback lang are empty

[ Top ]

getRawPage   [line 355]

array getRawPage( [string $pageID = TRANSLATION2_DEFAULT_PAGEID], [string $langID = null])

Get the array of strings in a page

First check if the strings are cached, if not => fetch the page from the container and cache it for later use.


Overrides Translation2_Decorator::getRawPage() (Get the array of strings in a page)

Parameters:

string   $pageID     page/group ID
string   $langID     language ID

[ Top ]

getStringID   [line 417]

string getStringID( string $string, [string $pageID = TRANSLATION2_DEFAULT_PAGEID])

Get translated string

Overrides Translation2_Decorator::getStringID() (Get the stringID for the given string. This method is the reverse of get().)

Parameters:

string   $string     This is NOT the stringID, this is a real string. The method will search for its matching stringID, and then it will return the associate string in the selected language.
string   $pageID     page/group ID

[ Top ]

setCacheOption   [line 196]

self setCacheOption( string $name, string $value)

Set a Cache_Lite option

Passes a Cache_Lite option forward to the Cache_Lite object See Cache_Lite constructor for available options

  • See: Cache_Lite::setOption()
  • Access: public

Parameters:

string   $name     name of the option
string   $value     new value of the option

[ Top ]

setLang   [line 163]

void setLang( string $langID)

Set default lang

Set the language that shall be used when retrieving strings.


Overrides Translation2_Decorator::setLang() (Set default language)

Parameters:

string   $langID     language code (for instance, 'en' or 'it')

[ Top ]


Documentation generated on Mon, 06 Dec 2010 00:00:19 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.