Return the public path to the given asset.
If the file is not in the public directory,
or if it needs to be compiled (less, etc...), then the
public cache path is returned.

@param array $asset Asset array.

@return string
541694
public function publicPath(array $asset)
	{
		$path          = $this->path($asset['source']);
		$is_public     = (bool) stristr($path, $this->public_path);
		$compiled_exts = array('less');
		
		if ($is_public && !in_array($asset['ext'], $compiled_exts)) {
			return $path;
		}
		
		$cache_path = $this->cache_path
			. '/'
			. str_replace(array('/', '::'), '-', $asset['source']);
		
		$cache_path .= ('less' === $asset['ext']) ? '.css' : '';
		
		return $cache_path;
	}
486054
public function publicPath($path = '')
    {
        return public_path($this->options['public_dirname'] . '/' . $this->name()
                    . (empty($path) ? '' : '/' . rtrim($path)));
    }
69234
public static function process($assets)
    {
        if ($directory = self::getOutputDirectory()) {
            $relativeDirectory = self::getRelativeOutputDirectory();
            $filename = '';
            $sourceFiles = array();
            for ($i = 0; $i < count($assets); ++$i) {
                $asset = $assets[$i];
                $filename .= $asset->getAssetHashKey();
                $sourceFiles[] = $asset->getAssetURL();
            }
            $filename = sha1($filename);
            $cacheFile = $directory.'/'.$filename.'.js';
            if (!file_exists($cacheFile)) {
                $js = '';
                foreach ($assets as $asset) {
                    $contents = $asset->getAssetContents();
                    if (isset($contents)) {
                        if ($asset->assetSupportsMinification()) {
                            $contents = \JShrink\Minifier::minify($contents);
                        }
                        $js .= $contents.";\n\n";
                    }
                }
                @file_put_contents($cacheFile, $js);
            }

            $asset = new self();
            $asset->setAssetURL($relativeDirectory.'/'.$filename.'.js');
            $asset->setAssetPath($directory.'/'.$filename.'.js');
            $asset->setCombinedAssetSourceFiles($sourceFiles);

            return array($asset);
        }

        return $assets;
    }
858764
public function webpackAsset($asset)
    {
        $asset_id        = $this->public_path . '/' . Compiler::getAliasId($asset);
        $full_asset_path = $this->web_dir . '/' . $asset_id;

        return [
            'js'  => file_exists($full_asset_path . '.js')
                ? $asset_id . '.js?' . filemtime($full_asset_path . '.js')
                : false,
            'css' => file_exists($full_asset_path . '.css')
                ? $asset_id . '.css?' . filemtime($full_asset_path . '.css')
                : false,
        ];
    }
1274089
protected function getDeepHashFromAssets($assets)
    {
        $key = '';

        $assetFiles = array_map(function ($file) {
            return file_exists($file) ? $file : File::symbolizePath($file, null) ?: $this->localPath . $file;
        }, $assets);

        foreach ($assetFiles as $file) {
            $filters = $this->getFilters(File::extension($file));

            foreach ($filters as $filter) {
                if (method_exists($filter, 'hashAsset')) {
                    $key .= $filter->hashAsset($file, $this->localPath);
                }
            }
        }

        return $key;
    }
633637
public function uploadAction(Asset $asset): string
    {
        if (($tag = $this->browserState->get('activeTag')) !== null) {
            $asset->addTag($tag);
        }

        if ($this->persistenceManager->isNewObject($asset)) {
            $this->assetRepository->add($asset);
        } else {
            $this->assetRepository->update($asset);
        }

        if (($assetCollection = $this->browserState->get('activeAssetCollection')) !== null && $assetCollection->addAsset($asset)) {
            $this->assetCollectionRepository->update($assetCollection);
        }

        $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]);
        $this->response->setStatus(201);
        return '';
    }
898449
public function getAssetLinkedDeliveryPolicy($asset)
    {
        $assetId = Utilities::getEntityId(
            $asset,
            'WindowsAzure\MediaServices\Models\Asset'
        );

        $propertyList = $this->_getEntityList("Assets('{$assetId}')/DeliveryPolicies");
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = AssetDeliveryPolicy::createFromOptions($properties);
        }

        return $result;
    }
802820
public function getPublicPath()
    {
        $uploadsPath = Config::get('cms.storage.uploads.path', '/storage/app/uploads');

        if ($this->isPublic()) {
            $uploadsPath .= '/public';
        }
        else {
            $uploadsPath .= '/protected';
        }

        return Url::asset($uploadsPath) . '/';
    }
980268
public function getAssetFile($file) {
        if (is_file($file)) {
            return new AssetFile($file);
        }
        $ext = pathinfo($file, PATHINFO_EXTENSION);
        if (strpos($file, '@') === 0 && ($ext == 'js' || $ext == 'css')) {
            $file = $ext.'/'. substr($file, 1);
        }
        return new AssetFile(Factory::public_path()->file($this->assetsDirectory.$file));
    }
810256
public function getAsset($asset, $extensionId = null)
    {
        if( ! is_null($extensionId)){
            $url = $this->getJsBaseWww($extensionId) . FsUtils::normalizePath($asset);
        } else {
            $url = $this->getAssetBaseUrl() . FsUtils::normalizePath($asset);
        }

        $isFolder = (substr_compare($url, '/', strlen($url) - 1) === 0);

        $buster = $this->getCacheBuster();
        if($buster != false && $isFolder == false) {
            $url .= '?' . self::BUSTER_QUERY_KEY . '=' . urlencode($buster);
        }

        return $url;
    }
1287680
public function getAssetPath()
    {
        $url_frags = parse_url($_SERVER['REQUEST_URI']);
        if (!array_key_exists('query', $url_frags)) return false;
        parse_str($url_frags['query'], $query_vars);
        if (!array_key_exists('asset', $query_vars)) return false;
        $folder_name = self::getAssetFolderName($query_vars['asset']);
        $file_name = sprintf(
            $this->actual_path.'/assets/%s/%s',
            $folder_name,
            $query_vars['asset']
        );
        
        if (file_exists($file_name)) {
           return $file_name;
        }
        return $false;
    }
170575
public function getAssetLocatorList($asset)
    {
        $assetId = Utilities::getEntityId(
            $asset,
            'WindowsAzure\MediaServices\Models\Asset'
        );

        $locatorsList = $this->_getEntityList("Assets('{$assetId}')/Locators");

        $result = [];

        foreach ($locatorsList as $locator) {
            $result[] = Locator::createFromOptions($locator);
        }

        return $result;
    }
700490
public function asset_url($path)
    {
        // iframe content can't be in a different domain
        // @TODO: check if assests are on a different domain

        if (!$this->assets_path || in_array($path[0], array('?', '/', '.')) || strpos($path, '://')) {
            return $path;
        }

        return $this->assets_path . $path;
    }
850308
public function getImgixUrl (Asset $asset)
    {
        $url      = null;
        $domains  = $this->settings->imgixDomains;
        $volume   = $asset->getVolume();
        $assetUrl = AssetsHelper::generateUrl($volume, $asset);
        $assetUri = parse_url($assetUrl, PHP_URL_PATH);

        if ( isset($domains[ $volume->handle ]) ) {
            $builder = new UrlBuilder($domains[ $volume->handle ]);
            $builder->setUseHttps(true);
            if ($token = Imgix::$plugin->getSettings()->imgixSignedToken)
                $builder->setSignKey($token);
            $url = UrlHelper::stripQueryString($builder->createURL($assetUri));
        }


        return $url;
    }
48815
public function asset($path)
    {
        if (null !== $this->basePath) {
            return $this->request->getUri()->getBaseUrl().'/'.trim($this->basePath, '/').'/'.$path;
        }

        return $this->request->getUri()->getBaseUrl().'/'.$path;
    }
17754
public static function getAssetUrl(string $path = '') : string
    {
        if (static::$assetUrl === null) {
            static::$assetUrl = FileHelper::getAssetUrl(static::className());
        }
        ;
        return static::$assetUrl . $path;
    }
416087
private function build_asset_args( $asset ) {

		// setup default args for array type includes
		$args = array(
			'src'       => $asset,
			'deps'      => array(),
			'ver'       => false,
			'in_footer' => false,
			'media'     => false,
		);

		if ( is_array( $asset ) ) {
			$args = array_merge( $args, $asset );
		}

		// add uix dep
		$args['deps'][] = 'uix';

		return $args;
	}