Prado\Web\TAssetManager::getPublishedPath PHP Method

getPublishedPath() public method

This method does not perform any publishing. It merely tells you if the file path is published, where it will go.
public getPublishedPath ( $path ) : string
return string the published file path
    public function getPublishedPath($path)
    {
        $path = realpath($path);
        if (is_file($path)) {
            return $this->_basePath . DIRECTORY_SEPARATOR . $this->hash(dirname($path)) . DIRECTORY_SEPARATOR . basename($path);
        } else {
            return $this->_basePath . DIRECTORY_SEPARATOR . $this->hash($path);
        }
    }

Usage Example

Example #1
0
 public function testPublishFilePathWithDirectory()
 {
     $manager = new TAssetManager();
     $manager->setBaseUrl('/');
     $manager->init(null);
     // Try to publish a directory
     $dirToPublish = dirname(__FILE__) . '/data';
     $publishedUrl = $manager->publishFilePath($dirToPublish);
     $publishedDir = self::$assetDir . $publishedUrl;
     self::assertEquals($publishedDir, $manager->getPublishedPath($dirToPublish));
     self::assertEquals($publishedUrl, $manager->getPublishedUrl($dirToPublish));
     self::assertTrue(is_dir($publishedDir));
     self::assertTrue(is_file($publishedDir . '/pradoheader.gif'));
 }