diff options
author | xue <> | 2006-11-29 13:00:49 +0000 |
---|---|---|
committer | xue <> | 2006-11-29 13:00:49 +0000 |
commit | f65a7202bf0c48e487aa8ec21115b709c69d8118 (patch) | |
tree | 42c83d3ad02f9a2a8894e53cc32652fadba9e6c0 | |
parent | 6ac4dbfdd6cce30d656393558b5e34852a7a3129 (diff) |
fixed #471.
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | framework/Web/TAssetManager.php | 32 |
2 files changed, 33 insertions, 0 deletions
@@ -6,6 +6,7 @@ BUG: TTableCell should render only when Text is not set and there's no ch BUG: global state was not saved when redirect() is invoked (Qiang) BUG: TPager would not display if it was invisible previously (Qiang) ENH: Ticket#446 - Added TMetaTagCollection.getMetaTagByID method (Qiang) +ENH: Ticket#471 - Added methods in TAssetManager to expose published path and URL (Qiang) CHG: Ticket#437 - __autoload is replaced by spl_autoload_register (Qiang) CHG: Ticket#454 - Redundant PHP Version Check (Qiang) CHG: Ticket#460 - Validators will not perform validation if parents are disabled (Qiang) diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php index aa2919a0..190ee5ac 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.
|