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,79 @@
<?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\Templating\Loader;
use Symfony\Component\Templating\Storage\FileStorage;
use Symfony\Component\Templating\Storage\Storage;
use Symfony\Component\Templating\TemplateReferenceInterface;
trigger_deprecation('symfony/templating', '6.4', '"%s" is deprecated since version 6.4 and will be removed in 7.0. Use Twig instead.', CacheLoader::class);
/**
* CacheLoader is a loader that caches other loaders responses
* on the filesystem.
*
* This cache only caches on disk to allow PHP accelerators to cache the opcodes.
* All other mechanism would imply the use of `eval()`.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 6.4, use Twig instead
*/
class CacheLoader extends Loader
{
protected $loader;
protected $dir;
/**
* @param string $dir The directory where to store the cache files
*/
public function __construct(LoaderInterface $loader, string $dir)
{
$this->loader = $loader;
$this->dir = $dir;
}
public function load(TemplateReferenceInterface $template): Storage|false
{
$key = hash('sha256', $template->getLogicalName());
$dir = $this->dir.\DIRECTORY_SEPARATOR.substr($key, 0, 2);
$file = substr($key, 2).'.tpl';
$path = $dir.\DIRECTORY_SEPARATOR.$file;
if (is_file($path)) {
$this->logger?->debug('Fetching template from cache.', ['name' => $template->get('name')]);
return new FileStorage($path);
}
if (false === $storage = $this->loader->load($template)) {
return false;
}
$content = $storage->getContent();
if (!is_dir($dir) && !@mkdir($dir, 0777, true) && !is_dir($dir)) {
throw new \RuntimeException(\sprintf('Cache Loader was not able to create directory "%s".', $dir));
}
file_put_contents($path, $content);
$this->logger?->debug('Storing template in cache.', ['name' => $template->get('name')]);
return new FileStorage($path);
}
public function isFresh(TemplateReferenceInterface $template, int $time): bool
{
return $this->loader->isFresh($template, $time);
}
}

View File

@@ -0,0 +1,67 @@
<?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\Templating\Loader;
use Symfony\Component\Templating\Storage\Storage;
use Symfony\Component\Templating\TemplateReferenceInterface;
trigger_deprecation('symfony/templating', '6.4', '"%s" is deprecated since version 6.4 and will be removed in 7.0. Use Twig instead.', ChainLoader::class);
/**
* ChainLoader is a loader that calls other loaders to load templates.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 6.4, use Twig instead
*/
class ChainLoader extends Loader
{
protected $loaders = [];
/**
* @param LoaderInterface[] $loaders
*/
public function __construct(array $loaders = [])
{
foreach ($loaders as $loader) {
$this->addLoader($loader);
}
}
/**
* @return void
*/
public function addLoader(LoaderInterface $loader)
{
$this->loaders[] = $loader;
}
public function load(TemplateReferenceInterface $template): Storage|false
{
foreach ($this->loaders as $loader) {
if (false !== $storage = $loader->load($template)) {
return $storage;
}
}
return false;
}
public function isFresh(TemplateReferenceInterface $template, int $time): bool
{
foreach ($this->loaders as $loader) {
return $loader->isFresh($template, $time);
}
return false;
}
}

View File

@@ -0,0 +1,99 @@
<?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\Templating\Loader;
use Symfony\Component\Templating\Storage\FileStorage;
use Symfony\Component\Templating\Storage\Storage;
use Symfony\Component\Templating\TemplateReferenceInterface;
trigger_deprecation('symfony/templating', '6.4', '"%s" is deprecated since version 6.4 and will be removed in 7.0. Use Twig instead.', FilesystemLoader::class);
/**
* FilesystemLoader is a loader that read templates from the filesystem.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 6.4, use Twig instead
*/
class FilesystemLoader extends Loader
{
protected $templatePathPatterns;
/**
* @param string|string[] $templatePathPatterns An array of path patterns to look for templates
*/
public function __construct(string|array $templatePathPatterns)
{
$this->templatePathPatterns = (array) $templatePathPatterns;
}
public function load(TemplateReferenceInterface $template): Storage|false
{
$file = $template->get('name');
if (self::isAbsolutePath($file) && is_file($file)) {
return new FileStorage($file);
}
$replacements = [];
foreach ($template->all() as $key => $value) {
$replacements['%'.$key.'%'] = $value;
}
$fileFailures = [];
foreach ($this->templatePathPatterns as $templatePathPattern) {
if (is_file($file = strtr($templatePathPattern, $replacements)) && is_readable($file)) {
$this->logger?->debug('Loaded template file.', ['file' => $file]);
return new FileStorage($file);
}
if (null !== $this->logger) {
$fileFailures[] = $file;
}
}
// only log failures if no template could be loaded at all
foreach ($fileFailures as $file) {
$this->logger?->debug('Failed loading template file.', ['file' => $file]);
}
return false;
}
public function isFresh(TemplateReferenceInterface $template, int $time): bool
{
if (false === $storage = $this->load($template)) {
return false;
}
return filemtime((string) $storage) < $time;
}
/**
* Returns true if the file is an existing absolute path.
*/
protected static function isAbsolutePath(string $file): bool
{
if ('/' == $file[0] || '\\' == $file[0]
|| (\strlen($file) > 3 && ctype_alpha($file[0])
&& ':' == $file[1]
&& ('\\' == $file[2] || '/' == $file[2])
)
|| parse_url($file, \PHP_URL_SCHEME)
) {
return true;
}
return false;
}
}

View File

@@ -0,0 +1,41 @@
<?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\Templating\Loader;
use Psr\Log\LoggerInterface;
trigger_deprecation('symfony/templating', '6.4', '"%s" is deprecated since version 6.4 and will be removed in 7.0. Use Twig instead.', Loader::class);
/**
* Loader is the base class for all template loader classes.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 6.4, use Twig instead
*/
abstract class Loader implements LoaderInterface
{
/**
* @var LoggerInterface|null
*/
protected $logger;
/**
* Sets the debug logger to use for this loader.
*
* @return void
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

View File

@@ -0,0 +1,39 @@
<?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\Templating\Loader;
use Symfony\Component\Templating\Storage\Storage;
use Symfony\Component\Templating\TemplateReferenceInterface;
trigger_deprecation('symfony/templating', '6.4', '"%s" is deprecated since version 6.4 and will be removed in 7.0. Use Twig instead.', LoaderInterface::class);
/**
* LoaderInterface is the interface all loaders must implement.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 6.4, use Twig instead
*/
interface LoaderInterface
{
/**
* Loads a template.
*/
public function load(TemplateReferenceInterface $template): Storage|false;
/**
* Returns true if the template is still fresh.
*
* @param int $time The last modification time of the cached template (timestamp)
*/
public function isFresh(TemplateReferenceInterface $template, int $time): bool;
}