summaryrefslogtreecommitdiff
path: root/framework/Web/TAssetManager.php
diff options
context:
space:
mode:
authorxue <>2006-12-01 12:28:55 +0000
committerxue <>2006-12-01 12:28:55 +0000
commit17f49a9bc71d88c9b3e2f31a161f3689c136ac16 (patch)
treefc77b9c75927cd56281417843a318e85c39ce729 /framework/Web/TAssetManager.php
parent074032e0270ae70eed481a082158dc9554aaa1db (diff)
merge from 3.0 branch till 1531.
Diffstat (limited to 'framework/Web/TAssetManager.php')
-rw-r--r--framework/Web/TAssetManager.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php
index 04933bfa..fa43b7d7 100644
--- a/framework/Web/TAssetManager.php
+++ b/framework/Web/TAssetManager.php
@@ -179,6 +179,38 @@ class TAssetManager extends TModule
}
/**
+ * Returns the published path of a file path.
+ * This method does not perform any publishing. It merely tells you
+ * if the file path is published, where it will go.
+ * @param string directory or file path being published
+ * @return string the published file path
+ */
+ public function getPublishedPath($path)
+ {
+ $path=realpath($path);
+ if(is_file($path))
+ return $this->_basePath.'/'.$this->hash(dirname($path)).'/'.basename($path);
+ else
+ return $this->_basePath.'/'.$this->hash($path);
+ }
+
+ /**
+ * Returns the URL of a published file path.
+ * This method does not perform any publishing. It merely tells you
+ * if the file path is published, what the URL will be to access it.
+ * @param string directory or file path being published
+ * @return string the published URL for the file path
+ */
+ public function getPublishedUrl($path)
+ {
+ $path=realpath($path);
+ if(is_file($path))
+ return $this->_baseUrl.'/'.$this->hash(dirname($path)).'/'.basename($path);
+ else
+ return $this->_baseUrl.'/'.$this->hash($path);
+ }
+
+ /**
* Generate a CRC32 hash for the directory path. Collisions are higher
* than MD5 but generates a much smaller hash string.
* @param string string to be hashed.