<?php
// ============================================================
// Murdock DevWorks Global Header Include
// Used by public store pages after the Ecommerce Templates
// required startup include lines have already loaded.
// ============================================================
if (!isset($pageTitle)) { $pageTitle = 'Murdock DevWorks'; }
if (!isset($pageDescription)) { $pageDescription = 'Independent software development, self-hosted tools, downloads, and support from Murdock DevWorks.'; }
if (!isset($mdwShowSearch)) { $mdwShowSearch = true; }

// Let Ecommerce Templates SEO fields override the generic page title/description when available.
$mdwBrowserTitle = !empty($pagetitle) ? $pagetitle : $pageTitle;
$mdwMetaDescription = !empty($productdescription) ? $productdescription : (!empty($sectiondescription) ? $sectiondescription : $pageDescription);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo htmlspecialchars($mdwBrowserTitle, ENT_QUOTES, 'UTF-8'); ?></title>
<meta name="description" content="<?php echo htmlspecialchars($mdwMetaDescription, ENT_QUOTES, 'UTF-8'); ?>">
<?php
// Ecommerce Templates SEO / canonical / OpenGraph information.
// Some ECT variables can contain raw URLs on certain pages. Raw URL text
// should never be echoed visibly above the site header, so normalize here.
function mdw_output_head_value($value, $type = 'canonical') {
    if (empty($value)) { return; }
    $value = trim((string)$value);
    if ($value === '') { return; }

    // If ECT already generated a proper tag, keep it.
    if (strpos($value, '<') !== false && strpos($value, '>') !== false) {
        echo "
" . $value . "
";
        return;
    }

    // If ECT only gave us a URL, convert it to a proper hidden head tag.
    if (preg_match('/^https?:\/\//i', $value)) {
        $safe = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
        if ($type === 'ogimage') {
            echo "
<meta property=\"og:image\" content=\"{$safe}\">
";
        } else {
            echo "
<link rel=\"canonical\" href=\"{$safe}\">
";
        }
    }
}

mdw_output_head_value($canonicalurl ?? '', 'canonical');
if (basename($_SERVER['PHP_SELF']) === 'categories.php') {
    mdw_output_head_value($canonicalurlcats ?? '', 'canonical');
}
if (basename($_SERVER['PHP_SELF']) === 'products.php') {
    mdw_output_head_value($canonicalurlprods ?? '', 'canonical');
}
mdw_output_head_value($canonicalnopage ?? '', 'canonical');
mdw_output_head_value($metaogimage ?? '', 'ogimage');
?>
<?php include "vsadmin/inc/incectstyle.php"; ?>
<!-- Ecommerce Templates 7.x required frontend cart stylesheet and script. -->
<link href="css/ectcart.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/ectcart.js"></script>
<link href="css/style.css" rel="stylesheet">
<link href="css/mdw-theme.css?v=header-final-16" rel="stylesheet">
<link rel="icon" type="image/png" href="images/logo/favicon.png">
<link rel="apple-touch-icon" href="images/logo/apple-touch-icon.png">
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,900" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="js/ectsearch.js"></script>
<script src="js/fixed.js"></script>
<script>if (typeof ect_megamenu === 'function') { ect_megamenu('#FFF'); }</script>
</head>
<body>
<div class="mainWrapper mdw-site">
  <div class="headerWrapper mdw-header">
    <div class="mdw-headtop">
      <div class="container mdw-headtop-inner">
        <div class="mdw-brand mdw-brand-main">
          <a href="index.php">
            <img class="mdw-logo-img" src="images/logo/mdw-logo-mark-shadow.png" alt="Murdock DevWorks logo">
            <span class="mdw-brand-text">Murdock DevWorks</span>
          </a>
        </div>

        <div class="mdw-headtagline">
          Independent Software • Self-Hosted Tools • Digital Downloads
        </div>

        <div class="mdw-head-actions">
          <div class="mdw-mini-actions">
            <div class="mdw-login-mini">
              <?php $minicssaction="onelineminilogin"; include "vsadmin/inc/incminicss.php"; ?>
            </div>

          </div>
        </div>
      </div>
    </div>

    <div class="nav_bar mdw-nav clearfix">
      <div class="container">
        <div class="row"><div class="col-12">
          <nav class="ectmegamenu">
            <ul>
              <li><a href="index.php">Home</a></li>
              <li><a href="products.php">Products</a></li>
              <li><a href="categories.php">Categories</a></li>
              <li><a href="projects.php">Projects</a></li>
              <li><a href="downloads.php">Downloads</a></li>
              <li><a href="support.php">Support</a></li>
              <li><a href="search.php">Search</a></li>
              <li><a href="cart.php">Cart</a></li>
              <li><a href="clientlogin.php">Account</a></li>
            </ul>
          </nav>
        </div></div>
      </div>
    </div>
  </div>
