Esempio n. 1
0
{
    $server = $_SERVER['HTTP_HOST'];
    if ($server != 'www.boost.org' && $server != 'live.boost.org') {
        return $content;
    }
    if (stripos($content, '_uacct = "UA-11715441-2"') !== FALSE) {
        return $content;
    }
    $analytics = <<<EOS
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(
    ['_setAccount', 'UA-11715441-2'],
    ['_trackPageview'],
    ['_setDomainName', '{$server}'],
    ['_setAllowLinker', true]
    );

  (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;
    $content = preg_replace('@<a\\s+href="(http://spirit.sourceforge.net[^"]*)"@i', '<a href="${1}" onclick=\'_gaq.push(["_link", "${1}"]); return false;\'', $content);
    return str_ireplace('</head>', $analytics . '</head>', $content);
}
$archive = new BoostDocumentation(array('fix_dir' => dirname(__FILE__) . '/fixes', 'archive_dir' => STATIC_DIR, 'use_http_expire_date' => true));
$archive->display_from_archive(array(array('', '@^libs/gil/doc/.*(html|htm)$@i', 'raw', 'text/html'), 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('1.59.0-beta', '@^libs/test/.*(html|htm)$@i', 'basic', 'text/html'), array('', '@^libs/test/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/spirit/(.*/)?doc/html/.*(html|htm)$@i', 'basic', 'text/html', 'add_spirit_analytics'), array('', '@^libs/spirit/.*(html|htm)$@i', 'simple', 'text/html', 'add_spirit_analytics'), array('', '@^libs/fusion/.*(html|htm)$@i', 'basic', 'text/html', 'add_spirit_analytics'), array('', '@^libs/wave/.*(html|htm)$@i', 'raw', 'text/html'), array('', '@^libs/range/doc/.*(html|htm)$@i', 'raw', 'text/html'), array('', '@^libs/locale/doc/.*(html|htm)$@i', 'raw', 'text/html'), array('', '@^libs/hana/doc/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/iostreams/doc/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/serialization/doc/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/filesystem/(v\\d/)?doc/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/system/doc/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/numeric/conversion/doc/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/optional/doc/html/.*(html|htm)$@i', 'basic', 'text/html'), array('', '@^libs/optional/doc/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/polygon/doc/.*(html|htm)$@i', 'simple', 'text/html'), array('', '@^libs/[^/]+/doc/html/.*(html|htm)$@i', 'basic', 'text/html'), array('', '@^libs/[^/]+/doc/[^/]+/html/.*(html|htm)$@i', 'basic', 'text/html'), array('', '@^libs/[^/]+/doc/[^/]+/doc/html/.*(html|htm)$@i', 'basic', 'text/html'), array('', '@^libs.*(html|htm)$@i', 'basic', 'text/html'), array('', '@^tools.*(html|htm)$@i', 'basic', 'text/html'), array('', '@^doc/html/.*html$@i', 'boost_book_basic', 'text/html'), array('', '@^more/.*html$@i', 'basic', 'text/html'), array('', '@^boost/.*$@i', 'cpp', 'text/plain')));
Esempio n. 2
0
    {
        $category = $this->categories[$name];
        $this->option_link(isset($category['title']) ? $category['title'] : $name, 'view', 'category_' . $name);
    }
}
// Page variables
$library_page = new LibraryPage($_GET, BoostLibraries::load());
if (BoostVersion::page()->is_numbered_release() && $library_page->libs->latest_version && BoostVersion::page()->compare($library_page->libs->latest_version) > 0) {
    BoostWeb::error_404($_SERVER['REQUEST_URI']);
    return;
}
// To avoid confusion, only show this page when there is actual documentation.
// TODO: Maybe for versions without documentation, could display the list
//       with no links.
// TODO: This duplicates the BoostDocumentation object in display_libs.
$archive = new BoostDocumentation(array('fix_dir' => dirname(__FILE__) . '/fixes', 'archive_dir' => STATIC_DIR, 'use_http_expire_date' => true));
if (!is_dir($archive->documentation_dir())) {
    BoostWeb::error_404($_SERVER['REQUEST_URI']);
    return;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
  <title><?php 
echo html_encode($library_page->title());
?>
</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php

if (strpos($_SERVER['REQUEST_URI'], '//') !== FALSE) {
    header("Location: http://{$_SERVER['HTTP_HOST']}" . preg_replace('@//+@', '/', $_SERVER['REQUEST_URI']), TRUE, 301);
    exit(0);
}
require_once dirname(__FILE__) . '/../common/code/bootstrap.php';
$archive = new BoostDocumentation();
$archive->display_from_archive(array(array('', '@[.](html|htm)$@i', 'basic', 'text/html')));