Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17622 программиста и 1372 робота. Сейчас ищут 1543 программиста ...
Class Summary Translation2_Decorator_DefaultText
Вернуться к: Translation2
Class Summary Translation2_Decorator_DefaultText
Class Summary Translation2_Decorator_DefaultText – Decorator to provide a fallback text for empty strings.
When the fetched string is empty, it replaces it with the 4th parameter of the get() method, i.e. $defaultText. If the defaultText parameter is empty too, then return "$emptyPostfix.$outputString.$emptyPrefix", the three variables being class properties you can set to a custom string.
When getPage() is called, all the empty strings in the page are replaced by their stringID value.
<?php
$tr = new Translation2($driver, $dbinfo, $params);
$tr =& $tr->getDecorator('DefaultText');
// %stringID% will be replaced with the stringID
// %pageID_url% will be replaced with the pageID
// %stringID_url% will replaced with a urlencoded stringID
// %url% will be replaced with the targeted url
$tr->outputString = '%stringID%<a href="%url%">(T)</a>'; //default: '%stringID%'
$tr->url = '#'; //same as default
$tr->emptyPrefix = '['; //default: empty string
$tr->emptyPostfix = ']'; //default: empty string
?>
Вернуться к: Translation2