summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TAssetManager.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/TAssetManager.php')
-rw-r--r--framework/Web/UI/TAssetManager.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/framework/Web/UI/TAssetManager.php b/framework/Web/UI/TAssetManager.php
index 94b1bc55..cd25a74c 100644
--- a/framework/Web/UI/TAssetManager.php
+++ b/framework/Web/UI/TAssetManager.php
@@ -131,6 +131,23 @@ class TAssetManager extends TModule
$this->_baseUrl=$value;
}
+ public function getPublishedUrl($path)
+ {
+ if(($fullpath=realpath($path))!==false)
+ {
+ $dir=$this->hash(dirname($fullpath));
+ $file=$this->_basePath.'/'.$dir.'/'.basename($fullpath);
+ if(is_file($file) || is_dir($file))
+ return $this->_baseUrl.'/'.$dir.'/'.basename($fullpath);
+ }
+ return null;
+ }
+
+ public function isPublished($path)
+ {
+ return $this->getPublishedUrl($path) !== null;
+ }
+
/**
* Publishes a file or a directory (recursively).
* This method will copy the content in a directory (recursively) to
@@ -181,7 +198,7 @@ class TAssetManager extends TModule
* @param string string to be hashed.
* @return string hashed string.
*/
- private function hash($dir)
+ protected function hash($dir)
{
return sprintf('%x',crc32($dir));
}