Skip to content

Commit

Permalink
https://github.com/opencart/opencart/issues/14059
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkerr committed Jul 25, 2024
1 parent 35e0888 commit 269a5f5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions upload/catalog/controller/event/modification.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ public function controller(string &$route, array &$args): void {
return;
}

$pos = strrpos($route, '.');

if ($pos !== false) {
$class = substr($route, 0, $pos);
} else {
$class = $route;
}

if (substr($route, 0, 10) !== 'extension/') {
$class = 'Opencart\Catalog\Controller\Extension\Ocmod\\' . str_replace(['_', '/'], ['', '\\'], ucwords($route, '_/'));
$class = 'Opencart\Catalog\Controller\Extension\Ocmod\\' . str_replace(['_', '/'], ['', '\\'], ucwords($class, '_/'));
} else {
$class = 'Opencart\Catalog\Controller\Extension\Ocmod\Extension\\' . str_replace(['_', '/'], ['', '\\'], ucwords(substr($route, 10), '_/'));
$class = 'Opencart\Catalog\Controller\Extension\Ocmod\Extension\\' . str_replace(['_', '/'], ['', '\\'], ucwords(substr($class, 10), '_/'));
}

if (class_exists($class)) {
Expand Down
5 changes: 4 additions & 1 deletion upload/system/engine/autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class Autoloader {
* Constructor
*/
public function __construct() {
spl_autoload_register(function(string $class): void { $this->load($class); });
spl_autoload_register(function(string $class): void {
$this->load($class);
});

spl_autoload_extensions('.php');
}

Expand Down

0 comments on commit 269a5f5

Please sign in to comment.