protected function encode($path) {
		if ($path !== '') {

			// cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root
			$p = $this->relpathCE($path);
			// if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt
			if ($p === '')	{
				$p = DIRECTORY_SEPARATOR;
			}

			// TODO crypt path and return hash
			$hash = $this->crypt($p);
			// hash is used as id in HTML that means it must contain vaild chars
			// make base64 html safe and append prefix in begining
			$hash = strtr(base64_encode($hash), '+/=', '-_.');
			// remove dots '.' at the end, before it was '=' in base64
			$hash = rtrim($hash, '.'); 
			// append volume id to make hash unique
			return $this->id.$hash;
		}
	}
protected function encode($path) {
		if ($path !== '') {

			// cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root
			$p = $this->relpathCE($path);
			// if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt
			if ($p === '')	{
				$p = DIRECTORY_SEPARATOR;
			}

			// TODO crypt path and return hash
			$hash = $this->crypt($p);
			// hash is used as id in HTML that means it must contain vaild chars
			// make base64 html safe and append prefix in begining
			$hash = strtr(base64_encode($hash), '+/=', '-_.');
			// remove dots '.' at the end, before it was '=' in base64
			$hash = rtrim($hash, '.'); 
			// append volume id to make hash unique
			return $this->id.$hash;
		}
	}
protected function encode ( $ path ) { if ( $ path !== '' ) { // cut ROOT from $path for security reason, even if hacker decodes the path he will not know the root $ p = $ this -> relpathCE ( $ path ) ; // if reqesting root dir $path will be empty, then assign '/' as we cannot leave it blank for crypt if ( $ p === '' ) { $ p = DIRECTORY_SEPARATOR ; } // TODO crypt path and return hash $ hash = $ this -> crypt ( $ p ) ; // hash is used as id in HTML that means it must contain vaild chars // make base64 html safe and append prefix in begining $ hash = strtr ( base64_encode ( $ hash ) , '+/=' , '-_.' ) ; // remove dots '.' at the end, before it was '=' in base64 $ hash = rtrim ( $ hash , '.' ) ; // append volume id to make hash unique return $ this -> id . $ hash ; } }
Encode path into hash

@param  string  file path
@return string
@author Dmitry (dio) Levashov
@author Troex Nevelin
Encode path into hash