Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65597 - website/public_html/beta/common/code
From: dnljms_at_[hidden]
Date: 2010-09-26 08:49:14


Author: danieljames
Date: 2010-09-26 08:49:12 EDT (Sun, 26 Sep 2010)
New Revision: 65597
URL: http://svn.boost.org/trac/boost/changeset/65597

Log:
Just use text parameters in template.

Still messy but a bit better.
Text files modified:
   website/public_html/beta/common/code/boost_archive.php | 69 +++++++++++----------------------------
   website/public_html/beta/common/code/boost_filter_boost_book_html.php | 4 +-
   website/public_html/beta/common/code/boost_filter_boost_frame1.php | 4 +-
   website/public_html/beta/common/code/boost_filter_boost_libs.php | 8 ----
   website/public_html/beta/common/code/boost_filter_cpp.php | 11 +++--
   website/public_html/beta/common/code/boost_filter_text.php | 23 ++++++++-----
   website/public_html/beta/common/code/template.php | 6 +-
   7 files changed, 47 insertions(+), 78 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-09-26 08:49:12 EDT (Sun, 26 Sep 2010)
@@ -6,7 +6,7 @@
 */
 require_once(dirname(__FILE__) . '/boost.php');
 
-define('BOOST_DOCS_MODIFIED_DATE', 'Tue, 7 Sep 2010 23:30:00 +0100');
+define('BOOST_DOCS_MODIFIED_DATE', 'Tue, 21 Sep 2010 22:19:30 +0100');
 
 function get_archive_location(
     $pattern,
@@ -209,32 +209,19 @@
 
 // General purpose render callbacks.
 
-class boost_archive_render_callbacks {
- var $content_callback, $params;
-
- function boost_archive_render_callbacks($content, $params) {
- $this->content_callback = $content;
- $this->archive = $params;
- }
-
- function content_head()
- {
- $charset = $this->archive['charset'] ? $this->archive['charset'] : 'us-ascii';
- $title = $this->archive['title'] ? 'Boost C++ Libraries - '.$this->archive['title'] : 'Boost C++ Libraries';
+function boost_archive_render_callbacks($content, $params) {
+ $charset = $params['charset'] ? $params['charset'] : 'us-ascii';
+ $title = $params['title'] ? 'Boost C++ Libraries - '.$params['title'] : 'Boost C++ Libraries';
 
- print <<<HTML
+ $head = <<<HTML
 <meta http-equiv="Content-Type" content="text/html; charset=${charset}" />
 <title>${title}</title>
 HTML;
- }
-
- function content()
- {
- if ($this->content_callback)
- {
- call_user_func($this->content_callback, $this->archive);
- }
- }
+
+ return Array(
+ 'head' => $head,
+ 'content' => $content
+ );
 }
 
 function display_raw_file($params, $type)
@@ -309,35 +296,18 @@
     }
 
     header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
- display_template($params['template'],
- new file_not_found_render_callbacks($params['file'],
- $params['zipfile'] ? "Unzip error: $message" : $message));
-}
 
-class file_not_found_render_callbacks
-{
- var $file, $message;
-
- function file_not_found_render_callbacks($file, $message) {
- $this->file = $file;
- $this->message = $message;
- }
-
- function content_head()
- {
- print <<<HTML
+ $head = <<<HTML
   <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
   <title>Boost C++ Libraries - 404 Not Found</title>
 HTML;
- }
-
- function content()
- {
- print '<h1>404 Not Found</h1><p>File "' . $this->file . '" not found.</p>';
- if($this->message) {
- print '<p>'.htmlentities($this->message).'</p>';
- }
- }
+
+ $content = '<h1>404 Not Found</h1><p>File "' . $params['file'] . '" not found.</p><p>';
+ if($params['zipfile']) $content .= "Unzip error: ";
+ $content .= htmlentities($message);
+ $content .= '</p>';
+
+ display_template($params['template'], Array('head' => $head, 'content' => $content));
 }
 
 /*
@@ -387,8 +357,7 @@
 
 // Display the content in the standard boost template
 
-function display_template($template, $callbacks) {
- $_file = $callbacks;
+function display_template($template, $_file) {
     include($template);
 }
 

Modified: website/public_html/beta/common/code/boost_filter_boost_book_html.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_boost_book_html.php (original)
+++ website/public_html/beta/common/code/boost_filter_boost_book_html.php 2010-09-26 08:49:12 EDT (Sun, 26 Sep 2010)
@@ -10,7 +10,7 @@
 function boost_book_html_filter($params) {
     html_init($params);
     display_template($params['template'],
- new boost_archive_render_callbacks('boost_book_html_filter_content', $params));
+ boost_archive_render_callbacks(boost_book_html_filter_content($params), $params));
 }
 
 function boost_book_html_filter_content($params)
@@ -35,5 +35,5 @@
     }
     ##
     
- print $text;
+ return $text;
 }

Modified: website/public_html/beta/common/code/boost_filter_boost_frame1.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_boost_frame1.php (original)
+++ website/public_html/beta/common/code/boost_filter_boost_frame1.php 2010-09-26 08:49:12 EDT (Sun, 26 Sep 2010)
@@ -10,7 +10,7 @@
 function boost_frame1_filter($params) {
     html_init($params);
     display_template($params['template'],
- new boost_archive_render_callbacks(new boost_frame1_filter_content, $params));
+ boost_archive_render_callbacks(boost_frame1_filter_content($params), $params));
 }
 
 function boost_frame1_filter_content($params)
@@ -32,5 +32,5 @@
         '',
         $text );
     
- print $text;
+ return $text;
 }

Modified: website/public_html/beta/common/code/boost_filter_boost_libs.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_boost_libs.php (original)
+++ website/public_html/beta/common/code/boost_filter_boost_libs.php 2010-09-26 08:49:12 EDT (Sun, 26 Sep 2010)
@@ -15,21 +15,15 @@
         $text = prepare_html($text, true);
         $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));
+ boost_archive_render_callbacks($text, $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',

Modified: website/public_html/beta/common/code/boost_filter_cpp.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_cpp.php (original)
+++ website/public_html/beta/common/code/boost_filter_cpp.php 2010-09-26 08:49:12 EDT (Sun, 26 Sep 2010)
@@ -11,13 +11,14 @@
     $params['title'] = htmlentities($params['key']);
 
     display_template($params['template'],
- new boost_archive_render_callbacks('cpp_filter_content', $params));
+ boost_archive_render_callbacks(cpp_filter_content($params), $params));
 }
 
 function cpp_filter_content($params)
 {
- print "<h3>".htmlentities($params['key'])."</h3>\n";
- print "<pre>\n";
- print_encoded_text($params, 'cpp');
- print "</pre>\n";
+ return
+ "<h3>".htmlentities($params['key'])."</h3>\n".
+ "<pre>\n".
+ encoded_text($params, 'cpp').
+ "</pre>\n";
 }

Modified: website/public_html/beta/common/code/boost_filter_text.php
==============================================================================
--- website/public_html/beta/common/code/boost_filter_text.php (original)
+++ website/public_html/beta/common/code/boost_filter_text.php 2010-09-26 08:49:12 EDT (Sun, 26 Sep 2010)
@@ -10,21 +10,24 @@
     $params['title'] = htmlentities($params['key']);
 
     display_template($params['template'],
- new boost_archive_render_callbacks('text_filter_content', $params));
+ boost_archive_render_callbacks(text_filter_content($params), $params));
 }
 
 function text_filter_content($params)
 {
- print "<h3>".htmlentities($params['key'])."</h3>\n";
- print "<pre>\n";
- print_encoded_text($params, 'text');
- print "</pre>\n";
+ return
+ "<h3>".htmlentities($params['key'])."</h3>\n".
+ "<pre>\n".
+ encoded_text($params, 'text').
+ "</pre>\n";
 }
 
 // This takes a plain text file and outputs encoded html with marked
 // up links.
 
-function print_encoded_text($params, $type) {
+function encoded_text($params, $type) {
+ $text = '';
+
     $root = dirname(preg_replace('@([^/]+/)@','../',$params['key']));
 
     // John Gruber's regular expression for finding urls
@@ -49,18 +52,20 @@
                     $html );
             }
 
- print $html;
+ $text .= $html;
         }
         else {
             $url = process_absolute_url($part, $root);
             if($url) {
- print ''.htmlentities($part).'';
+ $text .= ''.htmlentities($part).'';
             }
             else {
- print htmlentities($part);
+ $text .= htmlentities($part);
             }
        }
     }
+
+ return $text;
 }
 
 function process_absolute_url($url, $root = null) {

Modified: website/public_html/beta/common/code/template.php
==============================================================================
--- website/public_html/beta/common/code/template.php (original)
+++ website/public_html/beta/common/code/template.php 2010-09-26 08:49:12 EDT (Sun, 26 Sep 2010)
@@ -3,12 +3,12 @@
 
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
- <?php $_file->content_head(); ?>
+ <?php echo $_file['head']; ?>
   <link rel="icon" href="/favicon.ico" type="image/ico" />
   <link rel="stylesheet" type="text/css" href="/style-v2/section-doc.css" />
   <!--[if IE 7]> <style type="text/css"> body { behavior: url(/style-v2/csshover3.htc); } </style> <![endif]-->
 
-</head><!-- <?php print $_file->file_; ?> -->
+</head>
 
 <body>
   <div id="heading">
@@ -21,7 +21,7 @@
         <div class="section" id="docs">
           <div class="section-0">
             <div class="section-body">
- <?php $_file->content(); ?>
+ <?php echo $_file['content']; ?>
             </div>
           </div>
         </div>


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