2
0
mirror of https://github.com/boostorg/website.git synced 2026-01-27 07:22:15 +00:00
Files
website/doc/display_build.php
Daniel James 6f6ff826b3 Hack the documentation code to server from unzipped files.
This is going to break the beta documentation. But that's okay, since it's the
beta site. Hopefully it might reduce the load on the server, which is still
high.


[SVN r64631]
2010-08-06 10:01:39 +00:00

35 lines
1.1 KiB
PHP

<?php
require_once(dirname(__FILE__) . '/../common/code/boost_archive.php');
function add_boost_build_analytics($content) {
$analytics = <<<EOS
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2917240-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
})();
</script>
EOS;
return stripos($content, '_uacct = "UA-2917240-2"') !== FALSE ? $content :
str_ireplace('</head>', $analytics.'</head>', $content);
}
display_from_archive(
get_archive_location(
'@^[/]([^/]+)[/](.*)$@',
$_SERVER["PATH_INFO"],
false, false
),
array(
//~ array(version-regex,path-regex,raw|simple|text|cpp|boost_book_html|boost_libs_html,mime-type[,preprocess hook]),
array('@.*@','@^boost-build/index[.]html$@i','simple','text/html', 'add_boost_build_analytics'),
array('@.*@','@[.](html|htm)$@i','boost_book_html','text/html')
));