<?php defined('ALTUMCODE') || die() ?>

<footer class="container store-footer">
    <div class="row">
        <div class="col-lg-4">
            <div class="d-flex flex-column mb-4 mb-lg-0">
                <div><?= sprintf(l('global.footer.copyright'), date('Y'), $this->store->name) ?></div>

                <?php if(!$this->store->is_removed_branding || ($this->store->is_removed_branding && !$this->store_user->plan_settings->removable_branding_is_enabled)) :?>
                    <div class="mt-2">
                        <?php
                        $replacers = [
                            '{{URL}}' => url(),
                            '{{DASHBOARD_LINK}}' => url('dashboard'),
                            '{{WEBSITE_TITLE}}' => settings()->main->title,
                            '{{AFFILIATE_URL_TAG}}' => \Altum\Plugin::is_active('affiliate') && settings()->affiliate->is_enabled ? '?ref=' . $this->store_user->referral_key : null,
                        ];

                        settings()->stores->branding = str_replace(
                            array_keys($replacers),
                            array_values($replacers),
                            settings()->stores->branding
                        );
                        ?>

                        <?= settings()->stores->branding ?>
                    </div>
                <?php endif ?>
            </div>
        </div>

        <div class="col-lg-4 mb-4 mb-lg-0 text-lg-center">
            <?php foreach(require APP_PATH . 'includes/s/socials.php' as $key => $value): ?>
                <?php if($this->store->socials->{$key}): ?>

                    <a href="<?= sprintf($value['format'], $this->store->socials->{$key}) ?>" target="_blank" class="mx-2" title="<?= $value['name'] ?>"><div class="svg-md text-muted d-inline-block"><?= include_view(ASSETS_PATH . 'images/s/' . $key . '.svg') ?></div></a>

                <?php endif ?>
            <?php endforeach ?>
        </div>

        <?php if(settings()->main->theme_style_change_is_enabled): ?>
            <div class="col-lg-4 mb-0 mb-lg-0 text-lg-right">
                <button type="button" id="switch_theme_style" class="btn btn-link text-decoration-none p-0" title="<?= sprintf(l('global.theme_style'), (\Altum\ThemeStyle::get() == 'light' ? l('global.theme_style_dark') : l('global.theme_style_light'))) ?>" aria-label="<?= sprintf(l('global.theme_style'), (\Altum\ThemeStyle::get() == 'light' ? l('global.theme_style_dark') : l('global.theme_style_light'))) ?>" data-title-theme-style-light="<?= sprintf(l('global.theme_style'), l('global.theme_style_light')) ?>" data-title-theme-style-dark="<?= sprintf(l('global.theme_style'), l('global.theme_style_dark')) ?>">
                    <span data-theme-style="light" class="<?= \Altum\ThemeStyle::get() == 'light' ? null : 'd-none' ?>">☀️</span>
                    <span data-theme-style="dark" class="<?= \Altum\ThemeStyle::get() == 'dark' ? null : 'd-none' ?>">🌙</span>
                </button>
            </div>

            <?php include_view(THEME_PATH . 'views/partials/theme_style_js.php') ?>
        <?php endif ?>
    </div>
</footer>
