3 * Smarty plugin to format text blocks
5 * @author Jan Altensen (Stricted)
6 * @copyright 2013-2015 Jan Altensen (Stricted)
7 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
9 * @subpackage PluginsBlock
13 * Smarty {lang}{/lang} block plugin
15 function smarty_block_lang($params, $content, $template, &$repeat) {
16 if (is_null($content) ||
empty($content)) {
20 $lang = $template->smarty
->getTemplateVars('language');
26 $content = str_replace(array("'", '"'), "", $content);
28 if (isset($lang[$content])) {
29 if (strpos($lang[$content], $template->smarty
->left_delimiter
) !== false && strpos($lang[$content], $template->smarty
->right_delimiter
) !== false) {
30 $data = str_replace("\$", '$', $lang[$content]);
31 $_template = new $template->smarty
->template_class('eval:'.$data, $template->smarty
, $template);
32 return $_template->fetch();
35 return $lang[$content];