<?php
/**
 * Template part for displaying the site footer.
 *
 * @package Eronex
 * @since 0.0.1
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$footer_enable = eronex_option( 'eronex_footer_enable', true );

if ( ! $footer_enable ) {
	return;
}

$text = eronex_option( 'eronex_footer_text', 'Copyright © [current_year] [site_title] - [theme_author]' );

$text = str_replace( '[current_year]', date_i18n( 'Y' ), $text );
$text = str_replace( '[site_title]', get_bloginfo( 'name' ), $text );

/**
 * Filters the theme author name and URL used in the footer credit.
 *
 * @since 0.0.1
 *
 * @param array $theme_author {
 *     Theme author details.
 *
 *     @type string $name Author display name.
 *     @type string $url  Author website URL.
 * }
 */
$theme_author = apply_filters(
	'eronex_theme_author_info',
	array(
		'name' => 'Deveasel',
		'url'  => 'https://deveasel.com/',
	)
);

$text = str_replace( '[theme_author]', '<a target="_blank" href="' . esc_url( $theme_author['url'] ) . '">' . $theme_author['name'] . '</a>', $text );

?>
<footer class="eronex-footer">
	<p class="eronex-footer-text"><?php echo wp_kses_post( $text ); ?></p>
</footer>
