diff --git a/program/include/html.php b/program/include/html.php index c225f7d56..09485e519 100644 --- a/program/include/html.php +++ b/program/include/html.php @@ -5,7 +5,7 @@ | program/include/html.php | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2010, The Roundcube Dev Team | + | Copyright (C) 2005-2011, The Roundcube Dev Team | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -80,12 +80,12 @@ class html $tagname = self::$lc_tags ? strtolower($tagname) : $tagname; if (isset($content) || in_array($tagname, self::$containers)) { - $templ = $attrib['noclose'] ? "<%s%s>%s" : "<%s%s>%s%s"; - unset($attrib['noclose']); - return sprintf($templ, $tagname, self::attrib_string($attrib, $allowed_attrib), $content, $tagname, $suffix); + $suffix = $attrib['noclose'] ? $suffix : '' . $suffix; + unset($attrib['noclose'], $attrib['nl']); + return '<' . $tagname . self::attrib_string($attrib, $allowed_attrib) . '>' . $content . $suffix; } else { - return sprintf("<%s%s />%s", $tagname, self::attrib_string($attrib, $allowed_attrib), $suffix); + return '<' . $tagname . self::attrib_string($attrib, $allowed_attrib) . '>' . $suffix; } } @@ -219,7 +219,30 @@ class html $attr = array('src' => $attr); } return self::tag('iframe', $attr, $cont, array_merge(self::$common_attrib, - array('src','name','width','height','border','frameborder'))); + array('src','name','width','height','border','frameborder'))); + } + + /** + * Derrived method to create \n"; - protected $script_tag = "\n"; - protected $link_css_file = "\n"; protected $default_template = "\n\n\n"; protected $title = ''; @@ -195,13 +191,13 @@ class rcube_html_page // 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, $file); + $page_header .= html::script($file); } } $head_script = $this->scripts['head_top'] . $this->scripts['head']; if (!empty($head_script)) { - $page_header .= sprintf($this->script_tag, $head_script); + $page_header .= html::script(array(), $head_script); } if (!empty($this->header)) { @@ -215,7 +211,7 @@ class rcube_html_page if (is_array($this->script_files['foot'])) { foreach ($this->script_files['foot'] as $file) { - $page_footer .= sprintf($this->script_tag_file, $file); + $page_footer .= html::script($file); } } @@ -224,7 +220,7 @@ class rcube_html_page } if (!empty($this->scripts['foot'])) { - $page_footer .= sprintf($this->script_tag, $this->scripts['foot']); + $page_footer .= html::script(array(), $this->scripts['foot']); } // find page header @@ -266,7 +262,7 @@ class rcube_html_page ) { $css = ''; foreach ($this->css_files as $file) { - $css .= sprintf($this->link_css_file, $file); + $css .= html::tag('link', array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => $file, 'nl' => true)); } $output = substr_replace($output, $css, $pos, 0); }