<?php
/**
 * Template part for displaying a post's footer
 *
 * @package code4rest
 */

namespace Code4rest;

use function Code4rest\code4rest;
use function get_the_author;
use function get_avatar;
use function get_the_author_meta;
use function the_author_meta;
use function get_the_author_posts_link;

code4rest()->print_styles( 'code4rest-author-box' );

?>
<div class="entry-author entry-author-style-<?php echo esc_attr( code4rest()->option( 'post_author_box_style' ) ); ?><?php echo ( code4rest()->option( 'post_footer_area_boxed' ) ? ' content-bg entry-content-wrap entry' : '' ); ?>">
	<div class="entry-author-profile author-profile vcard">
		<div class="entry-author-avatar">
			<?php echo get_avatar( get_the_author_meta( 'ID' ), 80 ); ?>
		</div>
		<b class="entry-author-name author-name fn"><?php echo wp_kses_post( code4rest()->option( 'post_author_box_link' ) ? get_the_author_posts_link() : get_the_author() ); ?></b>
		<?php if ( get_the_author_meta( 'occupation' ) ) { ?>
			<p class="entry-author-occupation author-occupation"><?php the_author_meta( 'occupation' ); ?></p>
		<?php } ?>
		<div class="entry-author-description author-bio">
			<?php the_author_meta( 'description' ); ?>
		</div>
		<div class="entry-author-follow author-follow">
			<?php
			foreach ( array( 'facebook', 'twitter', 'instagram', 'youtube', 'flickr', 'vimeo', 'linkedin', 'pinterest', 'dribbble', 'amazon', 'medium', 'goodreads', 'bookbub' ) as $social ) {
				if ( get_the_author_meta( $social ) ) {
					?>
					<a href="<?php echo esc_url( get_the_author_meta( $social ) ); ?>" class="<?php echo esc_attr( $social ); ?>-link social-button"  rel="noopener" title="<?php /* translators: 1: Author Name, 2: Social Media Name */ echo sprintf( esc_attr__( 'Follow %1$s on %2$s', 'code4rest' ), esc_attr( get_the_author_meta( 'display_name' ) ), esc_attr( ucfirst( $social ) ) ); ?>">
						<?php code4rest()->print_icon( $social, '', false ); ?>
					</a>
					<?php
				}
			}
			?>
		</div><!--.author-follow-->
	</div>
</div><!-- .entry-author -->
