Re: cvs: pear /HTML_Template_Xipe Xipe.php
| From: | Stig S. Bakken | Date: | Mon, 03 Feb 2003 10:01:06 +0000 |
| Subject: | Re: cvs: pear /HTML_Template_Xipe Xipe.php | ||
| References: | 1 | Groups: | php.pear.cvs |
| Request: | Send a blank email to pear-cvs+get-8703@lists.php.net to get a copy of this message | ||
PEAR.php defines a boolean OS_WINDOWS constant that is useful for checks
like this.
- Stig
On Sun, 2003-02-02 at 13:21, Wolfram Kriesing wrote:
> cain Sun Feb 2 07:21:40 2003 EDT
>
> Modified files:
> /pear/HTML_Template_Xipe Xipe.php
> Log:
> - handle win filenames properly
>
> Index: pear/HTML_Template_Xipe/Xipe.php
> diff -u pear/HTML_Template_Xipe/Xipe.php:1.24 pear/HTML_Template_Xipe/Xipe.php:1.25
> --- pear/HTML_Template_Xipe/Xipe.php:1.24 Sat Jan 18 10:27:32 2003
> +++ pear/HTML_Template_Xipe/Xipe.php Sun Feb 2 07:21:40 2003
> @@ -16,7 +16,7 @@
> // | Authors: Wolfram Kriesing <wolfram@kriesing.de> |
> // +----------------------------------------------------------------------+
> //
> -// $Id: Xipe.php,v 1.24 2003/01/18 15:27:32 cain Exp $
> +// $Id: Xipe.php,v 1.25 2003/02/02 12:21:40 cain Exp $
> //
>
> /**
> @@ -240,14 +240,19 @@
> function _methodWrapper( $filename , $method )
> {
> $templateDir = $this->getOption('templateDir');
> - if( strpos( $filename , $templateDir ) !== 0 )
> - {
> + // if we are on a windows, which we check using the directory-separator (is there an
> easier way?)
> + // we better work with case independent filenames, apache converts
> + // i.e. the doc-root to lower case (at least on my test machine)
> + if (DIRECTORY_SEPARATOR=='\\') {
> + $filename = strtolower($filename);
> + $templateDir = strtolower($templateDir);
> + }
> + if (strpos( $filename , $templateDir ) !== 0) {
> $filename = $templateDir.$filename;
> }
>
> $objKey = md5( $filename );
> - if( !isset($this->_objectPool[$objKey]) )
> - {
> + if (!isset($this->_objectPool[$objKey])) {
> // use __clone in php5
> // copy the default object with all its properties, yes COPY,
> // this is important we dont want a reference here
> @@ -260,8 +265,9 @@
> //print "$objKey .... $filename, call: $method<br>";
> // return $this->_objectPool[$objKey];
>
> - if( PEAR::isError($ret=$obj->setup( $filename )) )
> + if( PEAR::isError($ret=$obj->setup( $filename )) ) {
> return $ret;
> + }
>
> // check if the method exists, this might be necessary if 'enable-Cache' is
> false but someone calls 'isCached'
> if( method_exists($obj,$method) )
>
>