[eluser]walrus_lt[/eluser]
Hi. I found nonsense in ci/html_helper and i hate it because it wastes cpu... Just look at this...:
Code:
if ( ! function_exists('img'))
{
function img($src = '', $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 .= '/>';
return $img;
}
}
Now look closer:
Code:
foreach ($src as $k=>$v)
{
if ($k == 'src' AND strpos($v, '://') === FALSE)
{
<...>
$CI =& get_instance();
<...>
$CI =& get_instance(); in loop? Wtf..