/** * Determines and returns the relative path and filename for the given Storage Object or Resource. If the given * object represents a persistent resource, its own relative publication path will be empty. If the given object * represents a static resources, it will contain a relative path. * * No matter which kind of resource, persistent or static, this function will return a sub directory structure * if no relative publication path was defined in the given object. * * @param ResourceMetaDataInterface $object Resource or Storage Object * @return string The relative path and filename, for example "c/8/2/8/c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" (if subdivideHashPathSegment is on) or "c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" (if it's off) */ protected function getRelativePublicationPathAndFilename(ResourceMetaDataInterface $object) { if ($object->getRelativePublicationPath() !== '') { $pathAndFilename = $object->getRelativePublicationPath() . $object->getFilename(); } else { if ($this->subdivideHashPathSegment) { $sha1Hash = $object->getSha1(); $pathAndFilename = $sha1Hash[0] . '/' . $sha1Hash[1] . '/' . $sha1Hash[2] . '/' . $sha1Hash[3] . '/' . $sha1Hash . '/' . $object->getFilename(); } else { $pathAndFilename = $object->getSha1() . '/' . $object->getFilename(); } } return $pathAndFilename; }
/** * Determines and returns the relative path and filename for the given Storage Object or Resource. If the given * object represents a persistent resource, its own relative publication path will be empty. If the given object * represents a static resources, it will contain a relative path. * * @param ResourceMetaDataInterface $object Resource or Storage Object * @param boolean $urlEncode Set to url encode the filename * @return string The relative path and filename, for example "c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" */ protected function getRelativePublicationPathAndFilename(ResourceMetaDataInterface $object, $urlEncode = FALSE) { $filename = $urlEncode ? rawurlencode($object->getFilename()) : $object->getFilename(); if ($object->getRelativePublicationPath() !== '') { $pathAndFilename = $object->getRelativePublicationPath() . $filename; } else { $pathAndFilename = $object->getSha1() . '/' . $filename; } return $pathAndFilename; }
/** * Determines and returns the relative path and filename for the given Storage Object or Resource. If the given * object represents a persistent resource, its own relative publication path will be empty. If the given object * represents a static resources, it will contain a relative path. * * @param ResourceMetaDataInterface $object Resource or Storage Object * @return string The relative path and filename, for example "c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" */ protected function getRelativePublicationPathAndFilename(ResourceMetaDataInterface $object) { if ($this->debug) { $this->systemLogger->log('target ' . $this->name . ': getRelativePublicationPathAndFilename'); } if ($object->getRelativePublicationPath() !== '') { $pathAndFilename = $object->getRelativePublicationPath() . $object->getFilename(); } else { $pathAndFilename = $object->getSha1() . '/' . $object->getFilename(); } return $pathAndFilename; }
/** * Determines and returns the relative path and filename for the given Storage Object or Resource. If the given * object represents a persistent resource, its own relative publication path will be empty. If the given object * represents a static resources, it will contain a relative path. * * @param ResourceMetaDataInterface $object Resource or Storage Object * @return string The relative path and filename, for example "c828d0f88ce197be1aff7cc2e5e86b1244241ac6/MyPicture.jpg" */ protected function getRelativePublicationPathAndFilename(ResourceMetaDataInterface $object) { if ($object->getRelativePublicationPath() !== '') { $pathAndFilename = $object->getRelativePublicationPath() . $object->getFilename(); } else { $pathAndFilename = $object->getSha1() . '/' . $object->getFilename(); } return $pathAndFilename; }