[eluser]XssLab[/eluser]
Hello boys,
this is my first topic on Code Igniter forum's community.
To use CI, I have been find a simple type of bug.
The img() helper is incomplete... don't generate the alt='' tab (and this is not compatible with W3C).
This is my personal version of img() function
Code:
if ( ! function_exists('img'))
{
function img($src = '', $alt = 'default', $index_page = FALSE)
{
if ( ! is_array($src) )
{
$src = array('src' => $src);
}
$img = '<img';
foreach ($src as $k=>$v)
{
if ($k == 'src' AND strpos($v, '://') === FALSE)
{
$CI =& get_instance();
if ($index_page === TRUE)
{
$img .= ' src="'.$CI->config->site_url($v).'" ';
}
else
{
$img .= ' src="'.$CI->config->slash_item('base_url').$v.'" ';
}
}
else
{
$img .= " $k=\"$v\" ";
}
}
$img .= 'alt="'.$alt.'" ';
$img .= '/>';
return $img;
}
}
Good day!