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