Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65025 - website/public_html/beta/common/code
From: dnljms_at_[hidden]
Date: 2010-08-26 16:36:11


Author: danieljames
Date: 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
New Revision: 65025
URL: http://svn.boost.org/trac/boost/changeset/65025

Log:
Revert splitting up the filters.

Reverts [64914],[64915],[64916]. They resulted in a speed up on my local
machine, but not on the server. I guess it's using an op-cache so it isn't hit
by the cost of parsing.

Removed:
   website/public_html/beta/common/code/boost_filter_basic.php
   website/public_html/beta/common/code/boost_filter_boost_book_html.php
   website/public_html/beta/common/code/boost_filter_boost_frame1.php
   website/public_html/beta/common/code/boost_filter_boost_libs.php
   website/public_html/beta/common/code/boost_filter_cpp.php
   website/public_html/beta/common/code/boost_filter_simple.php
   website/public_html/beta/common/code/boost_filter_text.php
   website/public_html/beta/common/code/boost_filters.php
Text files modified:
   website/public_html/beta/common/code/boost_archive.php | 478 +++++++++++++++++++++++++++++++++++++++
   1 files changed, 476 insertions(+), 2 deletions(-)

Modified: website/public_html/beta/common/code/boost_archive.php
==============================================================================
--- website/public_html/beta/common/code/boost_archive.php (original)
+++ website/public_html/beta/common/code/boost_archive.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
@@ -102,7 +102,7 @@
     }
 
     $last_modified = max(
- strtotime("Thu, 19 Aug 2010 09:06:00 +0100"),
+ strtotime("Sun, 11 Jul 2010 18:55:24 +0100"),
         filemtime($check_file));
 
     if (!conditional_get($last_modified))
@@ -318,11 +318,167 @@
 //
 
 function echo_filtered($extractor, $params) {
- require_once(dirname(__FILE__)."/boost_filter_$extractor.php");
     $extractor_name = $extractor.'_filter';
     call_user_func($extractor_name, $params);
 }
 
+function text_filter($params)
+{
+ $params['title'] = htmlentities($params['key']);
+
+ display_template($params['template'],
+ new boost_archive_render_callbacks('text_filter_content', $params));
+}
+
+function text_filter_content($params)
+{
+ print "<h3>".htmlentities($params['key'])."</h3>\n";
+ print "<pre>\n";
+ print_encoded_text($params, 'text');
+ print "</pre>\n";
+}
+
+function cpp_filter($params) {
+ $params['title'] = htmlentities($params['key']);
+
+ display_template($params['template'],
+ new boost_archive_render_callbacks('cpp_filter_content', $params));
+}
+
+function cpp_filter_content($params)
+{
+ print "<h3>".htmlentities($params['key'])."</h3>\n";
+ print "<pre>\n";
+ print_encoded_text($params, 'cpp');
+ print "</pre>\n";
+}
+
+function boost_book_html_filter($params) {
+ html_init($params);
+ display_template($params['template'],
+ new boost_archive_render_callbacks('boost_book_html_filter_content', $params));
+}
+
+function boost_book_html_filter_content($params)
+{
+ $text = prepare_html($params['content']);
+
+ $text = substr($text,strpos($text,'<div class="spirit-nav">'));
+ $text = substr($text,0,strpos($text,'</body>'));
+ $text = str_replace('<hr>','',$text);
+ $text = str_replace('<table width="100%">','<table class="footer-table">',$text);
+ $text = str_replace('<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%">','<table class="footer-table">',$text);
+ $text = preg_replace(
+ '@[\s]+(border|cellpadding|cellspacing|width|height|valign|frame|rules|naturalsizeflag|background)=[^\s>]+@i',
+ '',
+ $text );
+ ##
+ for ($i = 0; $i < 8; $i++) {
+ $text = preg_replace(
+ '@<img src="[\./a-z]*images/(prev|up|home|next|tip|note|warning|important|caution|sidebar|hint|alert)\.png" alt="([^"]+)"([ /]*)>@Ssm',
+ '<img src="/gfx/space.png" alt="${2}" class="${1}_image" />',
+ $text );
+ }
+ ##
+
+ print $text;
+}
+
+function boost_libs_filter($params)
+{
+ html_init($params);
+ $text = extract_html_body($params['content']);
+ if($text) {
+ $text = prepare_html($text);
+ $text = remove_html_banner($text);
+ $text = prepare_themed_html($text);
+ $params['content'] = $text;
+
+ display_template($params['template'],
+ new boost_archive_render_callbacks('boost_libs_filter_content', $params));
+ }
+ else {
+ print $params['content'];
+ }
+}
+
+function boost_libs_filter_content($params)
+{
+ return $params['content'];
+}
+
+function boost_frame1_filter($params) {
+ html_init($params);
+ display_template($params['template'],
+ new boost_archive_render_callbacks(new boost_frame1_filter_content, $params));
+}
+
+function boost_frame1_filter_content($params)
+{
+ $text = prepare_html($params['content']);
+
+ $text = substr($text,strpos($text,'<div class="spirit-nav">'));
+ $text = substr($text,0,strpos($text,'</body>'));
+ for ($i = 0; $i < 8; $i++) {
+ $text = preg_replace(
+ '@<img src="[\./]*images/(.*\.png)" alt="(.*)"([ ][/])?>@Ssm',
+ '<img src="/style-v2/css_0/${1}" alt="${2}" />',
+ $text );
+ }
+ $text = str_replace('<hr>','',$text);
+ $text = str_replace('<table width="100%">','<table class="footer-table">',$text);
+ $text = preg_replace(
+ '@[\s]+(border|cellpadding|cellspacing|width|height|valign|frame|rules|naturalsizeflag|background)=[^\s>]+@i',
+ '',
+ $text );
+
+ print $text;
+}
+
+function simple_filter($params)
+{
+ print prepare_html($params['content']);
+}
+
+function basic_filter($params)
+{
+ $text = prepare_html($params['content']);
+ $text = remove_html_banner($text);
+
+ $is_xhtml = preg_match('@<!DOCTYPE[^>]*xhtml_at_i', $text);
+ $tag_end = $is_xhtml ? '/>' : '>';
+
+ $sections = preg_split('@(</head>|<body[^>]*>)@i',$text,-1,PREG_SPLIT_DELIM_CAPTURE);
+
+ $body_index = 0;
+ $index = 0;
+ foreach($sections as $section) {
+ if(stripos($section, '<body') === 0) {
+ $body_index = $index;
+ break;
+ }
+ ++$index;
+ }
+
+ if(!$body_index) {
+ print($text);
+ }
+ else {
+ $index = 0;
+ foreach($sections as $section) {
+ print($section);
+ if($index == 0) {
+ print '<link rel="icon" href="/favicon.ico" type="image/ico"'.$tag_end;
+ print '<link rel="stylesheet" type="text/css" href="/style-v2/section-basic.css"'.$tag_end;
+ }
+ else if($index == $body_index) {
+ virtual("/common/heading-doc.html");
+ }
+ ++$index;
+ }
+ }
+}
+
 /* File Not Found */
 
 function file_not_found($params, $message = null)
@@ -408,6 +564,322 @@
     return $url['scheme'].'://'.$url['host'] . $url['path'];
 }
 
+function html_init($params)
+{
+ preg_match('@text/html; charset=([^\s"\']+)@i',$params['content'],$charset);
+ if (isset($charset[1]))
+ {
+ $params['charset'] = $charset[1];
+ }
+
+ preg_match('@<title>([^<]+)</title>@i',$params['content'],$title);
+ if (isset($title[1]))
+ {
+ $params['title'] = $title[1];
+ }
+}
+
+function extract_html_body($text) {
+ preg_match('@<body[^>]*>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
+ preg_match('@</body>@i',$text,$body_end,PREG_OFFSET_CAPTURE);
+ if (!isset($body_begin[0]))
+ {
+ //~ Attempt to recover some content from illegal HTML that is missing the body tag.
+ preg_match('@</head>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
+ }
+ if (!isset($body_begin[0]))
+ {
+ //~ Attempt to recover some content from illegal HTML that is missing the body tag.
+ preg_match('@<html[^>]*>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
+ }
+ if (!isset($body_begin[0]))
+ {
+ //~ Attempt to recover some content from illegal HTML that is missing the body tag.
+ preg_match('@<(hr|div|img|p|h1|h2|h3|h4)[^>]*>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
+ }
+ if (!isset($body_begin[0]))
+ {
+ return;
+ }
+ else if (!isset($body_end[0]))
+ {
+ $text = substr($text,
+ $body_begin[0][1]+strlen($body_begin[0][0]));
+ }
+ else
+ {
+ $text = substr($text,
+ $body_begin[0][1]+strlen($body_begin[0][0]),
+ $body_end[0][1]-($body_begin[0][1]+strlen($body_begin[0][0])) );
+ }
+
+ return $text;
+}
+
+function prepare_html($text) {
+ $text = preg_replace(
+ '@href="?http://www.boost.org/?([^"\s]*)"?@i',
+ 'href="/${1}"',
+ $text );
+ $text = preg_replace(
+ '@href="?http://boost.org/?([^"\s]*)"?@i',
+ 'href="/${1}"',
+ $text );
+ $text = preg_replace(
+ '@href="?(?:\.\./)+people/(.*\.htm)"?@i',
+ 'href="/users/people/${1}l"',
+ $text );
+ $text = preg_replace(
+ '@href="?(?:\.\./)+(LICENSE_[^"\s]*\.txt)"?@i',
+ 'href="/${1}"',
+ $text );
+ $text = preg_replace(
+ '@<a\s+(class="[^"]+")?\s*href="?(http|mailto)(:[^"\s]*)"?@i',
+ '<a class="external" href="${2}${3}"',
+ $text );
+
+ return $text;
+}
+
+function remove_html_banner($text) {
+
+ # nasty code, because (?!fubar) causes an ICE...
+ preg_match('@<table[^<>]*>?@i',$text,$table_begin,PREG_OFFSET_CAPTURE);
+ preg_match('@</table>@i',$text,$table_end,PREG_OFFSET_CAPTURE);
+ if (isset($table_begin[0]) && isset($table_end[0])) {
+ $table_contents_start = $table_begin[0][1] + strlen($table_begin[0][0]);
+ $table_contents = substr($text, $table_contents_start,
+ $table_end[0][1] - $table_contents_start);
+
+ if(strpos($table_contents, 'boost.png') !== FALSE) {
+ preg_match('@<td[^<>]*>?([^<]*<(h[12]|p).*?)</td>@is', $table_contents,
+ $table_contents_header, PREG_OFFSET_CAPTURE);
+
+ $head = substr($text, 0, $table_begin[0][1]);
+ $header = isset($table_contents_header[1]) ? $table_contents_header[1][0] : '';
+ $tail = substr($text, $table_end[0][1] + strlen($table_end[0][0]));
+ $tail = preg_replace('@^\s*<hr\s*/?>\s*@', '', $tail);
+
+ $text = $head.$header.$tail;
+ return $text;
+ }
+ }
+
+ $parts = preg_split('@(?=<(p|blockquote))@', $text, 2);
+ $header = $parts[0];
+ $content = $parts[1];
+
+ $header = preg_replace('@(<h\d>\s*)<img[^>]*src="(\.\.\/)*boost\.png"[^>]*>@', '$1', $header);
+ $header = preg_replace('@<img[^>]*src="(\.\.\/)*boost\.png"[^>]*>\s*<[hb]r.*?>@', '', $header);
+
+ return $header.$content;
+}
+
+function prepare_themed_html($text) {
+ $text = preg_replace(
+ '@(<a[^>]+>[\s]*)?<img.*boost\.png[^>]*>([\s]*</a>)?@i',
+ '',
+ $text );
+ $text = preg_replace(
+ '@<img(.*)align="?right"?[^>]*>@i',
+ '<img${1} class="right-inset" />',
+ $text );
+ $text = preg_replace(
+ '@<img(.*)align="?absmiddle"?[^>]*>@i',
+ '<img${1} class="inline" />',
+ $text );
+ /* Remove certain attributes */
+ $text = preg_replace(
+ '@[\s]+(border|cellpadding|cellspacing|width|height|valign|align|frame|rules|naturalsizeflag|background)=("[^"]*"?|\'[^\']*\'?|[^\s/>]+)@i',
+ '',
+ $text );
+ $text = preg_replace(
+ '@<table[\s]+(border)[^\s>]*@i',
+ '<table',
+ $text );
+ $text = preg_replace(
+ '@<[/]?(font|hr)[^>]*>@i',
+ '',
+ $text );
+ $text = preg_replace(
+ '@<([^\s]+)[\s]+>@i',
+ '<${1}>',
+ $text );
+ $text = _preg_replace_bounds(
+ '@<blockquote>[\s]*(<pre>)@i','@(</pre>)[\s]*</blockquote>@i',
+ '${1}','${1}',
+ $text );
+ $text = _preg_replace_bounds(
+ '@<blockquote>[\s]*(<p>)@i','@(</p>)[\s]*</blockquote>@i',
+ '${1}','${1}',
+ $text );
+ $text = _preg_replace_bounds(
+ '@<blockquote>[\s]*(<table>)@i','@(</table>)[\s]*</blockquote>@i',
+ '${1}','${1}',
+ $text );
+ $text = _preg_replace_bounds(
+ '@<blockquote>[\s]*<li>@i','@</li>[\s]*</blockquote>@i',
+ '<ul><li>','</li></ul>',
+ $text );
+ $text = _preg_replace_bounds(
+ '@(?:<blockquote>[\s]*)+<h2>@i','@</h2>(?:[\s]*</blockquote>)+@i',
+ '<h2>','</h2>',
+ $text );
+ $text = preg_replace(
+ '@(<a name=[^\s>]+[\s]*>)[\s]*(</?[^a])@i',
+ '${1}</a>${2}',
+ $text );
+ $text = preg_replace(
+ '@<table>([\s]+<tr>[\s]+<td>.*_arr.*</td>[\s]+<td>.*</td>[\s]+<td>.*</td>[\s]+</tr>[\s]+)</table>@i',
+ '<table class="pyste-nav">${1}</table>',
+ $text );
+ $text = preg_replace(
+ '@<table>([\s]+<tr>[\s]+<td)[\s]+class="note_box">@i',
+ '<table class="note_box">${1}>',
+ $text );
+ $text = preg_replace(
+ '@<table>([\s]+<tr>[\s]+<td[\s]+class="table_title">)@i',
+ '<table class="toc">${1}',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/u_arr\.gif"@i',
+ 'src="/gfx/space.png" class="up_image"',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/l_arr\.gif"@i',
+ 'src="/gfx/space.png" class="prev_image"',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/r_arr\.gif"@i',
+ 'src="/gfx/space.png" class="next_image"',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/u_arr_disabled\.gif"@i',
+ 'src="/gfx/space.png" class="up_image_disabled"',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/l_arr_disabled\.gif"@i',
+ 'src="/gfx/space.png" class="prev_image_disabled"',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/r_arr_disabled\.gif"@i',
+ 'src="/gfx/space.png" class="next_image_disabled"',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/note\.gif"@i',
+ 'src="/gfx/space.png" class="note_image"',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/alert\.gif"@i',
+ 'src="/gfx/space.png" class="caution_image"',
+ $text );
+ $text = preg_replace(
+ '@src=".*theme/bulb\.gif"@i',
+ 'src="/gfx/space.png" class="tip_image"',
+ $text );
+ $text = preg_replace(
+ '@<img src=".*theme/(?:bullet|lens)\.gif">@i',
+ '',
+ $text );
+ $text = preg_replace(
+ '@(<img src=".*theme/(?:arrow)\.gif")>@i',
+ '${1} class="inline">',
+ $text );
+ return $text;
+}
+
+// This takes a plain text file and outputs encoded html with marked
+// up links.
+
+function print_encoded_text($params, $type) {
+ $root = dirname(preg_replace('@([^/]+/)@','../',$params['key']));
+
+ // John Gruber's regular expression for finding urls
+ // http://daringfireball.net/2009/11/liberal_regex_for_matching_urls
+
+ foreach(preg_split(
+ '@\b((?:[\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|[^[:punct:]\s]|/))@',
+ $params['content'], -1, PREG_SPLIT_DELIM_CAPTURE)
+ as $index => $part)
+ {
+ if($index % 2 == 0) {
+ $html = htmlentities($part);
+
+ if($type == 'cpp') {
+ $html = preg_replace(
+ '@(#[ ]*include[ ]+&lt;)(boost[^&]+)@Ssm',
+ '${1}${2}',
+ $html );
+ $html = preg_replace(
+ '@(#[ ]*include[ ]+&quot;)(boost[^&]+)@Ssm',
+ '${1}${2}',
+ $html );
+ }
+
+ print $html;
+ }
+ else {
+ $url = process_absolute_url($part, $root);
+ if($url) {
+ print ''.htmlentities($part).'';
+ }
+ else {
+ print htmlentities($part);
+ }
+ }
+ }
+}
+
+function process_absolute_url($url, $root = null) {
+ // Simplified version of the 'loose' regular expression from
+ // http://blog.stevenlevithan.com/archives/parseuri
+ //
+ // (c) Steven Levithan <stevenlevithan.com>
+ // MIT License
+
+ if(!preg_match(
+ '~^'.
+ // Protocol(1): (Could also remove the userinfo detection stuff?)
+ '(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?'.
+ '(?:\/\/)?'.
+ // Authority(2)
+ '('.
+ // User info
+ '(?:[^:@]*:?[^:@]*@)?'.
+ // Host(3)
+ '([^:\/?#]*)'.
+ // Port
+ '(?::\d*)?'.
+ ')'.
+ // Relative(4)
+ '(\/.*)'.
+ '~',
+ $url, $matches))
+ {
+ return;
+ }
+
+ $protocol = $matches[1];
+ $authority = $matches[2];
+ $host = $matches[3];
+ $relative = $matches[4];
+
+ if(!$authority) return;
+
+ if($root &&
+ ($host == 'boost.org' || $host == 'www.boost.org') &&
+ (strpos($relative, '/lib') === 0))
+ {
+ $url = $root.$relative;
+ }
+ else
+ {
+ $url = ($protocol ? $protocol : 'http').'://'.$authority.$relative;
+ }
+
+ return $url;
+}
+
 // Display the content in the standard boost template
 
 function display_template($template, $callbacks) {
@@ -438,3 +910,5 @@
     default: return 'Unknown unzip error code: ' + $exit_status;
     }
 }
+
+?>

Deleted: website/public_html/beta/common/code/boost_filter_basic.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_basic.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,47 +0,0 @@
-<?php
-/*
- Copyright 2005-2008 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-require_once(dirname(__FILE__).'/boost_filters.php');
-
-function basic_filter($params)
-{
- $text = prepare_html($params['content']);
- $text = remove_html_banner($text);
-
- $is_xhtml = preg_match('@<!DOCTYPE[^>]*xhtml_at_i', $text);
- $tag_end = $is_xhtml ? '/>' : '>';
-
- $sections = preg_split('@(</head>|<body[^>]*>)@i',$text,-1,PREG_SPLIT_DELIM_CAPTURE);
-
- $body_index = 0;
- $index = 0;
- foreach($sections as $section) {
- if(stripos($section, '<body') === 0) {
- $body_index = $index;
- break;
- }
- ++$index;
- }
-
- if(!$body_index) {
- print($text);
- }
- else {
- $index = 0;
- foreach($sections as $section) {
- print($section);
- if($index == 0) {
- print '<link rel="icon" href="/favicon.ico" type="image/ico"'.$tag_end;
- print '<link rel="stylesheet" type="text/css" href="/style-v2/section-basic.css"'.$tag_end;
- }
- else if($index == $body_index) {
- virtual("/common/heading-doc.html");
- }
- ++$index;
- }
- }
-}

Deleted: website/public_html/beta/common/code/boost_filter_boost_book_html.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_boost_book_html.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,39 +0,0 @@
-<?php
-/*
- Copyright 2005-2008 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-require_once(dirname(__FILE__).'/boost_filters.php');
-
-function boost_book_html_filter($params) {
- html_init($params);
- display_template($params['template'],
- new boost_archive_render_callbacks('boost_book_html_filter_content', $params));
-}
-
-function boost_book_html_filter_content($params)
-{
- $text = prepare_html($params['content']);
-
- $text = substr($text,strpos($text,'<div class="spirit-nav">'));
- $text = substr($text,0,strpos($text,'</body>'));
- $text = str_replace('<hr>','',$text);
- $text = str_replace('<table width="100%">','<table class="footer-table">',$text);
- $text = str_replace('<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%">','<table class="footer-table">',$text);
- $text = preg_replace(
- '@[\s]+(border|cellpadding|cellspacing|width|height|valign|frame|rules|naturalsizeflag|background)=[^\s>]+@i',
- '',
- $text );
- ##
- for ($i = 0; $i < 8; $i++) {
- $text = preg_replace(
- '@<img src="[\./a-z]*images/(prev|up|home|next|tip|note|warning|important|caution|sidebar|hint|alert)\.png" alt="([^"]+)"([ /]*)>@Ssm',
- '<img src="/gfx/space.png" alt="${2}" class="${1}_image" />',
- $text );
- }
- ##
-
- print $text;
-}

Deleted: website/public_html/beta/common/code/boost_filter_boost_frame1.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_boost_frame1.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,36 +0,0 @@
-<?php
-/*
- Copyright 2005-2008 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-require_once(dirname(__FILE__).'/boost_filters.php');
-
-function boost_frame1_filter($params) {
- html_init($params);
- display_template($params['template'],
- new boost_archive_render_callbacks(new boost_frame1_filter_content, $params));
-}
-
-function boost_frame1_filter_content($params)
-{
- $text = prepare_html($params['content']);
-
- $text = substr($text,strpos($text,'<div class="spirit-nav">'));
- $text = substr($text,0,strpos($text,'</body>'));
- for ($i = 0; $i < 8; $i++) {
- $text = preg_replace(
- '@<img src="[\./]*images/(.*\.png)" alt="(.*)"([ ][/])?>@Ssm',
- '<img src="/style-v2/css_0/${1}" alt="${2}" />',
- $text );
- }
- $text = str_replace('<hr>','',$text);
- $text = str_replace('<table width="100%">','<table class="footer-table">',$text);
- $text = preg_replace(
- '@[\s]+(border|cellpadding|cellspacing|width|height|valign|frame|rules|naturalsizeflag|background)=[^\s>]+@i',
- '',
- $text );
-
- print $text;
-}
\ No newline at end of file

Deleted: website/public_html/beta/common/code/boost_filter_boost_libs.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_boost_libs.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,144 +0,0 @@
-<?php
-/*
- Copyright 2005-2008 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-require_once(dirname(__FILE__).'/boost_filters.php');
-
-function boost_libs_filter($params)
-{
- html_init($params);
- $text = extract_html_body($params['content']);
- if($text) {
- $text = prepare_html($text);
- $text = remove_html_banner($text);
- $text = prepare_themed_html($text);
- $params['content'] = $text;
-
- display_template($params['template'],
- new boost_archive_render_callbacks('boost_libs_filter_content', $params));
- }
- else {
- print $params['content'];
- }
-}
-
-function boost_libs_filter_content($params)
-{
- return $params['content'];
-}
-
-function prepare_themed_html($text) {
- $text = preg_replace(
- '@(<a[^>]+>[\s]*)?<img.*boost\.png[^>]*>([\s]*</a>)?@i',
- '',
- $text );
- $text = preg_replace(
- '@<img(.*)align="?right"?[^>]*>@i',
- '<img${1} class="right-inset" />',
- $text );
- $text = preg_replace(
- '@<img(.*)align="?absmiddle"?[^>]*>@i',
- '<img${1} class="inline" />',
- $text );
- /* Remove certain attributes */
- $text = preg_replace(
- '@[\s]+(border|cellpadding|cellspacing|width|height|valign|align|frame|rules|naturalsizeflag|background)=("[^"]*"?|\'[^\']*\'?|[^\s/>]+)@i',
- '',
- $text );
- $text = preg_replace(
- '@<table[\s]+(border)[^\s>]*@i',
- '<table',
- $text );
- $text = preg_replace(
- '@<[/]?(font|hr)[^>]*>@i',
- '',
- $text );
- $text = preg_replace(
- '@<([^\s]+)[\s]+>@i',
- '<${1}>',
- $text );
- $text = _preg_replace_bounds(
- '@<blockquote>[\s]*(<pre>)@i','@(</pre>)[\s]*</blockquote>@i',
- '${1}','${1}',
- $text );
- $text = _preg_replace_bounds(
- '@<blockquote>[\s]*(<p>)@i','@(</p>)[\s]*</blockquote>@i',
- '${1}','${1}',
- $text );
- $text = _preg_replace_bounds(
- '@<blockquote>[\s]*(<table>)@i','@(</table>)[\s]*</blockquote>@i',
- '${1}','${1}',
- $text );
- $text = _preg_replace_bounds(
- '@<blockquote>[\s]*<li>@i','@</li>[\s]*</blockquote>@i',
- '<ul><li>','</li></ul>',
- $text );
- $text = _preg_replace_bounds(
- '@(?:<blockquote>[\s]*)+<h2>@i','@</h2>(?:[\s]*</blockquote>)+@i',
- '<h2>','</h2>',
- $text );
- $text = preg_replace(
- '@(<a name=[^\s>]+[\s]*>)[\s]*(</?[^a])@i',
- '${1}</a>${2}',
- $text );
- $text = preg_replace(
- '@<table>([\s]+<tr>[\s]+<td>.*_arr.*</td>[\s]+<td>.*</td>[\s]+<td>.*</td>[\s]+</tr>[\s]+)</table>@i',
- '<table class="pyste-nav">${1}</table>',
- $text );
- $text = preg_replace(
- '@<table>([\s]+<tr>[\s]+<td)[\s]+class="note_box">@i',
- '<table class="note_box">${1}>',
- $text );
- $text = preg_replace(
- '@<table>([\s]+<tr>[\s]+<td[\s]+class="table_title">)@i',
- '<table class="toc">${1}',
- $text );
- $text = preg_replace(
- '@src=".*theme/u_arr\.gif"@i',
- 'src="/gfx/space.png" class="up_image"',
- $text );
- $text = preg_replace(
- '@src=".*theme/l_arr\.gif"@i',
- 'src="/gfx/space.png" class="prev_image"',
- $text );
- $text = preg_replace(
- '@src=".*theme/r_arr\.gif"@i',
- 'src="/gfx/space.png" class="next_image"',
- $text );
- $text = preg_replace(
- '@src=".*theme/u_arr_disabled\.gif"@i',
- 'src="/gfx/space.png" class="up_image_disabled"',
- $text );
- $text = preg_replace(
- '@src=".*theme/l_arr_disabled\.gif"@i',
- 'src="/gfx/space.png" class="prev_image_disabled"',
- $text );
- $text = preg_replace(
- '@src=".*theme/r_arr_disabled\.gif"@i',
- 'src="/gfx/space.png" class="next_image_disabled"',
- $text );
- $text = preg_replace(
- '@src=".*theme/note\.gif"@i',
- 'src="/gfx/space.png" class="note_image"',
- $text );
- $text = preg_replace(
- '@src=".*theme/alert\.gif"@i',
- 'src="/gfx/space.png" class="caution_image"',
- $text );
- $text = preg_replace(
- '@src=".*theme/bulb\.gif"@i',
- 'src="/gfx/space.png" class="tip_image"',
- $text );
- $text = preg_replace(
- '@<img src=".*theme/(?:bullet|lens)\.gif">@i',
- '',
- $text );
- $text = preg_replace(
- '@(<img src=".*theme/(?:arrow)\.gif")>@i',
- '${1} class="inline">',
- $text );
- return $text;
-}

Deleted: website/public_html/beta/common/code/boost_filter_cpp.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_cpp.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,23 +0,0 @@
-<?php
-/*
- Copyright 2005-2008 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-require_once(dirname(__FILE__).'/boost_filter_text.php');
-
-function cpp_filter($params) {
- $params['title'] = htmlentities($params['key']);
-
- display_template($params['template'],
- new boost_archive_render_callbacks('cpp_filter_content', $params));
-}
-
-function cpp_filter_content($params)
-{
- print "<h3>".htmlentities($params['key'])."</h3>\n";
- print "<pre>\n";
- print_encoded_text($params, 'cpp');
- print "</pre>\n";
-}

Deleted: website/public_html/beta/common/code/boost_filter_simple.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_simple.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,13 +0,0 @@
-<?php
-/*
- Copyright 2005-2008 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-require_once(dirname(__FILE__).'/boost_filters.php');
-
-function simple_filter($params)
-{
- print prepare_html($params['content']);
-}

Deleted: website/public_html/beta/common/code/boost_filter_text.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_text.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,114 +0,0 @@
-<?php
-/*
- Copyright 2005-2008 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-function text_filter($params)
-{
- $params['title'] = htmlentities($params['key']);
-
- display_template($params['template'],
- new boost_archive_render_callbacks('text_filter_content', $params));
-}
-
-function text_filter_content($params)
-{
- print "<h3>".htmlentities($params['key'])."</h3>\n";
- print "<pre>\n";
- print_encoded_text($params, 'text');
- print "</pre>\n";
-}
-
-// This takes a plain text file and outputs encoded html with marked
-// up links.
-
-function print_encoded_text($params, $type) {
- $root = dirname(preg_replace('@([^/]+/)@','../',$params['key']));
-
- // John Gruber's regular expression for finding urls
- // http://daringfireball.net/2009/11/liberal_regex_for_matching_urls
-
- foreach(preg_split(
- '@\b((?:[\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|[^[:punct:]\s]|/))@',
- $params['content'], -1, PREG_SPLIT_DELIM_CAPTURE)
- as $index => $part)
- {
- if($index % 2 == 0) {
- $html = htmlentities($part);
-
- if($type == 'cpp') {
- $html = preg_replace(
- '@(#[ ]*include[ ]+&lt;)(boost[^&]+)@Ssm',
- '${1}${2}',
- $html );
- $html = preg_replace(
- '@(#[ ]*include[ ]+&quot;)(boost[^&]+)@Ssm',
- '${1}${2}',
- $html );
- }
-
- print $html;
- }
- else {
- $url = process_absolute_url($part, $root);
- if($url) {
- print ''.htmlentities($part).'';
- }
- else {
- print htmlentities($part);
- }
- }
- }
-}
-
-function process_absolute_url($url, $root = null) {
- // Simplified version of the 'loose' regular expression from
- // http://blog.stevenlevithan.com/archives/parseuri
- //
- // (c) Steven Levithan <stevenlevithan.com>
- // MIT License
-
- if(!preg_match(
- '~^'.
- // Protocol(1): (Could also remove the userinfo detection stuff?)
- '(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?'.
- '(?:\/\/)?'.
- // Authority(2)
- '('.
- // User info
- '(?:[^:@]*:?[^:@]*@)?'.
- // Host(3)
- '([^:\/?#]*)'.
- // Port
- '(?::\d*)?'.
- ')'.
- // Relative(4)
- '(\/.*)'.
- '~',
- $url, $matches))
- {
- return;
- }
-
- $protocol = $matches[1];
- $authority = $matches[2];
- $host = $matches[3];
- $relative = $matches[4];
-
- if(!$authority) return;
-
- if($root &&
- ($host == 'boost.org' || $host == 'www.boost.org') &&
- (strpos($relative, '/lib') === 0))
- {
- $url = $root.$relative;
- }
- else
- {
- $url = ($protocol ? $protocol : 'http').'://'.$authority.$relative;
- }
-
- return $url;
-}

Deleted: website/public_html/beta/common/code/boost_filters.php
==============================================================================
--- website/public_html/beta/common/code/boost_filters.php 2010-08-26 16:36:07 EDT (Thu, 26 Aug 2010)
+++ (empty file)
@@ -1,122 +0,0 @@
-<?php
-/*
- Copyright 2005-2008 Redshift Software, Inc.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-*/
-
-/*
- * HTML processing functions
- */
-
-function html_init($params)
-{
- preg_match('@text/html; charset=([^\s"\']+)@i',$params['content'],$charset);
- if (isset($charset[1]))
- {
- $params['charset'] = $charset[1];
- }
-
- preg_match('@<title>([^<]+)</title>@i',$params['content'],$title);
- if (isset($title[1]))
- {
- $params['title'] = $title[1];
- }
-}
-
-function extract_html_body($text) {
- preg_match('@<body[^>]*>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
- preg_match('@</body>@i',$text,$body_end,PREG_OFFSET_CAPTURE);
- if (!isset($body_begin[0]))
- {
- //~ Attempt to recover some content from illegal HTML that is missing the body tag.
- preg_match('@</head>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
- }
- if (!isset($body_begin[0]))
- {
- //~ Attempt to recover some content from illegal HTML that is missing the body tag.
- preg_match('@<html[^>]*>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
- }
- if (!isset($body_begin[0]))
- {
- //~ Attempt to recover some content from illegal HTML that is missing the body tag.
- preg_match('@<(hr|div|img|p|h1|h2|h3|h4)[^>]*>@i',$text,$body_begin,PREG_OFFSET_CAPTURE);
- }
- if (!isset($body_begin[0]))
- {
- return;
- }
- else if (!isset($body_end[0]))
- {
- $text = substr($text,
- $body_begin[0][1]+strlen($body_begin[0][0]));
- }
- else
- {
- $text = substr($text,
- $body_begin[0][1]+strlen($body_begin[0][0]),
- $body_end[0][1]-($body_begin[0][1]+strlen($body_begin[0][0])) );
- }
-
- return $text;
-}
-
-function prepare_html($text) {
- $text = preg_replace(
- '@href="?http://www.boost.org/?([^"\s]*)"?@i',
- 'href="/${1}"',
- $text );
- $text = preg_replace(
- '@href="?http://boost.org/?([^"\s]*)"?@i',
- 'href="/${1}"',
- $text );
- $text = preg_replace(
- '@href="?(?:\.\./)+people/(.*\.htm)"?@i',
- 'href="/users/people/${1}l"',
- $text );
- $text = preg_replace(
- '@href="?(?:\.\./)+(LICENSE_[^"\s]*\.txt)"?@i',
- 'href="/${1}"',
- $text );
- $text = preg_replace(
- '@<a\s+(class="[^"]+")?\s*href="?(http|mailto)(:[^"\s]*)"?@i',
- '<a class="external" href="${2}${3}"',
- $text );
-
- return $text;
-}
-
-function remove_html_banner($text) {
-
- # nasty code, because (?!fubar) causes an ICE...
- preg_match('@<table[^<>]*>?@i',$text,$table_begin,PREG_OFFSET_CAPTURE);
- preg_match('@</table>@i',$text,$table_end,PREG_OFFSET_CAPTURE);
- if (isset($table_begin[0]) && isset($table_end[0])) {
- $table_contents_start = $table_begin[0][1] + strlen($table_begin[0][0]);
- $table_contents = substr($text, $table_contents_start,
- $table_end[0][1] - $table_contents_start);
-
- if(strpos($table_contents, 'boost.png') !== FALSE) {
- preg_match('@<td[^<>]*>?([^<]*<(h[12]|p).*?)</td>@is', $table_contents,
- $table_contents_header, PREG_OFFSET_CAPTURE);
-
- $head = substr($text, 0, $table_begin[0][1]);
- $header = isset($table_contents_header[1]) ? $table_contents_header[1][0] : '';
- $tail = substr($text, $table_end[0][1] + strlen($table_end[0][0]));
- $tail = preg_replace('@^\s*<hr\s*/?>\s*@', '', $tail);
-
- $text = $head.$header.$tail;
- return $text;
- }
- }
-
- $parts = preg_split('@(?=<(p|blockquote))@', $text, 2);
- $header = $parts[0];
- $content = $parts[1];
-
- $header = preg_replace('@(<h\d>\s*)<img[^>]*src="(\.\.\/)*boost\.png"[^>]*>@', '$1', $header);
- $header = preg_replace('@<img[^>]*src="(\.\.\/)*boost\.png"[^>]*>\s*<[hb]r.*?>@', '', $header);
-
- return $header.$content;
-}
-


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