diff --git a/footer.php b/footer.php index 2301f7a6158a108e16350d359b9db3ceaf6a59c2..7f709106acc414d4a0a85b42f16b67e99637d506 100644 --- a/footer.php +++ b/footer.php @@ -6,23 +6,7 @@ <?php echo html_meta('legal_informations'); ?> </div> <div class="half-right"> - <ul class="navigation"> - <?php if(site_meta('mail', '')): ?> - <li><a href="<?php echo social_url('mail'); ?>"><?php echo social_logo('mail').' '.site_meta('mail', ''); ?></a></li> - <?php endif; ?> - <?php if(site_meta('github', '')): ?> - <li><a href="<?php echo social_url('github'); ?>"><?php echo social_logo('github').' '.site_meta('github', ''); ?></a></li> - <?php endif; ?> - <?php if(site_meta('framasphere', '')): ?> - <li><a href="<?php echo social_url('framasphere'); ?>"><?php echo social_logo('framasphere').' '.site_meta('framasphere', ''); ?></a></li> - <?php endif; ?> - <?php if(site_meta('facebook', '')): ?> - <li><a href="<?php echo social_url('facebook'); ?>"><?php echo social_logo('facebook').' '.site_meta('facebook', ''); ?></a></li> - <?php endif; ?> - <?php if(site_meta('twitter', '')): ?> - <li><a href="<?php echo social_url('twitter'); ?>"><?php echo social_logo('twitter').' '.site_meta('twitter', ''); ?></a></li> - <?php endif; ?> - </ul> + <?php social_list("class=navigation")?> </div> <div class="half-right"> <ul class="navigation"> diff --git a/functions.php b/functions.php index 7c39410824dca46550c33f54608b6dd4b2747f37..9e95c87d5dd5ae75cdad5c98687336b20ae91578 100644 --- a/functions.php +++ b/functions.php @@ -64,25 +64,35 @@ function html_meta($key) { echo $output; } -function social_url($network) { +function social_logo($network) { + $img=theme_url("img/$network.png"); + return "<img height=\"20\" width=\"20\" src=\"$img\" alt=\"$network/\"/>"; +} + +function social_account($network) { + if ($network == "framasphere"){ + return site_meta($network.'_id', ''); + } + return site_meta($network, ''); +} + +function social_list($properties) { $NETWORKS_URLS = array ( + 'mail' => 'mailto:', 'github' => 'https://github.com/', 'framasphere' => 'https://framasphere.org/people/', + 'mastodon' => 'https://framapiaf.org/', 'facebook' => 'https://facebook.com/', 'twitter' => 'https://twitter.com/', - 'mail' => 'mailto:', ); - if ($network == "framasphere"){ - $account = site_meta($network.'_id', ''); - }else{ - $account = site_meta($network, ''); + echo "<ul ".$properties.">"; + foreach ($NETWORKS_URLS as $network => $network_url){ + if(site_meta($network, '')){ + echo '<li><a href="'.$network_url.social_account($network).'">'. + social_logo($network).' '.site_meta($network, '').'</a></li>'; + } } - return $NETWORKS_URLS[$network].$account; -} - -function social_logo($network) { - $img=theme_url("img/$network.png"); - return "<img height=\"20\" width=\"20\" src=\"$img\" alt=\"$network/\"/>"; + echo "</ul>"; } function total_articles() { diff --git a/img/mastodon.png b/img/mastodon.png new file mode 100644 index 0000000000000000000000000000000000000000..3ed93f1206d2baad81237046d45491e1a86d7795 Binary files /dev/null and b/img/mastodon.png differ