forked from LiveCarta/LiveCartaWP
117 lines
4.6 KiB
PHP
117 lines
4.6 KiB
PHP
<?php
|
|
|
|
require_once 'inc/walker-nav-menu.php';
|
|
|
|
$urlParts = parse_url(home_url());
|
|
$scheme = isset($urlParts['scheme']) ? $urlParts['scheme'] . '://' : '';
|
|
|
|
$baseTemplate = basename( get_page_template() );
|
|
|
|
$host = isset($urlParts['host']) ? $urlParts['host'] : '';
|
|
if (defined('LAWCARTA_SUBDOMAIN')) {
|
|
$hostParts = explode('.', $host);
|
|
if (count($hostParts) === 3) {
|
|
array_shift($hostParts);
|
|
}
|
|
if (!empty(LAWCARTA_SUBDOMAIN)) {
|
|
array_unshift($hostParts, LAWCARTA_SUBDOMAIN);
|
|
}
|
|
$host = implode('.', $hostParts);
|
|
}
|
|
|
|
$port = isset($urlParts['port']) ? $urlParts['port'] : '';
|
|
if (defined('LAWCARTA_PORT')) {
|
|
$port = LAWCARTA_PORT;
|
|
}
|
|
if (!empty($port)) {
|
|
$port = ':' . $port;
|
|
}
|
|
|
|
$lawCartaUrl = "$scheme$host$port";
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html <?php language_attributes(); ?>>
|
|
<head>
|
|
<meta charset="<?php bloginfo('charset'); ?>">
|
|
|
|
<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">
|
|
|
|
<?php if ($baseTemplate == 'page_home.php'):?>
|
|
<script type="application/javascript">
|
|
var isHomeTemplate = true;
|
|
var lawCartaDomain = '<?= $lawCartaUrl?>';
|
|
</script>
|
|
<?php endif;?>
|
|
|
|
<?php wp_head(); ?>
|
|
</head>
|
|
<body <?php body_class(); ?>>
|
|
|
|
<div class="wrapper white new-footer">
|
|
|
|
<header>
|
|
<div id="header-menu" class="cont">
|
|
<a href="<?= site_url(); ?>" class="main-logo"><img 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>
|
|
<iframe src="<?= $lawCartaUrl ?>/menu" 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('<?= $lawCartaUrl ?>') !== -1) {
|
|
// document.getElementById('header-menu').insertAdjacentHTML('beforeend', ev.data);
|
|
|
|
$('body').append('<div id="header-parser"></div>');
|
|
$('#header-parser').append(ev.data);
|
|
if ($('#header-parser .header-menu').length){
|
|
$('.header-menu.center ul').append($('#header-parser .header-menu ul').html());
|
|
}
|
|
if ($('#header-parser .sign-block').length){
|
|
$('#header-parser .sign-block').appendTo($('header .cont'));
|
|
}
|
|
if ($('#header-parser #is-guest').length){
|
|
$('#header-parser #is-guest').appendTo($('header .cont'));
|
|
}
|
|
$('#header-parser').remove();
|
|
|
|
if ($('#is-guest').text() == 'true') {
|
|
$('.guest-data').css('display', 'inline-block');
|
|
} else {
|
|
$('.home-label').text('Dashboard').attr('href', '<?= $lawCartaUrl?>/dashboard');
|
|
if (typeof isHomeTemplate != 'undefined' && isHomeTemplate === true) {
|
|
window.location.href = lawCartaDomain + '/dashboard';
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</header>
|
|
|
|
|