Files
LiveCartaWP/htdocs/wp-content/themes/lawcarta/header.php
2021-04-13 16:08:59 +03:00

258 lines
12 KiB
PHP

<?php
require_once 'inc/walker-nav-menu.php';
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" sizes="60x60" href="<?= get_theme_file_uri('/assets/img/favicon/apple-touch-icon.png'); ?>">
<link rel="icon" type="image/png" sizes="32x32" href="<?= get_theme_file_uri('/assets/img/favicon/favicon-32x32.png'); ?>">
<link rel="icon" type="image/png" sizes="16x16" href="<?= get_theme_file_uri('/assets/img/favicon/favicon-16x16.png'); ?>">
<link rel="manifest" href="<?= get_theme_file_uri('/assets/img/favicon/site.webmanifest'); ?>">
<link rel="mask-icon" href="<?= get_theme_file_uri('/assets/img/favicon/safari-pinned-tab.svg'); ?>" color="#5bbad5">
<link rel="shortcut icon" href="<?= get_theme_file_uri('/assets/img/favicon/favicon.ico'); ?>" type="image/x-icon">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="<?= get_theme_file_uri('/assets/img/favicon/browserconfig.xml'); ?>">
<meta name="theme-color" content="#ffffff">
<script>
var lawCartaDomain = '<?= get_lawcarta_url()?>';
</script>
<script>
if (window.document.documentMode) {
window.top.location = lawCartaDomain + '/catalog';
}
</script>
<?php
$baseTemplate = basename( get_page_template() );
if ($baseTemplate == 'page_home.php'):?>
<script type="application/javascript">
var isHomeTemplate = true;
</script>
<?php endif;?>
<script src="https://www.googleoptimize.com/optimize.js?id=OPT-TCXZSGK"></script>
<?php if (LAWCARTA_ENVIRONMENT_NAME == 'prod'):?>
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window,document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '363838978111281');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1" src="https://www.facebook.com/tr?id=363838978111281&ev=PageView&noscript=1"/>
</noscript>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '<?=get_lawcarta_ga_config()?>' , 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K8LWZ6K');</script>
<!-- End Google Tag Manager -->
<!-- Global site tag (gtag.js) - Google Ads: 636857414 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-636857414"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-636857414');
</script>
<!-- Hotjar Tracking Code for www.livecarta.com -->
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:2006957,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
<?php endif;?>
<script>
function support_format_webp() {
var elem = document.createElement('canvas');
if (!!(elem.getContext && elem.getContext('2d'))) {
return elem.toDataURL('image/webp').indexOf('data:image/webp') == 0;
} else {
return false;
}
}
if (support_format_webp()) {
document.getElementsByTagName('html')[0].classList.add('webp')
}
</script>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K8LWZ6K"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div class="wrapper white new-footer">
<?php
$the_page = sanitize_post( $GLOBALS['wp_the_query']->get_queried_object() );
$slug = $the_page->post_name;
if ($slug != 'publish-your-book'):?>
<header>
<div id="header-menu" class="cont">
<a href="<?= site_url(); ?>" class="main-logo"><img alt="Logo test" src="<?= get_theme_file_uri('/assets/img/logo.png'); ?>"></a>
<?php
if (has_nav_menu('top')) {
wp_nav_menu([
'menu' => 'top',
'menu_class' => 'navTab nav',
'container' => 'div',
'container_class' => 'header-menu center',
'depth' => 1,
'walker' => new LawCarta_Walker_Nav_Menu(),
'icon_wrap' => 'i',
'theme_location' => 'top',
]);
}
?>
</div>
<div class="mobile-menu">
<a href="#" class="btn-toggle-menu">
<i class="icon-menu" title="Menu"></i>
<i class="icon-close" title="Close"></i>
</a>
</div>
<div class="mobile-nav" style="display: none;">
<div class="mm-bg">
<?php
if (has_nav_menu('top')) {
wp_nav_menu([
'menu' => 'top',
'menu_class' => 'navTab nav',
'container' => 'div',
'container_class' => 'header-menu center',
'depth' => 1,
'walker' => new LawCarta_Walker_Nav_Menu(),
'icon_wrap' => 'i',
'theme_location' => 'top',
]);
}
?>
<!-- <div class="header-menu static">-->
<!-- <ul id="w3" class="navTab nav">-->
<!-- <li><a href="http://lawcarta.loc/casebook/lib">My Library</a></li>-->
<!-- <li><a href="http://lawcarta.loc/course">Courses</a></li>-->
<!-- <li><a class="header-menu-point nav-shop" href="http://lawcarta.loc/checkout/cart">My Cart (0) <i class="icon-shop"></i></a></li>-->
<!-- </ul>-->
<!-- </div>-->
<!---->
<!-- <div class="sign-block">-->
<!---->
<!-- <ul id="w4" class="signed-user-block nav">-->
<!-- <li class="dropdown">-->
<!-- <a class="signed-user dropdown-toggle" href="#" data-toggle="dropdown">Zheka <span class="icon-account-settings"></span> <span class="icon-caret"></span></a>-->
<!-- <ul id="w5" class="dropdown-menu">-->
<!-- <li>-->
<!-- <a href="http://lawcarta.loc/user/registration/profile" tabindex="-1">My Profile</a></li>-->
<!-- <li>-->
<!-- <a href="http://lawcarta.loc/report/royalties" tabindex="-1">Royalties</a>-->
<!-- </li>-->
<!-- <li>-->
<!-- <a href="http://lawcarta.loc/report/transactions" tabindex="-1">Transaction History</a></li>-->
<!-- <li>-->
<!-- <a href="http://lawcarta.loc/user/admin/index?sort=-created_at" tabindex="-1">Admin</a>-->
<!-- </li>-->
<!-- <li>-->
<!-- <a href="http://lawcarta.loc/user/logout" data-method="post" tabindex="-1">Logout</a>-->
<!-- </li>-->
<!-- </ul>-->
<!-- </li>-->
<!-- </ul>-->
<!-- </div>-->
<!-- <div class="sign-block">-->
<!-- <a href="#" class="button bordered">LOGIN</a>-->
<!-- <a href="#" class="button bordered">REGISTER</a>-->
<!-- </div>-->
</div>
</div>
<?php
$post = get_post();
if($post && $post->post_type == 'post'){
$slug = 'blog';
}else{
$slug = basename(get_permalink());
}
?>
<iframe src="<?= get_lawcarta_url()?>/menu?slug=<?=$slug?>" style="display: none;"></iframe>
<script type="application/javascript">
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod === "attachEvent" ? "onmessage" : "message";
eventer(messageEvent, function (ev) {
if (ev.origin.indexOf('<?= get_lawcarta_url()?>') !== -1) {
// document.getElementById('header-menu').insertAdjacentHTML('beforeend', ev.data);
$('body').append('<div id="header-parser"></div>');
$('#header-parser').append(ev.data);
var inHTML;
if ($('#header-parser .header-menu').length){
$('.header-menu.center ul').each(function(){
$(this).append($('#header-parser .header-menu ul').html());
});
}
if ($('#header-parser .sign-block').length){
inHTML = $('#header-parser .sign-block')[0].outerHTML;
$('header .cont').append(inHTML);
$('.mobile-nav .mm-bg').append(inHTML);
}
if ($('#header-parser #is-guest').length){
$('#header-parser #is-guest').appendTo($('header .cont'));
}
// $('#header-parser').hide();
$('#header-parser').remove();
if ($('#is-guest').text() == 'true') {
$('.guest-data').css('display', 'inline-block');
$('.mobile-nav .guest-data').css('display', 'block');
} else {
$('.home-label').text('Dashboard').attr('href', '<?= get_lawcarta_url()?>/dashboard');
if (typeof isHomeTemplate != 'undefined' && isHomeTemplate === true) {
window.location.href = lawCartaDomain + '/dashboard';
}
}
}
});
jQuery('.btn-toggle-menu').on('click', function (e) {
e.preventDefault();
jQuery(this).toggleClass('on');
jQuery('.mobile-nav').toggleClass('show');
});
</script>
</header>
<?php endif;?>