| +-----------------------------------------------------------------------+ $Id$ */ // ********* round cube schared classes ********* class rcube_html_page { var $css; var $scripts_path = ''; var $script_files = array(); var $scripts = array(); var $charset = 'ISO-8859-1'; var $script_tag_file = "\n"; var $script_tag = "\n"; var $title = ''; var $header = ''; var $footer = ''; var $body = ''; var $body_attrib = array(); var $meta_tags = array(); // PHP 5 constructor function __construct() { $this->css = new rcube_css(); } // PHP 4 compatibility function rcube_html_page() { $this->__construct(); } function include_script($file, $position='head') { static $sa_files = array(); if (in_array($file, $sa_files)) return; if (!is_array($this->script_files[$position])) $this->script_files[$position] = array(); $this->script_files[$position][] = $file; } function add_script($script, $position='head') { if (!isset($this->scripts[$position])) $this->scripts[$position] = ''; $this->scripts[$position] .= "\n$script"; } function set_title() { } function set_charset($charset) { $this->charset = $charset; } function get_charset() { return $this->charset; } function write($templ='', $base_path='') { $output = trim($templ); // set default page title if (!strlen($this->title)) $this->title = 'RoundCube|Mail'; // replace specialchars in content $__page_title = rep_specialchars_output($this->title, 'html', 'show', FALSE); $__page_header = $__page_body = $__page_footer = ''; // include meta tag with charset if (!empty($this->charset)) $__page_header = ''."\n";; // definition of the code to be placed in the document header and footer if (is_array($this->script_files['head'])) foreach ($this->script_files['head'] as $file) $__page_header .= sprintf($this->script_tag_file, $this->scripts_path, $file); if (strlen($this->scripts['head'])) $__page_header .= sprintf($this->script_tag, $this->scripts['head']); if (is_array($this->script_files['foot'])) foreach ($this->script_files['foot'] as $file) $__page_footer .= sprintf($this->script_tag_file, $this->scripts_path, $file); if (strlen($this->scripts['foot'])) $__page_footer .= sprintf($this->script_tag, $this->scripts['foot']); $__page_header .= $this->css->show(); // find page header if($hpos = strpos(strtolower($output), '')) $__page_header .= "\n"; else { if (!is_numeric($hpos)) $hpos = strpos(strtolower($output), '
') $hpos++; $hpos++; } $__page_header = "\n