$val) { if ($key === 'alt') $has_alt = true; $attributes[] = sprintf( '%s="%s"', filter_var($key, FILTER_SANITIZE_URL), filter_var($val, FILTER_SANITIZE_FULL_SPECIAL_CHARS) ); } if (! $has_alt) $attributes[] = 'alt=""'; return sprintf( '', $this->view->baseUrl($url), !empty($attributes) ? ' ' . implode(' ', $attributes) : '' ); } }