HEX
Server: Apache/2
System: Linux saturn 4.18.0-477.15.1.lve.2.el8.x86_64 #1 SMP Wed Aug 2 10:43:45 UTC 2023 x86_64
User: centuryt (1072)
PHP: 7.4.33
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/centuryt/public_html/wp-content/themes/emoza-woocommerce/inc/classes/class-emoza-topbar.php
<?php
/**
 * Header class class
 *
 * @package Emoza
 */

if ( !class_exists( 'Emoza_Top_Bar' ) ) :
	Class Emoza_Top_Bar {

		/**
		 * Instance
		 */		
		private static $instance;

		/**
		 * Initiator
		 */
		public static function get_instance() {
			if ( ! isset( self::$instance ) ) {
				self::$instance = new self;
			}
			return self::$instance;
		}

		/**
		 * Constructor
		 */
		public function __construct() {
			add_action( 'emoza_header', array( $this, 'topbar_markup' ), 5 );
		}

		/**
		 * Desktop header markup
		 */
		public function topbar_markup() {
			$enable 	= get_theme_mod( 'enable_top_bar', 0 );

			if ( !$enable ) {
				return;
			}

			$container 	= get_theme_mod( 'topbar_container', 'container-fluid' );
			$visibility = get_theme_mod( 'topbar_visibility', 'desktop-only' );
			$delimiter 	= get_theme_mod( 'topbar_delimiter', 'none' );
			?>

			<div class="top-bar visibility-<?php echo esc_attr( $visibility ); ?>">
				<div class="<?php echo esc_attr( $container ); ?>">
					<div class="top-bar-inner">
						<div class="row valign">
							<div class="col header-elements delimiter-<?php echo esc_attr( $delimiter ); ?>">
								<?php $this->render_components( 'left' ); ?>
							</div>
							<div class="col header-elements delimiter-<?php echo esc_attr( $delimiter ); ?>">
								<?php $this->render_components( 'right' ); ?>
							</div>
						</div>
					</div>
				</div>
			</div>
			<?php
		}

		/**
		 * Render header components
		 */
		public function render_components( $location ) {
			$defaults 	= emoza_get_default_topbar_components();
			$components = get_theme_mod( 'topbar_components_' . $location, $defaults[$location] );
			foreach ( $components as $component ) {
				call_user_func( array( $this, $component ) );
			}
		}

		/**
		 * Contact info
		 */
		public function contact_info() {
			$email 	= get_theme_mod( 'topbar_contact_mail', esc_html__( 'office@example.org', 'emoza-woocommerce' ) );
			$phone	= get_theme_mod( 'topbar_contact_phone', esc_html__( '111222333', 'emoza-woocommerce' ) );

			?>
				<div class="header-item top-bar-contact">
					<?php if ( $email ) : ?>
						<a href="mailto:<?php echo esc_attr( antispambot( $email ) ); ?>"><i class="ws-svg-icon"><?php emoza_get_svg_icon( 'icon-mail', true ); ?></i><?php echo esc_html( antispambot( $email ) ); ?></a>
					<?php endif; ?>
					<?php if ( $phone ) : ?>
						<a href="tel:<?php echo esc_attr( $phone ); ?>"><i class="ws-svg-icon"><?php emoza_get_svg_icon( 'icon-phone', true ); ?></i><?php echo esc_html( $phone ); ?></a>
					<?php endif; ?>					
				</div>
			<?php
		}	
		
		/**
		 * Text
		 */
		public function text() {
			$text = get_theme_mod( 'topbar_text', esc_html__( 'Your text here', 'emoza-woocommerce' ) );
			?>
			<div class="header-item">
				<?php echo wp_kses_post( $text ); ?>
			</div>
			<?php
		}

		/**
		 * Social
		 */
		public function social() {
			echo '<div class="header-item">';
				emoza_social_profile( 'social_profiles_topbar' );
			echo '</div>';
		}

		/**
		 * Secondary menu
		 */
		public function secondary_nav() {
			if ( function_exists('max_mega_menu_is_enabled') && max_mega_menu_is_enabled( 'secondary' ) ) : ?>
				<?php wp_nav_menu( array( 'theme_location' => 'secondary') ); ?>
			<?php else: ?>				
			<nav class="header-item secondary-navigation">
				<?php
				wp_nav_menu( array(
					'theme_location'=> 'secondary',
					'menu_id'       => 'secondary',
					'fallback_cb'	=> false,
					'depth'			=> 1
				) );
				?>
			</nav>
			<?php endif;
		}
	}

	/**
	 * Initialize class
	 */
	Emoza_Top_Bar::get_instance();

endif;