*/
class ContentProvider {
- private static $template_cache = array();
+ private static $template_cache = array();
private static $overall_content = array();
private $template, $subtemplate;
private $content = array();
- public function __construct($template, $subtemplate, $content = null) {
+ public function __construct($template, $subtemplate, $content = null) {
$this->template = $template;
$this->subtemplate = $subtemplate;
$this->content = $content;
}
}
-
+
public function set($name, $value) {
$this->content[strtolower($name)] = $value;
}
case "rendertime":
$rep = "%rendertime%"; //gets replaced later
break;
+ case "template_path":
+ $rep = 'templates/'.(GitConfig::TEMPLATE_NAME ? GitConfig::TEMPLATE_NAME : 'default');
+ break;
default:
if(array_key_exists($var, $this->content)) {
$rep = $this->resolve_content($this->content[$var]);
else {
$template_html = $this->load_template($this->template, $subtemplate);
}
- $template_html = preg_replace_callback('/%([^%]*)%/', array($this, "replace_placeholder"), $template_html);
- $template_html = preg_replace_callback('/%([^%]*)%/', array($this, "replace_placeholder"), $template_html);
+ $template_html = preg_replace('/([\r\n]*)$/mD', '', $template_html);
+ $template_html = preg_replace_callback('/%([^%\n]*)%/', array($this, "replace_placeholder"), $template_html);
+ $template_html = preg_replace_callback('/%([^%\n]*)%/', array($this, "replace_placeholder"), $template_html);
return $template_html;
}