Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Context;
/**
* Holds information about the current request.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface ContextInterface
{
/**
* Gets the base path.
*/
public function getBasePath(): string;
/**
* Checks whether the request is secure or not.
*/
public function isSecure(): bool;
}

View File

@@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Context;
/**
* A context that does nothing.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class NullContext implements ContextInterface
{
public function getBasePath(): string
{
return '';
}
public function isSecure(): bool
{
return false;
}
}

View File

@@ -0,0 +1,51 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Context;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* Uses a RequestStack to populate the context.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class RequestStackContext implements ContextInterface
{
private RequestStack $requestStack;
private string $basePath;
private bool $secure;
public function __construct(RequestStack $requestStack, string $basePath = '', bool $secure = false)
{
$this->requestStack = $requestStack;
$this->basePath = $basePath;
$this->secure = $secure;
}
public function getBasePath(): string
{
if (!$request = $this->requestStack->getMainRequest()) {
return $this->basePath;
}
return $request->getBasePath();
}
public function isSecure(): bool
{
if (!$request = $this->requestStack->getMainRequest()) {
return $this->secure;
}
return $request->isSecure();
}
}

View File

@@ -0,0 +1,38 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Exception;
/**
* Represents an asset not found in a manifest.
*/
class AssetNotFoundException extends RuntimeException
{
private array $alternatives;
/**
* @param string $message Exception message to throw
* @param array $alternatives List of similar defined names
* @param int $code Exception code
* @param \Throwable $previous Previous exception used for the exception chaining
*/
public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
$this->alternatives = $alternatives;
}
public function getAlternatives(): array
{
return $this->alternatives;
}
}

View File

@@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Exception;
/**
* Base ExceptionInterface for the Asset component.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface ExceptionInterface extends \Throwable
{
}

View File

@@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Exception;
/**
* Base InvalidArgumentException for the Asset component.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}

View File

@@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Exception;
/**
* Base LogicException for the Asset component.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class LogicException extends \LogicException implements ExceptionInterface
{
}

View File

@@ -0,0 +1,19 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\Exception;
/**
* Base RuntimeException for the Asset component.
*/
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}

19
vendor/symfony/asset/LICENSE vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2004-present Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

63
vendor/symfony/asset/Package.php vendored Normal file
View File

@@ -0,0 +1,63 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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\Context\NullContext;
use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface;
/**
* Basic package that adds a version to asset URLs.
*
* @author Kris Wallsmith <kris@symfony.com>
* @author Fabien Potencier <fabien@symfony.com>
*/
class Package implements PackageInterface
{
private VersionStrategyInterface $versionStrategy;
private ContextInterface $context;
public function __construct(VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null)
{
$this->versionStrategy = $versionStrategy;
$this->context = $context ?? new NullContext();
}
public function getVersion(string $path): string
{
return $this->versionStrategy->getVersion($path);
}
public function getUrl(string $path): string
{
if ($this->isAbsoluteUrl($path)) {
return $path;
}
return $this->versionStrategy->applyVersion($path);
}
protected function getContext(): ContextInterface
{
return $this->context;
}
protected function getVersionStrategy(): VersionStrategyInterface
{
return $this->versionStrategy;
}
protected function isAbsoluteUrl(string $url): bool
{
return str_contains($url, '://') || str_starts_with($url, '//');
}
}

View File

@@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset;
/**
* Asset package interface.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
interface PackageInterface
{
/**
* Returns the asset version for an asset.
*/
public function getVersion(string $path): string;
/**
* Returns an absolute or root-relative public path.
*/
public function getUrl(string $path): string;
}

106
vendor/symfony/asset/Packages.php vendored Normal file
View File

@@ -0,0 +1,106 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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\Exception\InvalidArgumentException;
use Symfony\Component\Asset\Exception\LogicException;
/**
* Helps manage asset URLs.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Kris Wallsmith <kris@symfony.com>
*/
class Packages
{
private ?PackageInterface $defaultPackage;
private array $packages = [];
/**
* @param PackageInterface[] $packages Additional packages indexed by name
*/
public function __construct(?PackageInterface $defaultPackage = null, iterable $packages = [])
{
$this->defaultPackage = $defaultPackage;
foreach ($packages as $name => $package) {
$this->addPackage($name, $package);
}
}
/**
* @return void
*/
public function setDefaultPackage(PackageInterface $defaultPackage)
{
$this->defaultPackage = $defaultPackage;
}
/**
* @return void
*/
public function addPackage(string $name, PackageInterface $package)
{
$this->packages[$name] = $package;
}
/**
* Returns an asset package.
*
* @param string|null $name The name of the package or null for the default package
*
* @throws InvalidArgumentException If there is no package by that name
* @throws LogicException If no default package is defined
*/
public function getPackage(?string $name = null): PackageInterface
{
if (null === $name) {
if (null === $this->defaultPackage) {
throw new LogicException('There is no default asset package, configure one first.');
}
return $this->defaultPackage;
}
if (!isset($this->packages[$name])) {
throw new InvalidArgumentException(\sprintf('There is no "%s" asset package.', $name));
}
return $this->packages[$name];
}
/**
* Gets the version to add to public URL.
*
* @param string $path A public path
* @param string|null $packageName A package name
*/
public function getVersion(string $path, ?string $packageName = null): string
{
return $this->getPackage($packageName)->getVersion($path);
}
/**
* Returns the public path.
*
* Absolute paths (i.e. http://...) are returned unmodified.
*
* @param string $path A public path
* @param string|null $packageName The name of the asset package to use
*
* @return string A public path which takes into account the base path and URL path
*/
public function getUrl(string $path, ?string $packageName = null): string
{
return $this->getPackage($packageName)->getUrl($path);
}
}

68
vendor/symfony/asset/PathPackage.php vendored Normal file
View File

@@ -0,0 +1,68 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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 <fabien@symfony.com>
*/
class PathPackage extends Package
{
private string $basePath;
/**
* @param string $basePath The base path to be prepended to relative paths
*/
public function __construct(string $basePath, VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null)
{
parent::__construct($versionStrategy, $context);
if (!$basePath) {
$this->basePath = '/';
} else {
if ('/' != $basePath[0]) {
$basePath = '/'.$basePath;
}
$this->basePath = rtrim($basePath, '/').'/';
}
}
public function getUrl(string $path): string
{
$versionedPath = parent::getUrl($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.
*/
public function getBasePath(): string
{
return $this->getContext()->getBasePath().$this->basePath;
}
}

126
vendor/symfony/asset/UrlPackage.php vendored Normal file
View File

@@ -0,0 +1,126 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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\Exception\InvalidArgumentException;
use Symfony\Component\Asset\Exception\LogicException;
use Symfony\Component\Asset\VersionStrategy\VersionStrategyInterface;
/**
* Package that adds a base URL to asset URLs in addition to a version.
*
* The package allows to use more than one base URLs in which case
* it randomly chooses one for each asset; it also guarantees that
* any given path will always use the same base URL to be nice with
* HTTP caching mechanisms.
*
* When the request context is available, this package can choose the
* best base URL to use based on the current request scheme:
*
* * For HTTP request, it chooses between all base URLs;
* * For HTTPs requests, it chooses between HTTPs base URLs and relative protocol URLs
* or falls back to any base URL if no secure ones are available.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class UrlPackage extends Package
{
private array $baseUrls = [];
private ?self $sslPackage = null;
/**
* @param string|string[] $baseUrls Base asset URLs
*/
public function __construct(string|array $baseUrls, VersionStrategyInterface $versionStrategy, ?ContextInterface $context = null)
{
parent::__construct($versionStrategy, $context);
if (!\is_array($baseUrls)) {
$baseUrls = (array) $baseUrls;
}
if (!$baseUrls) {
throw new LogicException('You must provide at least one base URL.');
}
foreach ($baseUrls as $baseUrl) {
$this->baseUrls[] = rtrim($baseUrl, '/');
}
$sslUrls = $this->getSslUrls($baseUrls);
if ($sslUrls && $baseUrls !== $sslUrls) {
$this->sslPackage = new self($sslUrls, $versionStrategy);
}
}
public function getUrl(string $path): string
{
if ($this->isAbsoluteUrl($path)) {
return $path;
}
if (null !== $this->sslPackage && $this->getContext()->isSecure()) {
return $this->sslPackage->getUrl($path);
}
$url = $this->getVersionStrategy()->applyVersion($path);
if ($this->isAbsoluteUrl($url)) {
return $url;
}
if ($url && '/' != $url[0]) {
$url = '/'.$url;
}
return $this->getBaseUrl($path).$url;
}
/**
* Returns the base URL for a path.
*/
public function getBaseUrl(string $path): string
{
if (1 === \count($this->baseUrls)) {
return $this->baseUrls[0];
}
return $this->baseUrls[$this->chooseBaseUrl($path)];
}
/**
* Determines which base URL to use for the given path.
*
* Override this method to change the default distribution strategy.
* This method should always return the same base URL index for a given path.
*/
protected function chooseBaseUrl(string $path): int
{
return abs(crc32($path)) % \count($this->baseUrls);
}
private function getSslUrls(array $urls): array
{
$sslUrls = [];
foreach ($urls as $url) {
if (str_starts_with($url, 'https://') || str_starts_with($url, '//') || '' === $url) {
$sslUrls[] = $url;
} elseif (!parse_url($url, \PHP_URL_SCHEME)) {
throw new InvalidArgumentException(\sprintf('"%s" is not a valid URL.', $url));
}
}
return $sslUrls;
}
}

View File

@@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\VersionStrategy;
/**
* Disable version for all assets.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class EmptyVersionStrategy implements VersionStrategyInterface
{
public function getVersion(string $path): string
{
return '';
}
public function applyVersion(string $path): string
{
return $path;
}
}

View File

@@ -0,0 +1,133 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\VersionStrategy;
use Symfony\Component\Asset\Exception\AssetNotFoundException;
use Symfony\Component\Asset\Exception\LogicException;
use Symfony\Component\Asset\Exception\RuntimeException;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
/**
* Reads the versioned path of an asset from a JSON manifest file.
*
* For example, the manifest file might look like this:
* {
* "main.js": "main.abc123.js",
* "css/styles.css": "css/styles.555abc.css"
* }
*
* You could then ask for the version of "main.js" or "css/styles.css".
*/
class JsonManifestVersionStrategy implements VersionStrategyInterface
{
private string $manifestPath;
private array $manifestData;
private ?HttpClientInterface $httpClient;
private bool $strictMode;
/**
* @param string $manifestPath Absolute path to the manifest file
* @param bool $strictMode Throws an exception for unknown paths
*/
public function __construct(string $manifestPath, ?HttpClientInterface $httpClient = null, bool $strictMode = false)
{
$this->manifestPath = $manifestPath;
$this->httpClient = $httpClient;
$this->strictMode = $strictMode;
if (null === $this->httpClient && ($scheme = parse_url($this->manifestPath, \PHP_URL_SCHEME)) && str_starts_with($scheme, 'http')) {
throw new LogicException(\sprintf('The "%s" class needs an HTTP client to use a remote manifest. Try running "composer require symfony/http-client".', self::class));
}
}
/**
* With a manifest, we don't really know or care about what
* the version is. Instead, this returns the path to the
* versioned file.
*/
public function getVersion(string $path): string
{
return $this->applyVersion($path);
}
public function applyVersion(string $path): string
{
return $this->getManifestPath($path) ?: $path;
}
private function getManifestPath(string $path): ?string
{
if (!isset($this->manifestData)) {
if (null !== $this->httpClient && ($scheme = parse_url($this->manifestPath, \PHP_URL_SCHEME)) && str_starts_with($scheme, 'http')) {
try {
$this->manifestData = $this->httpClient->request('GET', $this->manifestPath, [
'headers' => ['accept' => 'application/json'],
])->toArray();
} catch (DecodingExceptionInterface $e) {
throw new RuntimeException(\sprintf('Error parsing JSON from asset manifest URL "%s".', $this->manifestPath), 0, $e);
} catch (ClientExceptionInterface $e) {
throw new RuntimeException(\sprintf('Error loading JSON from asset manifest URL "%s".', $this->manifestPath), 0, $e);
}
} else {
if (!is_file($this->manifestPath)) {
throw new RuntimeException(\sprintf('Asset manifest file "%s" does not exist. Did you forget to build the assets with npm or yarn?', $this->manifestPath));
}
try {
$this->manifestData = json_decode(file_get_contents($this->manifestPath), true, flags: \JSON_THROW_ON_ERROR);
} catch (\JsonException $e) {
throw new RuntimeException(\sprintf('Error parsing JSON from asset manifest file "%s": ', $this->manifestPath).$e->getMessage(), previous: $e);
}
}
}
if (isset($this->manifestData[$path])) {
return $this->manifestData[$path];
}
if ($this->strictMode) {
$message = \sprintf('Asset "%s" not found in manifest "%s".', $path, $this->manifestPath);
$alternatives = $this->findAlternatives($path, $this->manifestData);
if (\count($alternatives) > 0) {
$message .= \sprintf(' Did you mean one of these? "%s".', implode('", "', $alternatives));
}
throw new AssetNotFoundException($message, $alternatives);
}
return null;
}
private function findAlternatives(string $path, array $manifestData): array
{
$path = strtolower($path);
$alternatives = [];
foreach ($manifestData as $key => $value) {
$lev = levenshtein($path, strtolower($key));
if ($lev <= \strlen($path) / 3 || false !== stripos($key, $path)) {
$alternatives[$key] = isset($alternatives[$key]) ? min($lev, $alternatives[$key]) : $lev;
}
$lev = levenshtein($path, strtolower($value));
if ($lev <= \strlen($path) / 3 || false !== stripos($key, $path)) {
$alternatives[$key] = isset($alternatives[$key]) ? min($lev, $alternatives[$key]) : $lev;
}
}
asort($alternatives);
return array_keys($alternatives);
}
}

View File

@@ -0,0 +1,49 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\VersionStrategy;
/**
* Returns the same version for all assets.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class StaticVersionStrategy implements VersionStrategyInterface
{
private string $version;
private string $format;
/**
* @param string $version Version number
* @param string $format Url format
*/
public function __construct(string $version, ?string $format = null)
{
$this->version = $version;
$this->format = $format ?: '%s?%s';
}
public function getVersion(string $path): string
{
return $this->version;
}
public function applyVersion(string $path): string
{
$versionized = \sprintf($this->format, ltrim($path, '/'), $this->getVersion($path));
if ($path && '/' === $path[0]) {
return '/'.$versionized;
}
return $versionized;
}
}

View File

@@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Asset\VersionStrategy;
/**
* Asset version strategy interface.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface VersionStrategyInterface
{
/**
* Returns the asset version for an asset.
*/
public function getVersion(string $path): string;
/**
* Applies version to the supplied path.
*/
public function applyVersion(string $path): string;
}