diff options
Diffstat (limited to 'views/default/icon/default.php')
-rw-r--r-- | views/default/icon/default.php | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/views/default/icon/default.php b/views/default/icon/default.php index 533b92c43..22c20b3a7 100644 --- a/views/default/icon/default.php +++ b/views/default/icon/default.php @@ -5,10 +5,11 @@ * @package Elgg * @subpackage Core * - * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method - * @uses $vars['size'] topbar, tiny, small, medium (default), large, master - * @uses $vars['href'] Optional override for link + * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method + * @uses $vars['size'] topbar, tiny, small, medium (default), large, master + * @uses $vars['href'] Optional override for link * @uses $vars['img_class'] Optional CSS class added to img + * @uses $vars['link_class'] Optional CSS class for the link */ $entity = $vars['entity']; @@ -26,21 +27,31 @@ if (isset($entity->name)) { } else { $title = $entity->title; } +$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false); $url = $entity->getURL(); if (isset($vars['href'])) { $url = $vars['href']; } -$img_src = $entity->getIconURL($vars['size']); -$img = "<img $class src=\"$img_src\" alt=\"$title\" />"; +$img = elgg_view('output/img', array( + 'src' => $entity->getIconURL($vars['size']), + 'alt' => $title, + 'class' => $class, +)); if ($url) { - echo elgg_view('output/url', array( + $params = array( 'href' => $url, 'text' => $img, 'is_trusted' => true, - )); + ); + $class = elgg_extract('link_class', $vars, ''); + if ($class) { + $params['class'] = $class; + } + + echo elgg_view('output/url', $params); } else { echo $img; } |