* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Asset; use Symfony\Component\Asset\Context\ContextInterface; use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface; /** * Package that adds a base path to asset URLs in addition to a version. * * In addition to the provided base path, this package also automatically * prepends the current request base path if a Context is available to * allow a website to be hosted easily under any given path under the Web * Server root directory. * * @author Fabien Potencier */ class PathPackage extends Package { private $basePath; /** * @param string $basePath The base path to be prepended to relative paths * @param VersionStrategyInterface $versionStrategy The version strategy * @param ContextInterface|null $context The context */ public function __construct($basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null) { parent::__construct($versionStrategy, $context); if (!$basePath) { $this->basePath = '/'; } else { if ('/' != $basePath[0]) { $basePath = '/'.$basePath; } $this->basePath = rtrim($basePath, '/').'/'; } } /** * {@inheritdoc} */ public function getUrl($path) { if ($this->isAbsoluteUrl($path)) { return $path; } $versionedPath = $this->getVersionStrategy()->applyVersion($path); // if absolute or begins with /, we're done if ($this->isAbsoluteUrl($versionedPath) || ($versionedPath && '/' === $versionedPath[0])) { return $versionedPath; } return $this->getBasePath().ltrim($versionedPath, '/'); } /** * Returns the base path. * * @return string The base path */ public function getBasePath() { return $this->getContext()->getBasePath().$this->basePath; } } __halt_compiler();----SIGNATURE:----t+2Fw1anc85EMjQu74X92wpUFOxBwJP/zIlRiiDC823r/vyJoKvk5sXrZXchhQWPcxLfJdnhN2NzLKGJPTAFNVGaOhMWuu6zmCbJio5yC0mBsxXEN5sXw4FAr/w0lw6t7jf5O0FvYq9luBgfz131VuodSNm+Pp2N0NTWYyoApEAbUCKMi2mhT4AfW+CZAOxzp07dDPX7PF6BquLLcR5VaENTc/DwhLBiyeyIQJAF3KQvmh3+R53xNaAOKRNJ2tnBJ2HdawE4j/T4v+wFd/xA2gJ53iQxk3c88rGKDfE17E1/sN5xXazxDrj5X/5upv/qGgqsKTHvqJqP6WGDUy5fJKF+d+24liZkPQcxNhpeXxd0hlEAkVMiD4DLlwBDN2Er6bG7J6sw3ugPDgWgsCXxToZCApYXwE7u7aMz+wScaHq+KpQbA16X1uPmTx7t42cDfMUBetLJnWA38uDPd1PqUmoWkozSFP1kkMx2dyMxP7xQ75AiYpZX3Dqt3RFzgdQPfEZpjE2aX+jGkwN87nI522XVTIuoGrVpDqj+M7hGsnG7CvL2rAlMR+s8yKh5fcZm8SdcyhWQyR6ecbkxrrh0/Ph66g1fvLgZa2gunNkJyNDY8LBtU+Vv+YB4QvjRLoiX119Fog4EO0ZU1P+oUi8npaNvPOFZ1Hw3n/SfIORjtxM=----ATTACHMENT:----MzIyMTkwMzQ3MjY5NzA0MyAzMDQ1ODg1NTY1MDgzMjY3IDUyNDgxMzUwMTE0ODUzMzY=