public static function badge(UserBadge $badge, $mediaPath, $tip = false, $placeholders = array()) { $title = ''; $class = ''; $classes = array(); if ($tip and $badge->getBadge()->getActivityText()) { JHtml::_('bootstrap.tooltip'); $classes[] = 'hasTooltip'; $description = strip_tags(trim($badge->getBadge()->getActivityText($placeholders))); $title = ' title="' . htmlspecialchars($description, ENT_QUOTES, 'UTF-8') . '"'; } // Prepare class property if (count($classes) > 0) { $class = ' class="' . implode(' ', $classes) . '"'; } // Prepare alt property $alt = strip_tags(trim($badge->getBadge()->getTitle())); if ($alt !== null and $alt !== '') { $alt = ' alt="' . htmlspecialchars($alt, ENT_QUOTES, 'UTF-8') . '"'; } $html = '<img src="' . $mediaPath . '/' . $badge->getBadge()->getImage() . '"' . $class . $alt . $title . ' />'; return $html; }