Files
LiveCartaWP/htdocs/wp-content/themes/lawcarta/header.php
Gregory Pradun 47f5deacbe LAW-5416
2022-04-18 13:49:02 +03:00

242 lines
11 KiB
PHP

<?php
require_once 'inc/walker-nav-menu.php';
$scripts = [];
?>
<!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="120x120" 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>
<script src="<?= get_lawcarta_url()?>/assets/front-settings<?php if(isset($_GET['law']) && $_GET['law'] == 1 ):?>?law=1<?php endif;?>"></script>
<?php
$baseTemplate = basename( get_page_template() );
if ($baseTemplate == 'page_home.php'):?>
<script type="application/javascript">
var isHomeTemplate = true;
</script>
<?php endif;?>
<?php $scripts[] = ['type' => 'script', 'source' =>"https://www.googleoptimize.com/optimize.js?id=OPT-TCXZSGK"]; ?>
<?php if (LAWCARTA_ENVIRONMENT_NAME == 'prod'):?>
<?php $scripts[] = ['type' => 'comment', 'source' =>'Google Tag Manager']; ?>
<?php $scripts[] = ['type' => 'script', 'source' =>"(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');"]; ?>
<?php $scripts[] = ['type' => 'comment', 'source' =>'End Google Tag Manager']; ?>
<?php endif;?>
<?php if(isset($_COOKIE['cookie_level']) && in_array($_COOKIE['cookie_level'],['13','123'])):?>
<?php foreach($scripts as $script):?>
<?php switch($script['type']):
case 'comment': ?>
<!--<?=$script['type']?> -->
<?php break; ?>
<?php case 'style': ?>
<style><?=$script['source']?></style>
<?php break; ?>
<?php case 'script': ?>
<?php if(isset($script['src'])):?>
<script <?php if(isset($script['async'])):?>async<?php endif;?> src="<?=$script['src']?>"></script>
<?php else:?>
<script><?=$script['source']?></script>
<?php endif;?>
<?php break; ?>
<?php endswitch; ?>
<?php endforeach;?>
<?php endif; ?>
<?php if(!isset($_COOKIE['cookie_level'])):?>
<script>
var scripts = <?php echo json_encode($scripts) ?>;
</script>
<script src="<?= get_lawcarta_url()?>/assets/track-enable-old"></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.svg'); ?>"></a>
<?php
if (has_nav_menu('top')) {
wp_nav_menu([
'menu' => 'top',
'menu_class' => 'navTab nav',
'container' => 'div',
'container_class' => 'header-menu',
'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',
'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 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 {
window.userId = $('#is-guest').text();
$('.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>
<script src="<?= get_lawcarta_url()?>/assets/url-track"></script>
<script src="https://unpkg.com/fireworks-js@latest/dist/fireworks.js"></script>
<script src="<?= get_lawcarta_url()?>/assets/redirect-popup"></script>
</header>
<?php endif;?>