Показ метрики можно отключать в конфиге

This commit is contained in:
Krivchikov Dmitry 2014-07-28 12:27:17 +04:00
parent 4afeabf498
commit c21d27aa1e
2 changed files with 58 additions and 50 deletions

View File

@ -9,5 +9,6 @@ return array(
'dbname' => 'poi', 'dbname' => 'poi',
), ),
//'version' => trim(file_get_contents(dirname(__FILE__).'/version')), //'version' => trim(file_get_contents(dirname(__FILE__).'/version')),
'metrika' => true,
); );

View File

@ -7,67 +7,74 @@
<head> <head>
<title><?= App::getConfig('title') ?></title> <title><?= App::getConfig('title') ?></title>
<?php if ($styles): ?> <?php if ($styles): ?>
<?php foreach ($styles as $style): ?> <?php foreach ($styles as $style): ?>
<link href="<?= $style ?>" media="all" rel="stylesheet" type="text/css" /> <link href="<?= $style ?>" media="all" rel="stylesheet" type="text/css" />
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?>
<?php if ($scripts): ?>
<?php foreach ($scripts as $script): ?>
<script src="<?= $script ?>" type="text/javascript"></script>
<?php endforeach; ?>
<?php endif; ?>
<?php if($data['og']): ?>
<meta property="og:title" content="<?=$data['og']['title']?>" />
<meta property="og:description" content="<?=$data['og']['description']?>" />
<meta property="og:site_name" content="<?=$data['og']['site_name']?>" />
<meta property="og:type" content="<?=$data['og']['type']?>" />
<meta property="og:url" content="<?=$data['og']['url']?>" />
<meta property="og:image" content="<?=$data['og']['image']?>" />
<?php endif; ?> <?php endif; ?>
<?php if ($scripts): ?>
<?php foreach ($scripts as $script): ?>
<script src="<?= $script ?>" type="text/javascript"></script>
<?php endforeach; ?>
<?php endif; ?>
<?php if ($data['og']): ?>
<meta property="og:title" content="<?= $data['og']['title'] ?>" />
<meta property="og:description" content="<?= $data['og']['description'] ?>" />
<meta property="og:site_name" content="<?= $data['og']['site_name'] ?>" />
<meta property="og:type" content="<?= $data['og']['type'] ?>" />
<meta property="og:url" content="<?= $data['og']['url'] ?>" />
<meta property="og:image" content="<?= $data['og']['image'] ?>" />
<?php endif; ?>
<?php if ($vars): ?> <?php if ($vars): ?>
<script type="text/javascript"> <script type="text/javascript">
<?php foreach ($vars as $varName => $var): ?> <?php foreach ($vars as $varName => $var): ?>
var <?= $varName ?> = '<?= $var ?>'; var <?= $varName ?> = '<?= $var ?>';
<?php endforeach; ?> <?php endforeach; ?>
</script> </script>
<?php endif; ?> <?php endif; ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</head> </head>
<body> <body>
<div class="header"> <div class="header">
<a href="/"><h1>WikiPoints</h1></a> <a href="/"><h1>WikiPoints</h1></a>
</div> </div>
<?= isset($content) && !empty($content) ? $content : 'No content =(' ?> <?= isset($content) && !empty($content) ? $content : 'No content =(' ?>
<?= self::renderPartial('modals/about.php', array(), true) ?> <?= self::renderPartial('modals/about.php', array(), true) ?>
<?= self::renderPartial('modals/howToUse.php', array(), true) ?> <?= self::renderPartial('modals/howToUse.php', array(), true) ?>
<!-- Yandex.Metrika counter --> <?php if (App::getConfig('metrika')): ?>
<script type="text/javascript"> <!-- Yandex.Metrika counter -->
(function (d, w, c) { <script type="text/javascript">
(w[c] = w[c] || []).push(function() { (function(d, w, c) {
try { (w[c] = w[c] || []).push(function() {
w.yaCounter24682772 = new Ya.Metrika({id:24682772, try {
trackLinks:true}); w.yaCounter24682772 = new Ya.Metrika({id: 24682772,
} catch(e) { } trackLinks: true});
}); } catch (e) {
}
});
var n = d.getElementsByTagName("script")[0], var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"), s = d.createElement("script"),
f = function () { n.parentNode.insertBefore(s, n); }; f = function() {
s.type = "text/javascript"; n.parentNode.insertBefore(s, n);
s.async = true; };
s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js"; s.type = "text/javascript";
s.async = true;
s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js";
if (w.opera == "[object Opera]") { if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false); d.addEventListener("DOMContentLoaded", f, false);
} else { f(); } } else {
})(document, window, "yandex_metrika_callbacks"); f();
</script> }
<noscript><div><img src="//mc.yandex.ru/watch/24682772" style="position:absolute; left:-9999px;" alt="" /></div></noscript> })(document, window, "yandex_metrika_callbacks");
<!-- /Yandex.Metrika counter --> </script>
<noscript><div><img src="//mc.yandex.ru/watch/24682772" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
<?php endif; ?>
</body> </body>
</html> </html>