rm trailing white space
[mediawiki.git] / PHPTAL-NP-0.7.0 / libs / PHPTAL / SourceLocator.php
blobe28147942f64e443ac032f28bcb2a30d30cde778
1 <?php
3 /**
4 * Interface for template source locators.
6 * A locator is a way to retrieve a PHPTAL template source otherwhere than in
7 * the file system.
9 * The default behavour of this class is to act like a file system locator.
11 * @author Laurent Bedubourg <laurent.bedubourg@free.fr>
13 class PHPTAL_SourceLocator
15 var $path;
17 function PHPTAL_SourceLocator($path)
19 $this->path = $path;
22 /**
23 * Returns an absolute path to this resource.
25 * The result of this method is used to generate some unique
26 * md5 value which represent the template php function name
27 * and the intermediate php file name.
29 * @return string
31 function realPath()
33 return $this->path;
36 /**
37 * Return source last modified date in a filemtime format.
39 * The result is compared to php intermediate mtime to decide
40 * weither or not to re-parse the template source.
42 * @return int
44 function lastModified()
46 return filemtime($this->path);
49 /**
50 * Return the template source.
52 * This method is invoqued if the template has to be parsed.
54 * @return string
56 function data()
58 return join('', file($this->path));