public function getFilePathFromUrl($url)
    {
        $url = parse_url($url)['path']; //remove query part from url.
        $rel = substr($url, strpos($url, self::ENTRY_POINT) + strlen(self::ENTRY_POINT));
        $parts = explode('/', $rel, 4);
        list ($webSourceId, $timestamp, $token, $subPath) = $parts;

        $parts = explode('*/', $subPath, 2);
        if (count($parts) < 2) {
            throw new \tao_models_classes_FileNotFoundException('`'.$subPath.'` - (wrong number of path parts)');
        }
        list ($subPath, $file) = $parts;

        $secret = $this->getOption('secret');
        $ttl = $this->getOption('ttl');

        $correctToken = md5($timestamp . $subPath . $secret);

        if (time() - $timestamp > $ttl) {
            throw new \tao_models_classes_FileNotFoundException('`' . $subPath . $file . '` - (file link expired)');
        }
        if ($token != $correctToken) {
            throw new \tao_models_classes_FileNotFoundException('`' . $subPath . $file . '` - (wrong token)');
        }


        $path = array();
        foreach (explode('/', $subPath . $file) as $ele) {
            $path[] = rawurldecode($ele);
        }
        $filename = implode('/', $path);

        return $filename;
    }
public function getFilePathFromUrl($url)
    {
        $url = parse_url($url)['path']; //remove query part from url.
        $rel = substr($url, strpos($url, self::ENTRY_POINT) + strlen(self::ENTRY_POINT));
        $parts = explode('/', $rel, 4);
        list ($webSourceId, $timestamp, $token, $subPath) = $parts;

        $parts = explode('*/', $subPath, 2);
        if (count($parts) < 2) {
            throw new \tao_models_classes_FileNotFoundException('`'.$subPath.'` - (wrong number of path parts)');
        }
        list ($subPath, $file) = $parts;

        $secret = $this->getOption('secret');
        $ttl = $this->getOption('ttl');

        $correctToken = md5($timestamp . $subPath . $secret);

        if (time() - $timestamp > $ttl) {
            throw new \tao_models_classes_FileNotFoundException('`' . $subPath . $file . '` - (file link expired)');
        }
        if ($token != $correctToken) {
            throw new \tao_models_classes_FileNotFoundException('`' . $subPath . $file . '` - (wrong token)');
        }


        $path = array();
        foreach (explode('/', $subPath . $file) as $ele) {
            $path[] = rawurldecode($ele);
        }
        $filename = implode('/', $path);

        return $filename;
    }
public function getFilePathFromUrl ( $ url ) { $ url = parse_url ( $ url ) [ 'path' ] ; //remove query part from url. $ rel = substr ( $ url , strpos ( $ url , self :: ENTRY_POINT ) + strlen ( self :: ENTRY_POINT ) ) ; $ parts = explode ( '/' , $ rel , 4 ) ; list ( $ webSourceId , $ timestamp , $ token , $ subPath ) = $ parts ; $ parts = explode ( '*/' , $ subPath , 2 ) ; if ( count ( $ parts ) < 2 ) { throw new \ tao_models_classes_FileNotFoundException ( '`' . $ subPath . '` - (wrong number of path parts)' ) ; } list ( $ subPath , $ file ) = $ parts ; $ secret = $ this -> getOption ( 'secret' ) ; $ ttl = $ this -> getOption ( 'ttl' ) ; $ correctToken = md5 ( $ timestamp . $ subPath . $ secret ) ; if ( time ( ) - $ timestamp > $ ttl ) { throw new \ tao_models_classes_FileNotFoundException ( '`' . $ subPath . $ file . '` - (file link expired)' ) ; } if ( $ token != $ correctToken ) { throw new \ tao_models_classes_FileNotFoundException ( '`' . $ subPath . $ file . '` - (wrong token)' ) ; } $ path = array ( ) ; foreach ( explode ( '/' , $ subPath . $ file ) as $ ele ) { $ path [ ] = rawurldecode ( $ ele ) ; } $ filename = implode ( '/' , $ path ) ; return $ filename ; }
Get file path from url.
@param null $url
@return string
@throws \tao_models_classes_FileNotFoundException
Get file path from url .