AssetCompress\View\Helper\AssetCompressHelper::_relativizePath PHP Method

_relativizePath() protected method

Converts an absolute path into a web relative one.
protected _relativizePath ( string $path ) : string
$path string The path to convert
return string A webroot relative string.
    protected function _relativizePath($path)
    {
        $plugins = Plugin::loaded();
        $index = array_search('AssetCompress', $plugins);
        unset($plugins[$index]);
        foreach ($plugins as $plugin) {
            $pluginPath = Plugin::path($plugin) . 'webroot';
            if (strpos($path, $pluginPath) === 0) {
                return str_replace($pluginPath, '/' . Inflector::underscore($plugin), $path);
            }
        }
        $path = str_replace(WWW_ROOT, '/', $path);
        return str_replace(DS, '/', $path);
    }