diff --git a/application/views/helpers/Img.php b/application/views/helpers/Img.php new file mode 100644 index 000000000..48f79fda2 --- /dev/null +++ b/application/views/helpers/Img.php @@ -0,0 +1,29 @@ + $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) : '' + ); + } +} +