public static function getHtml($src, $alt = '', $attributes = '')
{
$src = static::getPath($src);
if ($src == '') {
return '';
}
if (!is_file(TL_ROOT . '/' . $src)) {
// Handle public bundle resources
if (file_exists(TL_ROOT . '/web/' . $src)) {
$src = 'web/' . $src;
} else {
return '';
}
}
$objFile = new \File($src);
// Strip the web/ prefix (see #337)
if (strncmp($src, 'web/', 4) === 0) {
$src = substr($src, 4);
}
$static = strncmp($src, 'assets/', 7) === 0 ? TL_ASSETS_URL : TL_FILES_URL;
return '<img src="' . $static . \System::urlEncode($src) . '" width="' . $objFile->width . '" height="' . $objFile->height . '" alt="' . \StringUtil::specialchars($alt) . '"' . ($attributes != '' ? ' ' . $attributes : '') . '>';
}
/** * @param $row * @param $href * @param $label * @param $title * @param $icon * @param $attributes * @return string */ public function toggleIcon($row, $href, $label, $title, $icon, $attributes) { if (strlen(Input::get('tid'))) { $this->toggleVisibility(Input::get('tid'), Input::get('state') == 1, @func_get_arg(12) ?: null); $this->redirect($this->getReferer()); } // Check permissions AFTER checking the tid, so hacking attempts are logged if (!$this->User->hasAccess('tl_api_client::disable', 'alexf')) { return ''; } $href .= '&tid=' . $row['id'] . '&state=' . $row['disable']; if ($row['disable']) { $icon = 'invisible.gif'; } return '<a href="' . $this->addToUrl($href) . '" title="' . specialchars($title) . '"' . $attributes . '>' . Image::getHtml($icon, $label, 'data-state="' . ($row['disable'] ? 0 : 1) . '"') . '</a> '; }