diff -r de56132c008d -r bdac73ed481e includes/output.php --- a/includes/output.php Sun Mar 28 21:49:26 2010 -0400 +++ b/includes/output.php Sun Mar 28 23:10:46 2010 -0400 @@ -20,111 +20,111 @@ abstract class Output_Base { - /** - * Page title - * @var string - */ - - public $title = 'Untitled'; - - /** - * To allow scripts to determine whether we are outputting headers or not. - * @var bool - */ - - public $naked = false; - - /** - * Added content - * @var string - * @var string - * @var string - * @var string - */ - - public $before_header = '', $after_header = '', $before_footer = '', $after_footer = ''; - - /** - * Call this to send content headers (e.g. the first third of the document if HTML) in place of $template->header(). - * @access public - */ - - abstract public function header(); - - /** - * Call this to send extra stuff after the content (equivalent of $template->footer()). - * @access public - */ - - abstract public function footer(); - - /** - * Add some code just before the header. - * @access public - */ - - public function add_before_header($code) - { - $this->before_header .= $code; - } - - /** - * Add some code just after the header. - * @access public - */ - - public function add_after_header($code) - { - $this->after_header .= $code; - } - - /** - * Add some code just before the footer. - * @access public - */ - - public function add_before_footer($code) - { - $this->before_footer .= $code; - } - - /** - * Add some code just after the footer. - * @access public - */ - - public function add_after_footer($code) - { - $this->after_footer .= $code; - } - - /** - * Send any required HTML headers through, e.g. Content-type. - * @access public - */ - - public function http_headers() - { - header('Content-type: text/html'); - } - - /** - * Set the title of the page being output. - * @param string Page name - */ - - public function set_title($title) - { - $this->title = $title; - } - - /** - * Avoid sending things out of order. - * @var bool - * @var bool - */ - - public $headers_sent = false, $footers_sent = false; + /** + * Page title + * @var string + */ + + public $title = 'Untitled'; + + /** + * To allow scripts to determine whether we are outputting headers or not. + * @var bool + */ + + public $naked = false; + + /** + * Added content + * @var string + * @var string + * @var string + * @var string + */ + + public $before_header = '', $after_header = '', $before_footer = '', $after_footer = ''; + + /** + * Call this to send content headers (e.g. the first third of the document if HTML) in place of $template->header(). + * @access public + */ + + abstract public function header(); + + /** + * Call this to send extra stuff after the content (equivalent of $template->footer()). + * @access public + */ + + abstract public function footer(); + + /** + * Add some code just before the header. + * @access public + */ + + public function add_before_header($code) + { + $this->before_header .= $code; + } + + /** + * Add some code just after the header. + * @access public + */ + + public function add_after_header($code) + { + $this->after_header .= $code; + } + + /** + * Add some code just before the footer. + * @access public + */ + + public function add_before_footer($code) + { + $this->before_footer .= $code; + } + + /** + * Add some code just after the footer. + * @access public + */ + + public function add_after_footer($code) + { + $this->after_footer .= $code; + } + + /** + * Send any required HTML headers through, e.g. Content-type. + * @access public + */ + + public function http_headers() + { + header('Content-type: text/html'); + } + + /** + * Set the title of the page being output. + * @param string Page name + */ + + public function set_title($title) + { + $this->title = $title; + } + + /** + * Avoid sending things out of order. + * @var bool + * @var bool + */ + + public $headers_sent = false, $footers_sent = false; } /** @@ -133,62 +133,62 @@ class Output_HTML extends Output_Base { - public function header() - { - if ( $this->headers_sent ) - return; - - $this->headers_sent = true; - - ob_start(); - } - - public function footer() - { - global $template; - if ( !$this->headers_sent ) - return; - - $this->headers_sent = false; - $content = ob_get_contents(); - ob_end_clean(); - - ob_start(); - echo $this->before_header; - echo $template->getHeader(); - echo $this->after_header; - echo $content; - echo $this->before_footer; - echo $template->getFooter(); - echo $this->after_footer; - - global $aggressive_optimize_html; - if ( $aggressive_optimize_html ) - { - $content = ob_get_contents(); - ob_end_clean(); - - ob_start(); - echo aggressive_optimize_html($content); - } - else - { - $content = ob_get_contents(); - ob_end_clean(); - - ob_start(); - echo preg_replace('~~', '', $content); - } - - } - - public function set_title($title) - { - global $template; - $template->assign_vars(array( - 'PAGE_NAME' => htmlspecialchars($title) - )); - } + public function header() + { + if ( $this->headers_sent ) + return; + + $this->headers_sent = true; + + ob_start(); + } + + public function footer() + { + global $template; + if ( !$this->headers_sent ) + return; + + $this->headers_sent = false; + $content = ob_get_contents(); + ob_end_clean(); + + ob_start(); + echo $this->before_header; + echo $template->getHeader(); + echo $this->after_header; + echo $content; + echo $this->before_footer; + echo $template->getFooter(); + echo $this->after_footer; + + global $aggressive_optimize_html; + if ( $aggressive_optimize_html ) + { + $content = ob_get_contents(); + ob_end_clean(); + + ob_start(); + echo aggressive_optimize_html($content); + } + else + { + $content = ob_get_contents(); + ob_end_clean(); + + ob_start(); + echo preg_replace('~~', '', $content); + } + + } + + public function set_title($title) + { + global $template; + $template->assign_vars(array( + 'PAGE_NAME' => htmlspecialchars($title) + )); + } } /** @@ -197,43 +197,43 @@ class Output_HTML_Simple extends Output_HTML { - public function footer() - { - global $template; - if ( !$this->headers_sent ) - return; - - $this->headers_sent = false; - $content = ob_get_contents(); - ob_end_clean(); - - ob_start(); - echo $this->before_header; - echo $template->getHeader(true); - echo $this->after_header; - echo $content; - echo $this->before_footer; - echo $template->getFooter(true); - echo $this->after_footer; - - global $aggressive_optimize_html; - if ( $aggressive_optimize_html ) - { - $content = ob_get_contents(); - ob_end_clean(); - - ob_start(); - echo aggressive_optimize_html($content); - } - else - { - $content = ob_get_contents(); - ob_end_clean(); - - ob_start(); - echo preg_replace('~~', '', $content); - } - } + public function footer() + { + global $template; + if ( !$this->headers_sent ) + return; + + $this->headers_sent = false; + $content = ob_get_contents(); + ob_end_clean(); + + ob_start(); + echo $this->before_header; + echo $template->getHeader(true); + echo $this->after_header; + echo $content; + echo $this->before_footer; + echo $template->getFooter(true); + echo $this->after_footer; + + global $aggressive_optimize_html; + if ( $aggressive_optimize_html ) + { + $content = ob_get_contents(); + ob_end_clean(); + + ob_start(); + echo aggressive_optimize_html($content); + } + else + { + $content = ob_get_contents(); + ob_end_clean(); + + ob_start(); + echo preg_replace('~~', '', $content); + } + } } /** @@ -242,17 +242,17 @@ class Output_Striptease extends Output_HTML { - public function header() - { - echo $this->before_header; - echo $this->after_header; - } - - public function footer() - { - echo $this->before_footer; - echo $this->after_footer; - } + public function header() + { + echo $this->before_header; + echo $this->after_header; + } + + public function footer() + { + echo $this->before_footer; + echo $this->after_footer; + } } /** @@ -261,15 +261,15 @@ class Output_Naked extends Output_HTML { - public $naked = true; - - public function header() - { - } - - public function footer() - { - } + public $naked = true; + + public function header() + { + } + + public function footer() + { + } } /** @@ -278,47 +278,47 @@ class Output_Safe { - protected $template; - protected $headers_sent = false; - public function __construct() - { - $this->template = new template_nodb(); - $theme = ( defined('ENANO_CONFIG_FETCHED') ) ? getConfig('theme_default') : 'oxygen'; - $style = ( defined('ENANO_CONFIG_FETCHED') ) ? '__foo__' : 'bleu'; - - $this->template->load_theme($theme, $style); - $this->template->tpl_strings['SITE_NAME'] = getConfig('site_name'); - $this->template->tpl_strings['SITE_DESC'] = getConfig('site_desc'); - $this->template->tpl_strings['COPYRIGHT'] = getConfig('copyright_notice'); - $this->template->tpl_strings['PAGE_NAME'] = 'Untitled'; - } - public function header() - { - if ( $this->headers_sent ) - return; - - $this->headers_sent = true; - - $this->template->header(); - } - - public function footer() - { - global $template; - if ( !$this->headers_sent ) - { - $this->template->header(); - } - - $this->headers_sent = false; - $this->template->footer(); - - } - - public function set_title($title) - { - $this->template->tpl_strings['PAGE_NAME'] = $title; - } + protected $template; + protected $headers_sent = false; + public function __construct() + { + $this->template = new template_nodb(); + $theme = ( defined('ENANO_CONFIG_FETCHED') ) ? getConfig('theme_default') : 'oxygen'; + $style = ( defined('ENANO_CONFIG_FETCHED') ) ? '__foo__' : 'bleu'; + + $this->template->load_theme($theme, $style); + $this->template->tpl_strings['SITE_NAME'] = getConfig('site_name'); + $this->template->tpl_strings['SITE_DESC'] = getConfig('site_desc'); + $this->template->tpl_strings['COPYRIGHT'] = getConfig('copyright_notice'); + $this->template->tpl_strings['PAGE_NAME'] = 'Untitled'; + } + public function header() + { + if ( $this->headers_sent ) + return; + + $this->headers_sent = true; + + $this->template->header(); + } + + public function footer() + { + global $template; + if ( !$this->headers_sent ) + { + $this->template->header(); + } + + $this->headers_sent = false; + $this->template->footer(); + + } + + public function set_title($title) + { + $this->template->tpl_strings['PAGE_NAME'] = $title; + } } ?>