[pLog-svn] r5885 - in plog/branches/lifetype-1.2/class: dao summary/data summary/mail template

oscar at devel.lifetype.net oscar at devel.lifetype.net
Sat Sep 1 15:09:14 EDT 2007


Author: oscar
Date: 2007-09-01 15:09:13 -0400 (Sat, 01 Sep 2007)
New Revision: 5885

Modified:
   plog/branches/lifetype-1.2/class/dao/articlenotifications.class.php
   plog/branches/lifetype-1.2/class/summary/data/summarytools.class.php
   plog/branches/lifetype-1.2/class/summary/mail/confirmemailmessage.class.php
   plog/branches/lifetype-1.2/class/template/template.class.php
Log:
Do not run the trim_whitespace filter in templates that will be used as emails, or else they will look kind of strange. Template::forceDisableTrimWhitespace is the attribute used to control this behaviour in the Template class, by the way.


Modified: plog/branches/lifetype-1.2/class/dao/articlenotifications.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/dao/articlenotifications.class.php	2007-08-31 18:48:06 UTC (rev 5884)
+++ plog/branches/lifetype-1.2/class/dao/articlenotifications.class.php	2007-09-01 19:09:13 UTC (rev 5885)
@@ -131,6 +131,8 @@
          	// create a new template service
          	$ts = new TemplateService();
             $messageTemplate = $ts->Template( EMAILNOTIFIER_TEMPLATE, "misc" );
+			// do not remove blank spaces, or else emails will look kind of weird
+			$messageTemplate->forceDisableTrimWhitespace = true;
             // add these two useful objects
 			$rg = $blogInfo->getBlogRequestGenerator();
 			// disable the xhtml mode, as some email clients cannot deal with it

Modified: plog/branches/lifetype-1.2/class/summary/data/summarytools.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/data/summarytools.class.php	2007-08-31 18:48:06 UTC (rev 5884)
+++ plog/branches/lifetype-1.2/class/summary/data/summarytools.class.php	2007-09-01 19:09:13 UTC (rev 5885)
@@ -29,6 +29,7 @@
 			// prepare the template
             $templateService = new TemplateService();
             $template = $templateService->Template( "resetpasswordemail", "summary" );
+			$template->forceDisableTrimWhitespace = true;
             $template->assign( "locale", $this->_locale );
 			$template->assign( "reseturl", $url );
 			

Modified: plog/branches/lifetype-1.2/class/summary/mail/confirmemailmessage.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/summary/mail/confirmemailmessage.class.php	2007-08-31 18:48:06 UTC (rev 5884)
+++ plog/branches/lifetype-1.2/class/summary/mail/confirmemailmessage.class.php	2007-09-01 19:09:13 UTC (rev 5885)
@@ -44,6 +44,7 @@
         // create a new template service
         $ts = new TemplateService();
         $messageTemplate = $ts->Template( $templateid,$templateFolder );
+		$messageTemplate->forceDisableTrimWhitespace = true;
         $messageTemplate->assign("username",$this->username);
         $messageTemplate->assign("activeCode",$this->activeCode);
         $messageTemplate->assign("activeLink",$this->activeLink);

Modified: plog/branches/lifetype-1.2/class/template/template.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/template/template.class.php	2007-08-31 18:48:06 UTC (rev 5884)
+++ plog/branches/lifetype-1.2/class/template/template.class.php	2007-09-01 19:09:13 UTC (rev 5885)
@@ -59,6 +59,12 @@
 
 		// whether to use the template load order settings
 		var $useTemplateLoadOrder = false;
+		
+		/**
+		 * Do not load the trim_whitespace plugin
+		 * @public
+		 */
+		var $forceDisableTrimWhitespace;
 
         /**
          * Constructor. 
@@ -74,8 +80,11 @@
             $config =& Config::getConfig();
             $this->cache_dir    = $config->getValue( 'temp_folder' );
 
-            $this->_templateFile = $templateFile;            
+            $this->_templateFile = $templateFile;
 
+			// we want to load the plugin by default...
+            $this->forceDisableTrimWhitespace = false;
+
             // enable the security settings
             $this->php_handling = false;
             	
@@ -92,10 +101,7 @@
             $this->use_sub_dirs = false;
 
 			// register dynamic block for every template instance
-			$this->register_block('dynamic', 'smarty_block_dynamic', false);
-			
-			if( $config->getValue( 'trim_whitespace_output' ))
-				$this->load_filter( 'output', 'trimwhitespace' );			
+			$this->register_block('dynamic', 'smarty_block_dynamic', false);			
         }
 
 	    /**
@@ -191,6 +197,16 @@
             return $this->_templateFile;
         }
 
+		/**
+		 * Load all the required smarty filters
+		 */
+		function loadFilters()
+		{
+			$config =& Config::getConfig();
+			if( $config->getValue( 'trim_whitespace_output' ) && !$this->forceDisableTrimWhitespace )
+				$this->load_filter( 'output', 'trimwhitespace' );
+		}
+
         /**
          * Renders the template and returns the contents as an string
          *
@@ -198,6 +214,7 @@
          */
         function fetch()
         {
+			$this->loadFilters();
             return Smarty::fetch( $this->getTemplateFile());
         }
 
@@ -208,6 +225,7 @@
          */
         function display()
         {
+			$this->loadFilters();	
             return Smarty::display( $this->getTemplateFile());
         }
         



More information about the pLog-svn mailing list