Add site footer links (close #15)

master
Skylar Ittner 6 years ago
parent b4b5277a13
commit 51e4a8336a

@ -168,6 +168,9 @@ switch ($VARS['action']) {
}
foreach ($VARS['settings'] as $key => $value) {
if (is_array($value)) {
$value = json_encode($value);
}
if ($database->has('settings', ["AND" => ["siteid" => $siteid, "key" => $key]])) {
if ($value == "") {
//echo "deleting $key => $value\n";

@ -126,5 +126,6 @@ define("STRINGS", [
"in navbar" => "Add page to menu",
"navbar title" => "Page title for menu",
"navbar position" => "Menu position (drag to change position):",
"remove image" => "Remove image"
"remove image" => "Remove image",
"site footer links" => "Site Footer Links"
]);

@ -485,6 +485,17 @@ function get_fontawesome_css($echo = true) {
}
}
/**
* Return an array [[title, url], [title, url]] of links for the page footer
*/
function get_footer_urls() {
$links = json_decode(get_setting("footerlinks", false), true);
if (is_array($links)) {
return $links;
}
return [];
}
/**
* Returns an array of social media URLs, with FontAwesome icon classes and labels.
* @return array [["icon", "name", "url"]]

@ -164,6 +164,7 @@ if (!is_empty($VARS['siteid'])) {
<div class="row">
<div class="col-12 col-md-6">
<!-- Company/Org Info -->
<div class="card">
<div class="card-body">
<h5 class="card-title"><i class="fas fa-briefcase"></i> <?php lang("company info"); ?></h5>
@ -198,6 +199,7 @@ if (!is_empty($VARS['siteid'])) {
</div>
</div>
<!-- Analytics -->
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title"><i class="fas fa-chart-bar"></i> <?php lang("analytics"); ?></h5>
@ -216,6 +218,7 @@ if (!is_empty($VARS['siteid'])) {
</div>
</div>
<!-- Extra code header snippets -->
<div class="card mt-4 mb-4">
<div class="card-body">
<h5 class="card-title"><label for="extracode"><i class="fas fa-code"></i> <?php lang("extra code"); ?></label></h5>
@ -224,6 +227,7 @@ if (!is_empty($VARS['siteid'])) {
</div>
</div>
<!-- Social Media links -->
<div class="col-12 col-md-6">
<div class="card">
<div class="card-body">
@ -310,6 +314,43 @@ if (!is_empty($VARS['siteid'])) {
</div>
</div>
</div>
<div class="col-12">
<div class="card mt-4">
<div class="card-body">
<h5 class="card-title"><label><i class="fas fa-list"></i> <?php lang("site footer links"); ?></label></h5>
<div id="footer-link-bin">
<?php
$footerset = false;
$footerlinks = json_decode($settings['footerlinks'], true);
if (is_array($footerlinks)) {
$footerset = true;
}
for ($i = 1; $i <= 10; $i++) {
$url = "";
$title = "";
if ($footerset && array_key_exists("$i", $footerlinks)) {
$url = $footerlinks[$i]['link'];
$title = $footerlinks[$i]['title'];
}
?>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><?php lang("title"); ?>:</span>
</div>
<input type="text" class="form-control" name="settings[footerlinks][<?php echo $i; ?>][title]" value="<?php echo $title; ?>" />
<div class="input-group-prepend">
<span class="input-group-text"><?php lang("link"); ?>:</span>
</div>
<input type="text" class="form-control" name="settings[footerlinks][<?php echo $i; ?>][link]" value="<?php echo $url; ?>" />
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save