'sub.category.dynamic_opml',
];
return $titles[$name] ?? '';
}
public static function alt($name) {
static $alts = array(
'add' => '➕', //✚
'all' => '☰',
'bookmark-add' => '➕', //✚
'bookmark-tag' => '📑',
'category' => '🗂️', //☷
'close' => '❌',
'configure' => '⚙️',
'debug' => '🐛',
'down' => '🔽', //▽
'error' => '❌',
'favorite' => '⭐', //★
'FreshRSS-logo' => '⊚',
'help' => 'ℹ️', //ⓘ
'icon' => '⊚',
'key' => '🔑', //⚿
'label' => '🏷️',
'link' => '↗️', //↗
'look' => '👀', //👁
'login' => '🔒',
'logout' => '🔓',
'next' => '⏩',
'non-starred' => '☆',
'notice' => 'ℹ️', //ⓘ
'opml-dyn' => '⚡',
'prev' => '⏪',
'read' => '☑️', //☑
'rss' => '📣', //☄
'unread' => '🔲', //☐
'refresh' => '🔃', //↻
'search' => '🔍',
'share' => '♻️', //♺
'sort-down' => '⬇️', //↓
'sort-up' => '⬆️', //↑
'starred' => '⭐', //★
'stats' => '📈', //%
'tag' => '🔖', //⚐
'up' => '🔼', //△
'view-normal' => '📰', //☰
'view-global' => '📖', //☷
'view-reader' => '📜',
'warning' => '⚠️', //△
);
return isset($name) ? $alts[$name] : '';
}
// TODO: Change for enum in PHP 8.1+
const ICON_DEFAULT = 0;
const ICON_IMG = 1;
const ICON_URL = 2;
const ICON_EMOJI = 3;
public static function icon(string $name, int $type = self::ICON_DEFAULT): string {
$alt = self::alt($name);
if ($alt == '') {
return '';
}
$url = $name . '.svg';
$url = isset(self::$themeIcons[$url]) ? (self::$themeIconsUrl . $url) : (self::$defaultIconsUrl . $url);
$title = self::title($name);
if ($title != '') {
$title = ' title="' . _t($title) . '"';
}
if ($type == self::ICON_DEFAULT) {
if ((FreshRSS_Context::$user_conf && FreshRSS_Context::$user_conf->icons_as_emojis)
// default to emoji alternate for some icons
) {
$type = self::ICON_EMOJI;
} else {
$type = self::ICON_IMG;
}
}
switch ($type) {
case self::ICON_URL:
return Minz_Url::display($url);
case self::ICON_IMG:
return '
';
case self::ICON_EMOJI:
default:
return '' . $alt . '';
}
}
}