X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=program%2Finclude%2Frcube_html_page.php;h=77b7ff2d86db642ceab0a37b901419ce6e311c54;hb=76507f7c63a660742e76889ad6e3919f3dde3bb0;hp=78f6176bfd65cb6eeaa9ce61b3e50d10210c2afc;hpb=1213c6e65f2bab1e140369839a9d0f6db28a9492;p=roundcube.git
diff --git a/program/include/rcube_html_page.php b/program/include/rcube_html_page.php
index 78f6176..77b7ff2 100644
--- a/program/include/rcube_html_page.php
+++ b/program/include/rcube_html_page.php
@@ -4,8 +4,8 @@
+-----------------------------------------------------------------------+
| program/include/rcube_html_page.php |
| |
- | This file is part of the RoundCube PHP suite |
- | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland |
+ | This file is part of the Roundcube PHP suite |
+ | Copyright (C) 2005-2011 The Roundcube Dev Team |
| Licensed under the GNU GPL |
| |
| CONTENTS: |
@@ -15,7 +15,7 @@
| Author: Thomas Bruederli |
+-----------------------------------------------------------------------+
- $Id: $
+ $Id: rcube_html_page.php 5135 2011-08-26 09:22:53Z alec $
*/
@@ -28,17 +28,20 @@ class rcube_html_page
{
protected $scripts_path = '';
protected $script_files = array();
+ protected $css_files = array();
protected $scripts = array();
- protected $charset = 'UTF-8';
+ protected $charset = RCMAIL_CHARSET;
- protected $script_tag_file = "\n";
- protected $script_tag = "\n";
+ protected $script_tag_file = "\n";
+ protected $script_tag = "\n";
+ protected $link_css_file = "\n";
protected $default_template = "\n\n\n";
protected $title = '';
protected $header = '';
protected $footer = '';
protected $body = '';
+ protected $base_path = '';
/** Constructor */
@@ -53,10 +56,16 @@ class rcube_html_page
public function include_script($file, $position='head')
{
static $sa_files = array();
+
+ if (!preg_match('|^https?://|i', $file) && $file[0] != '/')
+ $file = $this->scripts_path . $file . (($fs = @filemtime($this->scripts_path . $file)) ? '?s='.$fs : '');
if (in_array($file, $sa_files)) {
return;
}
+
+ $sa_files[] = $file;
+
if (!is_array($this->script_files[$position])) {
$this->script_files[$position] = array();
}
@@ -78,8 +87,20 @@ class rcube_html_page
}
}
+ /**
+ * Link an external css file
+ *
+ * @param string File URL
+ */
+ public function include_css($file)
+ {
+ $this->css_files[] = $file;
+ }
+
/**
* Add HTML code to the page header
+ *
+ * @param string $str HTML code
*/
public function add_header($str)
{
@@ -89,6 +110,8 @@ class rcube_html_page
/**
* Add HTML code to the page footer
* To be added right befor
') {
$hpos++;
}
$hpos++;
}
- $__page_header = "\n$__page_title\n$__page_header\n\n";
+ $page_header = "\n$page_title\n$page_header\n\n";
}
// add page hader
if ($hpos) {
- $output = substr($output,0,$hpos) . $__page_header . substr($output,$hpos,strlen($output));
+ $output = substr_replace($output, $page_header, $hpos, 0);
}
else {
- $output = $__page_header . $output;
+ $output = $page_header . $output;
}
- // find page body
- if ($bpos = strpos(strtolower($output), '') {
- $bpos++;
- }
- $bpos++;
+ // add page footer
+ if (($fpos = strripos($output, '')) || ($fpos = strripos($output, '