feat(navigation): hard-switch to Zibll navigation and Font Awesome 5
This commit is contained in:
1 parent
3c3ddac8be
commit
a0b84977a2
630 files changed
+101647
-11293
No files matched your search
+32
-31
@@ -37,7 +37,7 @@ function aksrt_parse_country_list($raw) {
|
||||
endif;
|
||||
|
||||
// ============================================================
|
||||
// Brand icon map (FA 5.15.4 free)
|
||||
// Brand icon map (FA 5.15.4)
|
||||
// ============================================================
|
||||
|
||||
if (!function_exists('aksrt_brand_icon_map')) :
|
||||
@@ -52,30 +52,30 @@ function aksrt_brand_icon_map(): array {
|
||||
return $map;
|
||||
}
|
||||
|
||||
// FA5 free has no bilibili/gitee brands — use solid stand-ins.
|
||||
// FA5 Free has no bilibili/gitee brands — use solid stand-ins.
|
||||
$map = [
|
||||
'github' => 'fab fa-github',
|
||||
'google' => 'fab fa-google',
|
||||
'x' => 'fab fa-twitter',
|
||||
'twitter' => 'fab fa-twitter',
|
||||
'email' => 'fas fa-envelope',
|
||||
'envelope' => 'fas fa-envelope',
|
||||
'wechat' => 'fab fa-weixin',
|
||||
'weixin' => 'fab fa-weixin',
|
||||
'qq' => 'fab fa-qq',
|
||||
'weibo' => 'fab fa-weibo',
|
||||
'telegram' => 'fab fa-telegram-plane',
|
||||
'discord' => 'fab fa-discord',
|
||||
'bilibili' => 'fas fa-tv',
|
||||
'linkedin' => 'fab fa-linkedin-in',
|
||||
'facebook' => 'fab fa-facebook-f',
|
||||
'youtube' => 'fab fa-youtube',
|
||||
'instagram' => 'fab fa-instagram',
|
||||
'web' => 'fas fa-globe',
|
||||
'globe' => 'fas fa-globe',
|
||||
'gitee' => 'fas fa-code-branch',
|
||||
'baidu' => 'fas fa-paw',
|
||||
'alipay' => 'fab fa-alipay',
|
||||
'github' => 'fa fab fa-github',
|
||||
'google' => 'fa fab fa-google',
|
||||
'x' => 'fa fab fa-twitter',
|
||||
'twitter' => 'fa fab fa-twitter',
|
||||
'email' => 'fa fas fa-envelope',
|
||||
'envelope' => 'fa fas fa-envelope',
|
||||
'wechat' => 'fa fab fa-weixin',
|
||||
'weixin' => 'fa fab fa-weixin',
|
||||
'qq' => 'fa fab fa-qq',
|
||||
'weibo' => 'fa fab fa-weibo',
|
||||
'telegram' => 'fa fab fa-telegram-plane',
|
||||
'discord' => 'fa fab fa-discord',
|
||||
'bilibili' => 'fa fas fa-tv',
|
||||
'linkedin' => 'fa fab fa-linkedin',
|
||||
'facebook' => 'fa fab fa-facebook-f',
|
||||
'youtube' => 'fa fab fa-youtube',
|
||||
'instagram' => 'fa fab fa-instagram',
|
||||
'web' => 'fa fas fa-globe',
|
||||
'globe' => 'fa fas fa-globe',
|
||||
'gitee' => 'fa fas fa-code-branch',
|
||||
'baidu' => 'fa fas fa-paw',
|
||||
'alipay' => 'fa fab fa-alipay',
|
||||
];
|
||||
|
||||
return $map;
|
||||
@@ -86,7 +86,7 @@ if (!function_exists('aksrt_normalize_icon_key')) :
|
||||
/**
|
||||
* Normalize short key or full FA class string to a short map key.
|
||||
*
|
||||
* Examples: 'fab fa-github' | 'fabfa-github' | 'fa-github' | 'github' | 'weixin' → 'github' | 'wechat'
|
||||
* Examples: 'fa fab fa-github' | 'fa-github' | 'github' | 'weixin' → 'github' | 'wechat'
|
||||
*
|
||||
* @param string $name Raw icon key or FA class string.
|
||||
* @return string Short key (may be empty).
|
||||
@@ -97,9 +97,10 @@ function aksrt_normalize_icon_key(string $name): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Strip style prefixes: fab/fas/far + optional space or hyphen.
|
||||
$name = preg_replace('/^(fab|fas|far)[\s-]*/i', '', $name);
|
||||
$name = preg_replace('/^fa[\s-]*/i', '', (string) $name);
|
||||
// Strip the FA5 layout/style prefixes and glyph prefix.
|
||||
$name = preg_replace('/^fa\s+(?:fas|far|fab)\s+/i', '', $name);
|
||||
$name = preg_replace('/^(?:fas|far|fab)\s+/i', '', (string) $name);
|
||||
$name = preg_replace('/^fa-/i', '', (string) $name);
|
||||
$name = trim((string) $name, "- \t\n\r\0\x0B");
|
||||
$name = strtolower($name);
|
||||
|
||||
@@ -124,7 +125,7 @@ if (!function_exists('aksrt_brand_icon_class')) :
|
||||
* Resolve a short key or FA class string to an allowlisted FA5 class.
|
||||
*
|
||||
* @param string $name Short key or full FA class string.
|
||||
* @return string e.g. 'fab fa-github', or '' if unknown.
|
||||
* @return string e.g. 'fa fab fa-github', or '' if unknown.
|
||||
*/
|
||||
function aksrt_brand_icon_class(string $name): string {
|
||||
$raw = trim($name);
|
||||
@@ -133,7 +134,7 @@ function aksrt_brand_icon_class(string $name): string {
|
||||
}
|
||||
|
||||
// Pass through already-valid full FA class strings (footer contact_more).
|
||||
if (preg_match('/^(fa[sbr]|fa)\s+fa-[\w-]+(?:\s+fa-[\w-]+)*$/i', $raw)) {
|
||||
if (preg_match('/^fa\s+(?:fas|far|fab)\s+fa-[\w-]+(?:\s+fa-[\w-]+)*$/i', $raw)) {
|
||||
// Prefer mapped short key when strip matches our catalog (normalizes weixin etc.).
|
||||
$key = aksrt_normalize_icon_key($raw);
|
||||
$map = aksrt_brand_icon_map();
|
||||
@@ -260,7 +261,7 @@ function aksrt_render_social_links(array $contacts): void {
|
||||
}
|
||||
$icon_html = aksrt_brand_icon($icon);
|
||||
if ($icon_html === '') {
|
||||
$icon_html = '<i class="fas fa-globe" aria-hidden="true"></i>';
|
||||
$icon_html = '<i class="fa fas fa-globe" aria-hidden="true"></i>';
|
||||
}
|
||||
$label = (string) ($contact['name'] ?? $contact['title'] ?? $contact['label'] ?? '');
|
||||
if ($label === '') {
|
||||
|
||||
Reference in new issue
Block a user