Changeset 1529 for branches/3.0

Show
Ignore:
Timestamp:
11/29/2006 07:00:49 AM (2 years ago)
Author:
xue
Message:

fixed #471.

Location:
branches/3.0
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/3.0/HISTORY

    r1520 r1529  
    77BUG: TPager would not display if it was invisible previously (Qiang) 
    88ENH: Ticket#446 - Added TMetaTagCollection.getMetaTagByID method (Qiang) 
     9ENH: Ticket#471 - Added methods in TAssetManager to expose published path and URL (Qiang) 
    910CHG: Ticket#437 - __autoload is replaced by spl_autoload_register (Qiang) 
    1011CHG: Ticket#454 - Redundant PHP Version Check (Qiang) 
  • branches/3.0/framework/Web/TAssetManager.php

    r1397 r1529  
    180180 
    181181        /** 
     182         * Returns the published path of a file path. 
     183         * This method does not perform any publishing. It merely tells you 
     184         * if the file path is published, where it will go. 
     185         * @param string directory or file path being published 
     186         * @return string the published file path 
     187         */ 
     188        public function getPublishedPath($path) 
     189        { 
     190                $path=realpath($path); 
     191                if(is_file($path)) 
     192                        return $this->_basePath.'/'.$this->hash(dirname($path)).'/'.basename($path); 
     193                else 
     194                        return $this->_basePath.'/'.$this->hash($path); 
     195        } 
     196 
     197        /** 
     198         * Returns the URL of a published file path. 
     199         * This method does not perform any publishing. It merely tells you 
     200         * if the file path is published, what the URL will be to access it. 
     201         * @param string directory or file path being published 
     202         * @return string the published URL for the file path 
     203         */ 
     204        public function getPublishedUrl($path) 
     205        { 
     206                $path=realpath($path); 
     207                if(is_file($path)) 
     208                        return $this->_baseUrl.'/'.$this->hash(dirname($path)).'/'.basename($path); 
     209                else 
     210                        return $this->_baseUrl.'/'.$this->hash($path); 
     211        } 
     212 
     213        /** 
    182214         * Generate a CRC32 hash for the directory path. Collisions are higher 
    183215         * than MD5 but generates a much smaller hash string.