Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/celerity/resources/CelerityResourcesOnDisk.php
<?php | <?php | ||||
/** | /** | ||||
* Defines the location of static resources on disk. | * Defines the location of static resources on disk. | ||||
*/ | */ | ||||
abstract class CelerityResourcesOnDisk extends CelerityResources { | abstract class CelerityResourcesOnDisk extends CelerityResources { | ||||
abstract public function getPathToResources(); | abstract public function getPathToResources(); | ||||
private function getPathToResource($name) { | |||||
return $this->getPathToResources().DIRECTORY_SEPARATOR.$name; | |||||
} | |||||
public function getResourceData($name) { | public function getResourceData($name) { | ||||
return Filesystem::readFile($this->getPathToResources().'/'.$name); | return Filesystem::readFile($this->getPathToResource($name)); | ||||
} | } | ||||
public function findBinaryResources() { | public function findBinaryResources() { | ||||
return $this->findResourcesWithSuffixes($this->getBinaryFileSuffixes()); | return $this->findResourcesWithSuffixes($this->getBinaryFileSuffixes()); | ||||
} | } | ||||
public function findTextResources() { | public function findTextResources() { | ||||
return $this->findResourcesWithSuffixes($this->getTextFileSuffixes()); | return $this->findResourcesWithSuffixes($this->getTextFileSuffixes()); | ||||
} | } | ||||
public function getResourceModifiedTime($name) { | |||||
return (int)filemtime($this->getPathToResource($name)); | |||||
} | |||||
protected function getBinaryFileSuffixes() { | protected function getBinaryFileSuffixes() { | ||||
return array( | return array( | ||||
'png', | 'png', | ||||
'jpg', | 'jpg', | ||||
'gif', | 'gif', | ||||
'swf', | 'swf', | ||||
); | ); | ||||
} | } | ||||
Show All 32 Lines |