mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
changed "link" to "href" in html_image. "link" is still working but deprecated
html_image always renders an alt-tag now (default alt="") cleaned up indentiation of function.html_image.php
This commit is contained in:
3
NEWS
3
NEWS
@@ -1,3 +1,6 @@
|
||||
- changed "link" to "href" in html_image. "link" is still working
|
||||
but deprecated (messju)
|
||||
- html_image always renders an alt-tag now (default alt="") (messju)
|
||||
- fixed assign attribute for multiple counters (messju)
|
||||
- added simple math operators to variables (Monte)
|
||||
- reverted patch for case-insensitive tag-names (messju)
|
||||
|
@@ -38,6 +38,7 @@ function smarty_function_html_image($params, &$smarty)
|
||||
{
|
||||
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
|
||||
|
||||
$alt = '';
|
||||
$file = '';
|
||||
$border = 0;
|
||||
$height = '';
|
||||
@@ -56,24 +57,27 @@ function smarty_function_html_image($params, &$smarty)
|
||||
foreach($params as $_key => $_val) {
|
||||
switch($_key) {
|
||||
case 'file':
|
||||
$file = $_val;
|
||||
break;
|
||||
case 'border':
|
||||
$border = $_val;
|
||||
break;
|
||||
case 'height':
|
||||
$height = $_val;
|
||||
break;
|
||||
case 'width':
|
||||
$width = $_val;
|
||||
case 'dpi':
|
||||
$$_key = $_val;
|
||||
break;
|
||||
|
||||
case 'alt':
|
||||
if(!is_array($_val)) {
|
||||
$$_key = smarty_function_escape_special_chars($_val);
|
||||
} else {
|
||||
$smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'link':
|
||||
case 'href':
|
||||
$prefix = '<a href="' . $_val . '">';
|
||||
$suffix = '</a>';
|
||||
break;
|
||||
case 'dpi':
|
||||
$dpi = $_val;
|
||||
break;
|
||||
|
||||
default:
|
||||
if(!is_array($_val)) {
|
||||
$extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
|
||||
@@ -128,7 +132,7 @@ function smarty_function_html_image($params, &$smarty)
|
||||
$height = round($height * $_resize);
|
||||
}
|
||||
|
||||
return $prefix . '<img src="'.$file.'" border="'.$border.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix;
|
||||
return $prefix . '<img src="'.$file.'" alt="'.$alt.'" border="'.$border.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix;
|
||||
}
|
||||
|
||||
/* vim: set expandtab: */
|
||||
|
Reference in New Issue
Block a user