Use the new socials in themes

This commit is contained in:
Kazhnuz 2025-07-02 20:21:40 +02:00
parent 713e1a3583
commit dcf00a1f71
4 changed files with 15 additions and 24 deletions

View file

@ -6,29 +6,20 @@ class Theme
public static function socialNetworks()
{
global $site;
$socialNetworks = array(
'github' => 'Github',
'gitlab' => 'GitLab',
'twitter' => 'Twitter',
'facebook' => 'Facebook',
'instagram' => 'Instagram',
'codepen' => 'Codepen',
'linkedin' => 'Linkedin',
'xing' => 'Xing',
'telegram' => 'Telegram',
'mastodon' => 'Mastodon',
'vk' => 'VK',
'dribbble' => 'Dribbble'
);
$socialNetworks = array();
foreach ($socialNetworks as $key => $label) {
if (!$site->{$key}()) {
unset($socialNetworks[$key]);
foreach ($GLOBALS['SOCIAL_NETWORKS'] as $key => $label) {
if ($site->getSocialNetwork($label) != "") {
$socialNetworks[Text::cleanUrl($label)] = $label;
}
}
return $socialNetworks;
}
public static function socialNetworkEmoji($socialNetwork) {
return $GLOBALS['SOCIAL_NETWORKS_EMOJI'][Text::cleanUrl($socialNetwork)];
}
public static function title()
{
global $site;

View file

@ -20,9 +20,9 @@
<!-- Social Networks -->
<?php foreach (Theme::socialNetworks() as $key=>$label): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME.'img/'.$key.'.svg' ?>" alt="<?php echo $label ?>" />
<span class="d-inline d-sm-none"><?php echo $label; ?></span>
<a class="nav-link" href="<?php echo $site->getSocialNetwork($label); ?>" target="_blank" rel="me">
<span aria-hidden="true"><?php echo Theme::socialNetworkEmoji($label); ?></span>
<span class="visually-hidden"><?php echo $label; ?></span>
</a>
</li>
<?php endforeach; ?>

View file

@ -19,9 +19,9 @@
<!-- Social Networks -->
<?php foreach (Theme::socialNetworks() as $key => $label) : ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $site->{$key}(); ?>" target="_blank">
<img class="d-none d-sm-block nav-svg-icon" src="<?php echo DOMAIN_THEME . 'img/' . $key . '.svg' ?>" alt="<?php echo $label ?>" />
<span class="d-inline d-sm-none"><?php echo $label; ?></span>
<a class="nav-link" href="<?php echo $site->getSocialNetwork($label); ?>" target="_blank" rel="me">
<span aria-hidden="true"><?php echo Theme::socialNetworkEmoji($label); ?></span>
<span class="visually-hidden"><?php echo $label; ?></span>
</a>
</li>
<?php endforeach; ?>

View file

@ -2,7 +2,7 @@
<div class="container">
<ul class="footer-links pl-0 mb-1">
<?php foreach (Theme::socialNetworks() as $key => $name) {
echo '<a class="color-blue" href="' . $site->{$key}() . '"><li class="d-inline-block pr-4">' . $name . '</li></a>';
echo '<a class="color-blue" href="' . $site->getSocialNetwork($name); . '"><li class="d-inline-block pr-4">' . $name . '</li></a>';
}
?>
</ul>