Changeset 818
- Timestamp:
- 08/14/07 17:51:01 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/memphis/stubMemphisIncludeFilePageElement.php
r803 r818 7 7 * @subpackage websites_memphis 8 8 */ 9 stubClassLoader::load('net.stubbles.websites.memphis.stubMemphisPageElement'); 9 stubClassLoader::load('net.stubbles.util.stubRegistry', 10 'net.stubbles.websites.memphis.stubMemphisPageElement' 11 ); 10 12 /** 11 13 * Page element for including a complete file as content. … … 22 24 */ 23 25 protected $source = ''; 26 /** 27 * base directory where content is located 28 * 29 * @var string 30 */ 31 protected static $baseDir; 32 33 /** 34 * static initializing 35 */ 36 public static function __static() 37 { 38 self::$baseDir = stubRegistry::getConfig('net.stubbles.websites.memphis.templateDir', stubConfig::getLibPath() . '/../templates'); 39 } 24 40 25 41 /** … … 54 70 public function process(stubRequest $request, stubSession $session, stubResponse $response, array $context = array()) 55 71 { 56 if (file_exists($this->source) == false) { 72 $existsInBasePath = file_exists(self::$baseDir . DIRECTORY_SEPARATOR . $this->source); 73 if (false === $existsInBasePath && file_exists($this->source) === false) { 57 74 throw new stubException('The file ' . $this->source . ' does not exist or could not be read.'); 58 75 } 59 76 60 return file_get_contents($this->source); 77 if (false === $existsInBasePath) { 78 return file_get_contents($this->source); 79 } 80 81 return file_get_contents(self::$baseDir . DIRECTORY_SEPARATOR . $this->source); 61 82 } 62 83 }
