mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-16 11:58:41 +00:00
Restructure
This commit is contained in:
parent
87597e7586
commit
1c98dbbbcf
|
|
@ -29,6 +29,14 @@ namespace phpOMS;
|
|||
class ApplicationAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* App name.
|
||||
*
|
||||
* @var \phpOMS\DataStorage\Database\Pool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public $appName = '';
|
||||
|
||||
/**
|
||||
* Database object.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
namespace phpOMS\Log;
|
||||
|
||||
use phpOMS\Datatypes\Exception\InvalidEnumValue;
|
||||
use phpOMS\Message\Http\Rest;
|
||||
use phpOMS\Message\RequestMethod;
|
||||
use phpOMS\System\FilePathException;
|
||||
use phpOMS\Validation\Validator;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,21 +32,21 @@ use phpOMS\Datatypes\Enum;
|
|||
*/
|
||||
abstract class RequestDestination extends Enum
|
||||
{
|
||||
const WEBSITE = 'website'; /* Website */
|
||||
const API = 'api'; /* API */
|
||||
const SHOP = 'shop'; /* Shop */
|
||||
const BACKEND = 'backend'; /* Backend */
|
||||
const STATICP = 'static'; /* Static content */
|
||||
const FORUM = 'forum'; /* Forum */
|
||||
const TICKET = 'ticket'; /* ???? */
|
||||
const SUPPORT = 'support'; /* Support center */
|
||||
const SURVEY = 'survey'; /* Survey page */
|
||||
const BLOG = 'blog'; /* Blog */
|
||||
const CHART = 'chart'; /* Chart view */
|
||||
const CALENDAR = 'calendar'; /* Calendar */
|
||||
const PROFILE = 'profile'; /* User profile page */
|
||||
const CHAT = 'chat'; /* Chat page */
|
||||
const GALLERY = 'gallery'; /* Chat page */
|
||||
const REPORTER = 'reporter'; /* Reporter page */
|
||||
const WEBSITE = 'Website'; /* Website */
|
||||
const API = 'Api'; /* API */
|
||||
const SHOP = 'Shop'; /* Shop */
|
||||
const BACKEND = 'Backend'; /* Backend */
|
||||
const STATICP = 'Static'; /* Static content */
|
||||
const FORUM = 'Forum'; /* Forum */
|
||||
const TICKET = 'Ticket'; /* ???? */
|
||||
const SUPPORT = 'Support'; /* Support center */
|
||||
const SURVEY = 'Survey'; /* Survey page */
|
||||
const BLOG = 'Blog'; /* Blog */
|
||||
const CHART = 'Chart'; /* Chart view */
|
||||
const CALENDAR = 'Calendar'; /* Calendar */
|
||||
const PROFILE = 'Profile'; /* User profile page */
|
||||
const CHAT = 'Chat'; /* Chat page */
|
||||
const GALLERY = 'Gallery'; /* Chat page */
|
||||
const REPORTER = 'Reporter'; /* Reporter page */
|
||||
// This or let api handle this const GUI = 'gui'; /* Request GUI elements */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ abstract class ModuleAbstract
|
|||
* @var \string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $module = '';
|
||||
const MODULE_NAME = '';
|
||||
|
||||
/**
|
||||
* Localization files.
|
||||
|
|
@ -133,7 +133,7 @@ abstract class ModuleAbstract
|
|||
$lang = [];
|
||||
if (isset(static::$localization[$destination])) {
|
||||
foreach (static::$localization[$destination] as $file) {
|
||||
if(($path = realpath($oldPath = __DIR__ . '/../../Modules/' . static::$module . '/Theme/lang/' . $file . '.' . $language . '.lang.php')) === false) {
|
||||
if(($path = realpath($oldPath = __DIR__ . '/../../Modules/' . static::MODULE_NAME . '/Theme/' . $destination . '/Lang/' . $language . '.lang.php')) === false) {
|
||||
throw new FilePathException($oldPath);
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ abstract class ModuleAbstract
|
|||
public function getName() : \string
|
||||
{
|
||||
/** @noinspection PhpUndefinedFieldInspection */
|
||||
return static::$module;
|
||||
return static::MODULE_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class ModuleManager
|
|||
private $running = [];
|
||||
|
||||
/**
|
||||
* FileCache instance.
|
||||
* Application instance.
|
||||
*
|
||||
* @var ApplicationAbstract
|
||||
* @since 1.0.0
|
||||
|
|
@ -200,7 +200,7 @@ class ModuleManager
|
|||
$lang = [];
|
||||
if (isset($files[5])) {
|
||||
foreach ($files[5] as $module) {
|
||||
$lang[] = '/Modules/' . $module['module_load_from'] . '/Theme/lang/' . $module['module_load_file'];
|
||||
$lang[] = '/Modules/' . $module['module_load_from'] . '/Theme/' . $this->app->appName . '/Lang/' . $module['module_load_file'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -353,6 +353,7 @@ class ModuleManager
|
|||
}
|
||||
|
||||
$class = '\\Modules\\' . $module . '\\Admin\\Installer';
|
||||
/** @var $class InstallerAbstract */
|
||||
$class::install($this->app->dbPool, $info);
|
||||
|
||||
// TODO: change this
|
||||
|
|
@ -409,6 +410,7 @@ class ModuleManager
|
|||
{
|
||||
if (file_exists(self::MODULE_PATH . '/' . $from . '/Admin/Install/' . $for . '.php')) {
|
||||
$class = '\\Modules\\' . $from . '\\Admin\\Install\\' . $for;
|
||||
/** @var $class InstallerAbstract */
|
||||
$class::install($this->app->dbPool, null);
|
||||
}
|
||||
}
|
||||
|
|
@ -465,9 +467,9 @@ class ModuleManager
|
|||
*/
|
||||
public function loadLanguage(\string $language, \string $destination)
|
||||
{
|
||||
foreach ($this->running as $name => $m) {
|
||||
/** @var ModuleAbstract $m */
|
||||
$file = $m->getLocalization($language, $destination);
|
||||
foreach ($this->running as $name => $module) {
|
||||
/** @var ModuleAbstract $module */
|
||||
$file = $module->getLocalization($language, $destination);
|
||||
if (!empty($file)) {
|
||||
$this->app->l11nManager->loadLanguage($language, $name, $file);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user