From 8e99ffbcaccf83602a47b2be230eb4dd2f106399 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 13 May 2011 13:22:35 -0400
Subject: [PATCH] - Use less included files in mail and message templates for better performance - Add access to template name in template expressions

---
 program/include/rcube_template.php |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index 3131b39..8495ab8 100755
--- a/program/include/rcube_template.php
+++ b/program/include/rcube_template.php
@@ -38,6 +38,7 @@
     private $js_commands = array();
     private $object_handlers = array();
     private $plugin_skin_path;
+    private $template_name;
 
     public $browser;
     public $framed = false;
@@ -365,7 +366,9 @@
         $plugin    = false;
         $realname  = $name;
         $temp      = explode('.', $name, 2);
+
         $this->plugin_skin_path = null;
+        $this->template_name    = $realname;
 
         if (count($temp) > 1) {
             $plugin    = $temp[0];
@@ -600,7 +603,8 @@
                 '/env:([a-z0-9_]+)/i',
                 '/request:([a-z0-9_]+)/i',
                 '/cookie:([a-z0-9_]+)/i',
-                '/browser:([a-z0-9_]+)/i'
+                '/browser:([a-z0-9_]+)/i',
+                '/template:name/i',
             ),
             array(
                 "\$_SESSION['\\1']",
@@ -608,7 +612,8 @@
                 "\$this->env['\\1']",
                 "get_input_value('\\1', RCUBE_INPUT_GPC)",
                 "\$_COOKIE['\\1']",
-                "\$this->browser->{'\\1'}"
+                "\$this->browser->{'\\1'}",
+                $this->template_name,
             ),
             $expression);
     }

--
Gitblit v1.9.1