<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
$enable_contact = Draly_Dropshipping_Starter_Helper::get_option( 'enable_contact' );
if ( empty( $enable_contact ) ) {
	return;
}
$contact_icon       = Draly_Dropshipping_Starter_Helper::get_option( 'contact_icon' );
$contact_title      = Draly_Dropshipping_Starter_Helper::get_option( 'contact_title' );
$contact_phone      = Draly_Dropshipping_Starter_Helper::get_option( 'contact_phone' );
?>
<div class="header-contact">
    <div class="header-contact-inner">
		<?php
		echo ! empty( $contact_icon['id'] ) ? '<div class="header-contact-image">' . wp_get_attachment_image( $contact_icon['id'], 'full' ) . '</div>' : '';
		?>
        <div class="header-contact-info">
			<?php echo ! empty( $contact_title ) ? '<span class="header-contact-title">' . esc_html( $contact_title ) . '</span>' : '' ?>
			<?php if ( ! empty( $contact_phone ) ) {
				$contact_phone_tel = preg_replace( '/[^0-9+]/', '', $contact_phone );
				if ( strpos( $contact_phone_tel, '+' ) !== 0 ) {
					$contact_phone_tel = '+' . $contact_phone_tel;
				}
				echo '<a href="tel:' . esc_attr( $contact_phone_tel ) . '" class="header-contact-phone">' . esc_html( $contact_phone ) . '</a>';
				?>
			<?php } ?>
        </div>
    </div>
</div>