[pLog-CVS] plog/class/net baserequestgenerator.class.php,1.4.4.1,1.4.4.2 prettyrequestgenerator.clas
Brought to you by:
jondaley
From: Oscar R. <phu...@us...> - 2004-05-07 19:07:42
|
Update of /cvsroot/plog/plog/class/net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8685 Modified Files: Tag: PLOG_0_3_2_DEVEL baserequestgenerator.class.php prettyrequestgenerator.class.php rawrequestgenerator.class.php requestgenerator.class.php Log Message: fixed a long-standing bug that prevented that templates installed for a blog were not working fine, due to $url->getUrl. A new method called $url->getTemplateFile has been added, and it will take care of checking whether we're using a blog-specific template or a global one. Index: requestgenerator.class.php =================================================================== RCS file: /cvsroot/plog/plog/class/net/requestgenerator.class.php,v retrieving revision 1.8.4.2 retrieving revision 1.8.4.3 diff -C2 -d -r1.8.4.2 -r1.8.4.3 *** requestgenerator.class.php 27 Apr 2004 15:00:32 -0000 1.8.4.2 --- requestgenerator.class.php 7 May 2004 19:07:32 -0000 1.8.4.3 *************** *** 349,353 **** { return $this->_rg->isXHTML(); ! } } ?> --- 349,365 ---- { return $this->_rg->isXHTML(); ! } ! ! /** ! * 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 ) ! { ! return $this->_rg->getTemplateFile( $file ); ! } } ?> Index: rawrequestgenerator.class.php =================================================================== RCS file: /cvsroot/plog/plog/class/net/rawrequestgenerator.class.php,v retrieving revision 1.9.4.1 retrieving revision 1.9.4.2 diff -C2 -d -r1.9.4.1 -r1.9.4.2 *** rawrequestgenerator.class.php 27 Apr 2004 15:00:32 -0000 1.9.4.1 --- rawrequestgenerator.class.php 7 May 2004 19:07:32 -0000 1.9.4.2 *************** *** 494,497 **** --- 494,529 ---- 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; + } } ?> Index: prettyrequestgenerator.class.php =================================================================== RCS file: /cvsroot/plog/plog/class/net/prettyrequestgenerator.class.php,v retrieving revision 1.10 retrieving revision 1.10.4.1 diff -C2 -d -r1.10 -r1.10.4.1 *** prettyrequestgenerator.class.php 3 Apr 2004 17:10:05 -0000 1.10 --- prettyrequestgenerator.class.php 7 May 2004 19:07:32 -0000 1.10.4.1 *************** *** 381,384 **** --- 381,416 ---- 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; + } } ?> Index: baserequestgenerator.class.php =================================================================== RCS file: /cvsroot/plog/plog/class/net/baserequestgenerator.class.php,v retrieving revision 1.4.4.1 retrieving revision 1.4.4.2 diff -C2 -d -r1.4.4.1 -r1.4.4.2 *** baserequestgenerator.class.php 27 Apr 2004 15:00:31 -0000 1.4.4.1 --- baserequestgenerator.class.php 7 May 2004 19:07:32 -0000 1.4.4.2 *************** *** 326,330 **** { return $this->_xhtmlEnabled; ! } } ?> --- 326,342 ---- { return $this->_xhtmlEnabled; ! } ! ! /** ! * 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 ) ! { ! throw( new Exception( "This function must be implemented by child classes." )); ! } } ?> |