' <- optional, default '' * suffix = '' <- optional, default '' * href = 'http://example.com' <- optional, default '', aliases: 'link' * * customField1 = 'customValue1' <- optional * customField2 = 'customValue2' <- optional * ... * customFieldN = 'customValueN' <- optional * } */ function smarty_function_html_image_fs(array $params, Smarty $smarty) { require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars'); require_once $smarty->_get_plugin_filepath('modifier', 'strip_tags'); require_once $smarty->_get_plugin_filepath('modifier', 'strip'); require_once $smarty->_get_plugin_filepath('modifier', 'truncate'); $name = ''; $width = 0; $height = 0; $method = 'inner'; $emptyImage = null; $alt = ''; $alt_truncate = 80; $title = ''; $title_truncate = 120; $prefix = ''; $suffix = ''; $extra = ''; $base_url = $smarty->get_template_vars('BASE_URL_LANGUAGE'); foreach ($params as $key => $val) { switch($key) { case 'name': case 'file': case 'src': $name = $val; break; case 'height': case 'width': case 'method': case 'emptyImage': case 'prefix': case 'suffix': $$key = $val; break; case 'alt_truncate': case 'title_truncate': break; case 'alt': case 'title': $val = smarty_modifier_strip_tags($val); $val = smarty_modifier_strip($val); $val = trim($val); $length = ${$key . '_truncate'}; $val = smarty_modifier_truncate($val, $length); $$key = smarty_function_escape_special_chars($val); break; case 'link': case 'href': $prefix = ''; $suffix = ''; break; default: $extra .= ($extra ? ' ' : '') . Qs_String::dasherize($key) . '="' . smarty_function_escape_special_chars($val) . '"'; break; } } $src = Qs_ImageFs::get($name, $width, $height, $method, $emptyImage); if ($base_url) { $src = $base_url . '/' . $src; } $html = $prefix . '' . $suffix; return $html; }