Ekdant-Online-Store/admininistrator/controller/startup/extension.php
2024-08-06 18:06:00 +05:45

36 lines
1.4 KiB
PHP

<?php
namespace Opencart\Admin\Controller\Startup;
/**
* Class Extension
*
* @package Opencart\Admin\Controller\Startup
*/
class Extension extends \Opencart\System\Engine\Controller {
/**
* @return void
*/
public function index(): void {
// Add extension paths from the DB
$this->load->model('setting/extension');
$results = $this->model_setting_extension->getInstalls();
foreach ($results as $result) {
$extension = str_replace(['_', '/'], ['', '\\'], ucwords($result['code'], '_/'));
// Register controllers, models and system extension folders
$this->autoloader->register('Opencart\Admin\Controller\Extension\\' . $extension, DIR_EXTENSION . $result['code'] . '/admin/controller/');
$this->autoloader->register('Opencart\Admin\Model\Extension\\' . $extension, DIR_EXTENSION . $result['code'] . '/admin/model/');
$this->autoloader->register('Opencart\System\Library\Extension\\' . $extension, DIR_EXTENSION . $result['code'] . '/system/library/');
// Template directory
$this->template->addPath('extension/' . $result['code'], DIR_EXTENSION . $result['code'] . '/admin/view/template/');
// Language directory
$this->language->addPath('extension/' . $result['code'], DIR_EXTENSION . $result['code'] . '/admin/language/');
// Config directory
$this->config->addPath('extension/' . $result['code'], DIR_EXTENSION . $result['code'] . '/system/config/');
}
}
}