This commit is contained in:
parent
ee59c8a562
commit
8c9afc5a13
@ -22,10 +22,10 @@
|
||||
"vendor-dir": "upload/system/storage/vendor/"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.4",
|
||||
"php": ">=8.0.2",
|
||||
"scssphp/scssphp": "^1.10.0",
|
||||
"twig/twig": "^3.3.7",
|
||||
"aws/aws-sdk-php": "^3.306"
|
||||
"twig/twig": "^3.18.0",
|
||||
"aws/aws-sdk-php": "^3.336.13"
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
4
composer.lock
generated
4
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ef7a9cd4b6f9e6483051023d627b600e",
|
||||
"content-hash": "812202261cd9c13d3c68e9bb303e92f8",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-crt-php",
|
||||
@ -1223,7 +1223,7 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=7.4"
|
||||
"php": ">=8.0.2"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
|
@ -611,100 +611,9 @@ class Installer extends \Opencart\System\Engine\Controller {
|
||||
}
|
||||
|
||||
if (!$json) {
|
||||
// Generate php autoload file
|
||||
$code = '<?php' . "\n";
|
||||
$this->load->helper('vendor');
|
||||
|
||||
$files = glob(DIR_STORAGE . 'vendor/*/*/composer.json');
|
||||
|
||||
foreach ($files as $file) {
|
||||
$output = json_decode(file_get_contents($file), true);
|
||||
|
||||
$code .= '// ' . $output['name'] . "\n";
|
||||
|
||||
if (isset($output['autoload'])) {
|
||||
$directory = substr(dirname($file), strlen(DIR_STORAGE . 'vendor/'));
|
||||
|
||||
// Autoload psr-4 files
|
||||
if (isset($output['autoload']['psr-4'])) {
|
||||
$autoload = $output['autoload']['psr-4'];
|
||||
|
||||
foreach ($autoload as $namespace => $path) {
|
||||
if (!is_array($path)) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . $directory . '/' . rtrim($path, '/') . '/' . '\', true);' . "\n";
|
||||
} else {
|
||||
foreach ($path as $value) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . $directory . '/' . rtrim($value, '/') . '/' . '\', true);' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Autoload psr-0 files
|
||||
if (isset($output['autoload']['psr-0'])) {
|
||||
$autoload = $output['autoload']['psr-0'];
|
||||
|
||||
foreach ($autoload as $namespace => $path) {
|
||||
if (!is_array($path)) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . $directory . '/' . rtrim($path, '/') . '/' . '\', true);' . "\n";
|
||||
} else {
|
||||
foreach ($path as $value) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . $directory . '/' . rtrim($value, '/') . '/' . '\', true);' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Autoload classmap
|
||||
if (isset($output['autoload']['classmap'])) {
|
||||
$autoload = [];
|
||||
|
||||
$classmaps = $output['autoload']['classmap'];
|
||||
|
||||
foreach ($classmaps as $classmap) {
|
||||
$directories = [dirname($file) . '/' . $classmap];
|
||||
|
||||
while (count($directories) != 0) {
|
||||
$next = array_shift($directories);
|
||||
|
||||
if (is_dir($next)) {
|
||||
foreach (glob(trim($next, '/') . '/{*,.[!.]*,..?*}', GLOB_BRACE) as $file) {
|
||||
if (is_dir($file)) {
|
||||
$directories[] = $file . '/';
|
||||
}
|
||||
|
||||
if (is_file($file)) {
|
||||
$namespace = substr(dirname($file), strlen(DIR_STORAGE . 'vendor/' . $directory . $classmap) + 1);
|
||||
|
||||
if ($namespace) {
|
||||
$autoload[$namespace] = substr(dirname($file), strlen(DIR_STORAGE . 'vendor/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($autoload as $namespace => $path) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . rtrim($path, '/') . '/' . '\', true);' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Autoload files
|
||||
if (isset($output['autoload']['files'])) {
|
||||
$files = $output['autoload']['files'];
|
||||
|
||||
foreach ($files as $file) {
|
||||
$code .= 'if (is_file(DIR_STORAGE . \'vendor/' . $directory . '/' . $file . '\')) {' . "\n";
|
||||
$code .= ' require_once(DIR_STORAGE . \'vendor/' . $directory . '/' . $file . '\');' . "\n";
|
||||
$code .= '}' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$code .= "\n";
|
||||
}
|
||||
|
||||
file_put_contents(DIR_SYSTEM . 'vendor.php', trim($code));
|
||||
oc_generate_vendor();
|
||||
|
||||
$json['success'] = $this->language->get('text_success');
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ class Sass extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* Index
|
||||
*
|
||||
* @throws \Exception&\ScssPhp\ScssPhp\Exception\SassException
|
||||
* @throws \Exception\ScssPhp\ScssPhp\Exception\SassException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@ class Sass extends \Opencart\System\Engine\Controller {
|
||||
/**
|
||||
* Index
|
||||
*
|
||||
* @throws \Exception&\ScssPhp\ScssPhp\Exception\SassException
|
||||
* @throws \Exception\ScssPhp\ScssPhp\Exception\SassException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -34,7 +34,13 @@
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="row row-cols-sm-2 row-cols-lg-4">
|
||||
{% for category in categories|batch((categories|length / 4)|round(1, 'ceil')) %}
|
||||
{% set total = category.children|length %}
|
||||
{% if total > 20 %}
|
||||
{% set batch = (total / 4)|round(0, 'ceil') %}
|
||||
{% else %}
|
||||
{% set batch = 5 %}
|
||||
{% endif %}
|
||||
{% for category in categories|batch(batch) %}
|
||||
<div class="col">
|
||||
<ul>
|
||||
{% for child in category %}
|
||||
|
@ -5,6 +5,9 @@ $autoloader->register('Opencart\\' . APPLICATION, DIR_APPLICATION);
|
||||
$autoloader->register('Opencart\Extension', DIR_EXTENSION);
|
||||
$autoloader->register('Opencart\System', DIR_SYSTEM);
|
||||
|
||||
//require_once(DIR_SYSTEM . 'helper/vendor.php');
|
||||
//oc_generate_vendor();
|
||||
|
||||
require_once(DIR_SYSTEM . 'vendor.php');
|
||||
|
||||
// Registry
|
||||
|
97
upload/system/helper/vendor.php
Normal file
97
upload/system/helper/vendor.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
// Generate php autoload file
|
||||
function oc_generate_vendor() {
|
||||
$code = '<?php' . "\n";
|
||||
|
||||
$files = glob(DIR_STORAGE . 'vendor/*/*/composer.json');
|
||||
|
||||
foreach ($files as $file) {
|
||||
$output = json_decode(file_get_contents($file), true);
|
||||
|
||||
$code .= '// ' . $output['name'] . "\n";
|
||||
|
||||
if (isset($output['autoload'])) {
|
||||
$directory = substr(dirname($file), strlen(DIR_STORAGE . 'vendor/'));
|
||||
|
||||
// Autoload psr-4 files
|
||||
if (isset($output['autoload']['psr-4'])) {
|
||||
$autoload = $output['autoload']['psr-4'];
|
||||
|
||||
foreach ($autoload as $namespace => $path) {
|
||||
if (!is_array($path)) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . $directory . '/' . rtrim($path, '/') . '/' . '\', true);' . "\n";
|
||||
} else {
|
||||
foreach ($path as $value) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . $directory . '/' . rtrim($value, '/') . '/' . '\', true);' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Autoload psr-0 files
|
||||
if (isset($output['autoload']['psr-0'])) {
|
||||
$autoload = $output['autoload']['psr-0'];
|
||||
|
||||
foreach ($autoload as $namespace => $path) {
|
||||
if (!is_array($path)) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . $directory . '/' . rtrim($path, '/') . '/' . '\', true);' . "\n";
|
||||
} else {
|
||||
foreach ($path as $value) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . $directory . '/' . rtrim($value, '/') . '/' . '\', true);' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Autoload classmap
|
||||
if (isset($output['autoload']['classmap'])) {
|
||||
$autoload = [];
|
||||
|
||||
$classmaps = $output['autoload']['classmap'];
|
||||
|
||||
foreach ($classmaps as $classmap) {
|
||||
$directories = [dirname($file) . '/' . $classmap];
|
||||
|
||||
while (count($directories) != 0) {
|
||||
$next = array_shift($directories);
|
||||
|
||||
if (is_dir($next)) {
|
||||
foreach (glob(trim($next, '/') . '/{*,.[!.]*,..?*}', GLOB_BRACE) as $file) {
|
||||
if (is_dir($file)) {
|
||||
$directories[] = $file . '/';
|
||||
}
|
||||
|
||||
if (is_file($file)) {
|
||||
$namespace = substr(dirname($file), strlen(DIR_STORAGE . 'vendor/' . $directory . $classmap) + 1);
|
||||
|
||||
if ($namespace) {
|
||||
$autoload[$namespace] = substr(dirname($file), strlen(DIR_STORAGE . 'vendor/'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($autoload as $namespace => $path) {
|
||||
$code .= '$autoloader->register(\'' . rtrim($namespace, '\\') . '\', DIR_STORAGE . \'vendor/' . rtrim($path, '/') . '/' . '\', true);' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Autoload files
|
||||
if (isset($output['autoload']['files'])) {
|
||||
$files = $output['autoload']['files'];
|
||||
|
||||
foreach ($files as $file) {
|
||||
$code .= 'if (is_file(DIR_STORAGE . \'vendor/' . $directory . '/' . $file . '\')) {' . "\n";
|
||||
$code .= ' require_once(DIR_STORAGE . \'vendor/' . $directory . '/' . $file . '\');' . "\n";
|
||||
$code .= '}' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$code .= "\n";
|
||||
}
|
||||
|
||||
file_put_contents(DIR_SYSTEM . 'vendor.php', trim($code));
|
||||
}
|
@ -819,8 +819,8 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"bamarni-bin": {
|
||||
"forward-command": false,
|
||||
"bin-links": false
|
||||
"bin-links": false,
|
||||
"forward-command": false
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
|
@ -5052,7 +5052,7 @@ EOL;
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function multiplyMedia(Environment $env = null, $childQueries = null)
|
||||
protected function multiplyMedia(?Environment $env = null, $childQueries = null)
|
||||
{
|
||||
if (
|
||||
! isset($env) ||
|
||||
@ -5144,7 +5144,7 @@ EOL;
|
||||
*
|
||||
* @return \ScssPhp\ScssPhp\Compiler\Environment
|
||||
*/
|
||||
protected function pushEnv(Block $block = null)
|
||||
protected function pushEnv(?Block $block = null)
|
||||
{
|
||||
$env = new Environment();
|
||||
$env->parent = $this->env;
|
||||
@ -5208,7 +5208,7 @@ EOL;
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function set($name, $value, $shadow = false, Environment $env = null, $valueUnreduced = null)
|
||||
protected function set($name, $value, $shadow = false, ?Environment $env = null, $valueUnreduced = null)
|
||||
{
|
||||
$name = $this->normalizeName($name);
|
||||
|
||||
@ -5314,7 +5314,7 @@ EOL;
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function get($name, $shouldThrow = true, Environment $env = null, $unreduced = false)
|
||||
public function get($name, $shouldThrow = true, ?Environment $env = null, $unreduced = false)
|
||||
{
|
||||
$normalizedName = $this->normalizeName($name);
|
||||
$specialContentKey = static::$namespaces['special'] . 'content';
|
||||
@ -5379,7 +5379,7 @@ EOL;
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function has($name, Environment $env = null)
|
||||
protected function has($name, ?Environment $env = null)
|
||||
{
|
||||
return ! \is_null($this->get($name, false, $env));
|
||||
}
|
||||
|
@ -272,7 +272,7 @@ abstract class Formatter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function format(OutputBlock $block, SourceMapGenerator $sourceMapGenerator = null)
|
||||
public function format(OutputBlock $block, ?SourceMapGenerator $sourceMapGenerator = null)
|
||||
{
|
||||
$this->sourceMapGenerator = null;
|
||||
|
||||
|
@ -578,7 +578,7 @@ class Number extends Node implements \ArrayAccess, \JsonSerializable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function output(Compiler $compiler = null)
|
||||
public function output(?Compiler $compiler = null)
|
||||
{
|
||||
$dimension = round($this->dimension, self::PRECISION);
|
||||
|
||||
|
@ -140,7 +140,7 @@ class Parser
|
||||
* @param bool $cssOnly
|
||||
* @param LoggerInterface|null $logger
|
||||
*/
|
||||
public function __construct($sourceName, $sourceIndex = 0, $encoding = 'utf-8', Cache $cache = null, $cssOnly = false, LoggerInterface $logger = null)
|
||||
public function __construct($sourceName, $sourceIndex = 0, $encoding = 'utf-8', ?Cache $cache = null, $cssOnly = false, ?LoggerInterface $logger = null)
|
||||
{
|
||||
$this->sourceName = $sourceName ?: '(stdin)';
|
||||
$this->sourceIndex = $sourceIndex;
|
||||
|
@ -59,7 +59,7 @@ final class Warn
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function setCallback(callable $callback = null)
|
||||
public static function setCallback(?callable $callback = null)
|
||||
{
|
||||
$previousCallback = self::$callback;
|
||||
self::$callback = $callback;
|
||||
|
Loading…
x
Reference in New Issue
Block a user