Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58247 - website/public_html/beta/doc
From: daniel_james_at_[hidden]
Date: 2009-12-09 02:19:25


Author: danieljames
Date: 2009-12-09 02:19:24 EST (Wed, 09 Dec 2009)
New Revision: 58247
URL: http://svn.boost.org/trac/boost/changeset/58247

Log:
Add google analytics to spirit documentation.
Text files modified:
   website/public_html/beta/doc/display_libs.php | 22 +++++++++++++++++++++-
   1 files changed, 21 insertions(+), 1 deletions(-)

Modified: website/public_html/beta/doc/display_libs.php
==============================================================================
--- website/public_html/beta/doc/display_libs.php (original)
+++ website/public_html/beta/doc/display_libs.php 2009-12-09 02:19:24 EST (Wed, 09 Dec 2009)
@@ -1,6 +1,26 @@
 <?php
 require_once(dirname(__FILE__) . '/../common/code/boost_archive.php');
 
+function add_spirit_analytics($content) {
+ $analytics = <<<EOS
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-11715441-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-11715441-2"') !== FALSE ? $content :
+ str_ireplace('</head>', $analytics.'</head>', $content);
+}
+
 $_file = new boost_archive('@^[/]([^/]+)[/](.*)$@',$_SERVER["PATH_INFO"],array(
   //~ array(version-regex,path-regex,raw|simple|text|cpp|boost_book_html|boost_libs_html,mime-type[,preprocess hook]),
   //~ this handles most of the simple cases of index.htm(l) redirect files
@@ -34,7 +54,7 @@
   array('@.*@','@^libs/preprocessor/doc/.*(html|htm)$@i','raw','text/html'),
   array('@.*@','@^libs/test/doc/components/test_tools/reference/.*(html|htm)$@i','raw','text/html'),
   array('@.*@','@^libs/python/doc/PyConDC_2003/bpl.html$@i','raw','text/html'),
- array('@.*@','@^libs/spirit/.*(html|htm)$@i','raw','text/html'),
+ array('@.*@','@^libs/spirit/.*(html|htm)$@i','simple','text/html', 'add_spirit_analytics'),
   array('@.*@','@^libs/static_assert/static_assert.htm$@i','raw','text/html'),
   array('@.*@','@^libs/type_traits/cxx_type_traits.htm$@i','raw','text/html'),
   array('@.*@','@^libs/utility/iterator_adaptors.htm$@i','raw','text/html'),


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk