[pLog-svn] r953 - plog/trunk/class/net

oscar at devel.plogworld.net oscar at devel.plogworld.net
Sat Feb 5 17:59:27 GMT 2005


Author: oscar
Date: 2005-02-05 17:59:27 +0000 (Sat, 05 Feb 2005)
New Revision: 953

Modified:
   plog/trunk/class/net/baserequestgenerator.class.php
   plog/trunk/class/net/customrequestgenerator.class.php
   plog/trunk/class/net/modrewriterequestgenerator.class.php
   plog/trunk/class/net/prettyrequestgenerator.class.php
   plog/trunk/class/net/rawrequestgenerator.class.php
Log:
moved getTemplateFile() to BaseRequestGenerator::getTemplateFile() so that all request generators can share the method instead of each one of them having a copy!

Modified: plog/trunk/class/net/baserequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/baserequestgenerator.class.php	2005-02-05 16:12:34 UTC (rev 952)
+++ plog/trunk/class/net/baserequestgenerator.class.php	2005-02-05 17:59:27 UTC (rev 953)
@@ -433,9 +433,42 @@
 
         }
 		
+        
 		/**
 		 * generates the correct path to a file in the template folder, without having to worry
 		 * whether the template was installed in /templates/ or in /templates/blog_X/
+		 *
+		 * @param file
+		 * @return A string
+		 */
+		function getTemplateFile( $file )
+		{
+		    // get the current template set
+		    $blogSettings = $this->_blogInfo->getSettings();
+		    $template = $blogSettings->getValue( "template" );
+		    
+		    // define this couple of things
+        	$baseUrl = $this->getBaseUrl( $abs );
+            $url = "$baseUrl/templates/";
+		    		    
+		    // is it a blog template?
+		    $blogTemplates = $blogSettings->getValue( "blog_templates" );
+		    
+		    if( !is_array($blogTemplates ))
+		        $url .= "$template/$file";
+		    else {
+		        if( in_array( $template, $blogTemplates ))
+		          $url .= "blog_".$this->_blogInfo->getId()."/$template/$file";
+		        else
+		          $url .= "$template/$file";
+		    }
+		    
+            return $url;		    
+		}		
+		
+		/**
+		 * generates the correct path to a file in the template folder, without having to worry
+		 * whether the template was installed in /templates/ or in /templates/blog_X/
 		 * This is locale-aware version.
 		 *
 		 * @param file

Modified: plog/trunk/class/net/customrequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/customrequestgenerator.class.php	2005-02-05 16:12:34 UTC (rev 952)
+++ plog/trunk/class/net/customrequestgenerator.class.php	2005-02-05 17:59:27 UTC (rev 953)
@@ -466,37 +466,5 @@
             
             return $result;
         }
-        
-		/**
-		 * generates the correct path to a file in the template folder, without having to worry
-		 * whether the template was installed in /templates/ or in /templates/blog_X/
-		 *
-		 * @param file
-		 * @return A string
-		 */
-		function getTemplateFile( $file )
-		{
-		    // get the current template set
-		    $blogSettings = $this->_blogInfo->getSettings();
-		    $template = $blogSettings->getValue( "template" );
-		    
-		    // define this couple of things
-        	$baseUrl = $this->getBaseUrl();
-            $url = "$baseUrl/templates/";
-		    		    
-		    // is it a blog template?
-		    $blogTemplates = $blogSettings->getValue( "blog_templates" );
-		    
-		    if( !is_array($blogTemplates ))
-		        $url .= "$template/$file";
-		    else {
-		        if( in_array( $template, $blogTemplates ))
-		          $url .= "blog_".$this->_blogInfo->getId()."/$template/$file";
-		        else
-		          $url .= "$template/$file";
-		    }
-		    
-            return $url;		    
-		}
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/net/modrewriterequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/modrewriterequestgenerator.class.php	2005-02-05 16:12:34 UTC (rev 952)
+++ plog/trunk/class/net/modrewriterequestgenerator.class.php	2005-02-05 17:59:27 UTC (rev 953)
@@ -401,37 +401,5 @@
 
             return $request;
         }
-
-		/**
-		 * generates the correct path to a file in the template folder, without having to worry
-		 * whether the template was installed in /templates/ or in /templates/blog_X/
-		 *
-		 * @param file
-		 * @return A string
-		 */
-		function getTemplateFile( $file )
-		{
-		    // get the current template set
-		    $blogSettings = $this->_blogInfo->getSettings();
-		    $template = $blogSettings->getValue( "template" );
-		    
-		    // define this couple of things
-        	$baseUrl = $this->getBaseUrl( $abs );
-            $url = "$baseUrl/templates/";
-		    		    
-		    // is it a blog template?
-		    $blogTemplates = $blogSettings->getValue( "blog_templates" );
-		    
-		    if( !is_array($blogTemplates ))
-		        $url .= "$template/$file";
-		    else {
-		        if( in_array( $template, $blogTemplates ))
-		          $url .= "blog_".$this->_blogInfo->getId()."/$template/$file";
-		        else
-		          $url .= "$template/$file";
-		    }
-		    
-            return $url;		    
-		}
     }
 ?>

Modified: plog/trunk/class/net/prettyrequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/prettyrequestgenerator.class.php	2005-02-05 16:12:34 UTC (rev 952)
+++ plog/trunk/class/net/prettyrequestgenerator.class.php	2005-02-05 17:59:27 UTC (rev 953)
@@ -353,38 +353,5 @@
         	throw( new Exception( "PrettyRequestGenerator::getRequest: function not implemented" ));
             die();
         }
-        
-		/**
-		 * generates the correct path to a file in the template folder, without having to worry
-		 * whether the template was installed in /templates/ or in /templates/blog_X/
-		 *
-		 * @param file
-		 * @return A string
-		 */
-		function getTemplateFile( $file )
-		{
-		    // get the current template set
-		    $blogSettings = $this->_blogInfo->getSettings();
-		    $template = $blogSettings->getValue( "template" );
-		    
-		    // define this couple of things
-        	$baseUrl = $this->getBaseUrl( $abs );
-            $url = "$baseUrl/templates/";
-		    		    
-		    // is it a blog template?
-		    $blogTemplates = $blogSettings->getValue( "blog_templates" );
-		    
-		    if( !is_array($blogTemplates ))
-		        $url .= "$template/$file";
-		    else {
-		        if( in_array( $template, $blogTemplates ))
-		          $url .= "blog_".$this->_blogInfo->getId()."/$template/$file";
-		        else
-		          $url .= "$template/$file";
-		    }
-		    
-            return $url;		    
-		}        
-        
     }
 ?>

Modified: plog/trunk/class/net/rawrequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/rawrequestgenerator.class.php	2005-02-05 16:12:34 UTC (rev 952)
+++ plog/trunk/class/net/rawrequestgenerator.class.php	2005-02-05 17:59:27 UTC (rev 953)
@@ -471,37 +471,5 @@
 
             return $request;
         }
-		
-		/**
-		 * generates the correct path to a file in the template folder, without having to worry
-		 * whether the template was installed in /templates/ or in /templates/blog_X/
-		 *
-		 * @param file
-		 * @return A string
-		 */
-		function getTemplateFile( $file )
-		{
-		    // get the current template set
-		    $blogSettings = $this->_blogInfo->getSettings();
-		    $template = $blogSettings->getValue( "template" );
-		    
-		    // define this couple of things
-        	$baseUrl = $this->getBaseUrl();
-            $url = "$baseUrl/templates/";
-		    		    
-		    // is it a blog template?
-		    $blogTemplates = $blogSettings->getValue( "blog_templates" );
-		    
-		    if( !is_array($blogTemplates ))
-		        $url .= "$template/$file";
-		    else {
-		        if( in_array( $template, $blogTemplates ))
-		          $url .= "blog_".$this->_blogInfo->getId()."/$template/$file";
-		        else
-		          $url .= "$template/$file";
-		    }
-		    
-            return $url;		    
-		}
     }
 ?>




More information about the pLog-svn mailing list