many updates
This commit is contained in:
@@ -12,6 +12,14 @@ services:
|
|||||||
- mysql
|
- mysql
|
||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
ports:
|
||||||
|
- 63001:8080
|
||||||
|
links:
|
||||||
|
- mysql
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
mysql:
|
mysql:
|
||||||
image: "mysql:8.0"
|
image: "mysql:8.0"
|
||||||
restart: 'always'
|
restart: 'always'
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ return [
|
|||||||
'name' => 'varchar(255)',
|
'name' => 'varchar(255)',
|
||||||
'layout' => 'varchar(255)',
|
'layout' => 'varchar(255)',
|
||||||
'data' => 'longtext',
|
'data' => 'longtext',
|
||||||
'slug' => 'varchar(255)',
|
'type' => 'varchar(63)',
|
||||||
|
'status' => 'varchar(63)',
|
||||||
'parent_id' => 'int',
|
'parent_id' => 'int',
|
||||||
'updated_at' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
|
'updated_at' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
|
||||||
'created_at' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
'created_at' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||||
@@ -40,6 +41,7 @@ return [
|
|||||||
'meta_title' => 'varchar(255)',
|
'meta_title' => 'varchar(255)',
|
||||||
'meta_description' => 'varchar(255)',
|
'meta_description' => 'varchar(255)',
|
||||||
'route' => 'varchar(255)',
|
'route' => 'varchar(255)',
|
||||||
|
'target' => 'varchar(255)',
|
||||||
'updated_at' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
|
'updated_at' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
|
||||||
'created_at' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
'created_at' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||||
],
|
],
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -32,7 +32,12 @@ return [
|
|||||||
'page-created' => 'Seite erstellt',
|
'page-created' => 'Seite erstellt',
|
||||||
'page-updated' => 'Seite aktualisiert',
|
'page-updated' => 'Seite aktualisiert',
|
||||||
'page-deleted' => 'Seite gelöscht',
|
'page-deleted' => 'Seite gelöscht',
|
||||||
|
'page-type' => 'Seitentyp',
|
||||||
|
'page-types' => [
|
||||||
|
'static' => 'Statische Seite',
|
||||||
|
'redirect' => 'Weiterleitung',
|
||||||
|
],
|
||||||
|
'target-redirect' => 'Ziel der Weiterleitung',
|
||||||
'files' => 'Dateien',
|
'files' => 'Dateien',
|
||||||
'settings' => 'Einstellungen',
|
'settings' => 'Einstellungen',
|
||||||
'info' => 'Info',
|
'info' => 'Info',
|
||||||
|
|||||||
@@ -32,7 +32,12 @@ return [
|
|||||||
'page-created' => 'Page successfully created',
|
'page-created' => 'Page successfully created',
|
||||||
'page-updated' => 'Page successfully updated',
|
'page-updated' => 'Page successfully updated',
|
||||||
'page-deleted' => 'Page removed',
|
'page-deleted' => 'Page removed',
|
||||||
|
'page-type' => 'Page type',
|
||||||
|
'page-types' => [
|
||||||
|
'static' => 'Static page',
|
||||||
|
'redirect' => 'Redirect',
|
||||||
|
],
|
||||||
|
'target-redirect' => 'Target of redirect',
|
||||||
'files' => 'Files',
|
'files' => 'Files',
|
||||||
'settings' => 'Settings',
|
'settings' => 'Settings',
|
||||||
'info' => 'Info',
|
'info' => 'Info',
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ if (! function_exists('phpb_current_relative_url')) {
|
|||||||
* Give the current URL relative to the base directory (the website's index.php entry point).
|
* Give the current URL relative to the base directory (the website's index.php entry point).
|
||||||
* This omits any parent directories from the URL in which the project is installed.
|
* This omits any parent directories from the URL in which the project is installed.
|
||||||
*/
|
*/
|
||||||
function phpb_current_relative_url(): string
|
function phpb_current_relative_url($removeParameters = false): string
|
||||||
{
|
{
|
||||||
$baseUrl = $_ENV['BASE_URL'];
|
$baseUrl = $_ENV['BASE_URL'];
|
||||||
$baseUrl = rtrim($baseUrl, '/'. DIRECTORY_SEPARATOR);
|
$baseUrl = rtrim($baseUrl, '/'. DIRECTORY_SEPARATOR);
|
||||||
@@ -269,6 +269,9 @@ if (! function_exists('phpb_current_relative_url')) {
|
|||||||
$currentFullUrl = phpb_current_full_url();
|
$currentFullUrl = phpb_current_full_url();
|
||||||
$relativeUrl = substr($currentFullUrl, strlen($baseUrl));
|
$relativeUrl = substr($currentFullUrl, strlen($baseUrl));
|
||||||
$relativeUrl = ltrim($relativeUrl, '/'. DIRECTORY_SEPARATOR);
|
$relativeUrl = ltrim($relativeUrl, '/'. DIRECTORY_SEPARATOR);
|
||||||
|
if($removeParameters) {
|
||||||
|
$relativeUrl = explode('?', $relativeUrl, 2)[0];
|
||||||
|
}
|
||||||
return '/' . $relativeUrl;
|
return '/' . $relativeUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -537,6 +540,61 @@ if (! function_exists('phpb_remove_non_alpha_numeric')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! function_exists('phpb_is_authenticated')) {
|
||||||
|
/**
|
||||||
|
* Create a slug (safe URL or path) of the given string.
|
||||||
|
*/
|
||||||
|
function phpb_is_authenticated(): bool
|
||||||
|
{
|
||||||
|
$auth = new \Plugi\Modules\Auth\Auth();
|
||||||
|
return $auth->isAuthenticated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('phpb_requires_authenticated')) {
|
||||||
|
/**
|
||||||
|
* Create a slug (safe URL or path) of the given string.
|
||||||
|
*/
|
||||||
|
function phpb_requires_authenticated(): void
|
||||||
|
{
|
||||||
|
if (!phpb_is_authenticated()) phpb_redirect('/', [], 403);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! function_exists('phpb_render_setting')) {
|
||||||
|
/**
|
||||||
|
* Create a slug (safe URL or path) of the given string.
|
||||||
|
*/
|
||||||
|
function phpb_render_setting(array $setting): void
|
||||||
|
{
|
||||||
|
$label = phpb_e($setting['label'] ?: $setting['name']);
|
||||||
|
$key = phpb_e($setting['key']);
|
||||||
|
$value = phpb_e($setting['value']);
|
||||||
|
switch ($setting['type']) {
|
||||||
|
case 'toggle':
|
||||||
|
echo <<<EOL
|
||||||
|
<div class="form-control" x-data="{state: $value}">
|
||||||
|
<label class="label cursor-pointer">
|
||||||
|
<span class="label-text">$label</span>
|
||||||
|
<input type='hidden' :value="state" name="$key">
|
||||||
|
<input type="checkbox" class="toggle" x-model="state" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
EOL;
|
||||||
|
|
||||||
|
case 'text':
|
||||||
|
echo <<<EOL
|
||||||
|
<div class="form-control w-full">
|
||||||
|
<label class="label">
|
||||||
|
<span class="label-text">$label</span>
|
||||||
|
</label>
|
||||||
|
<input type="text" name="$key" value="$value" class="input input-bordered w-full" />
|
||||||
|
</div>
|
||||||
|
EOL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! function_exists('phpb_autoload')) {
|
if (! function_exists('phpb_autoload')) {
|
||||||
/**
|
/**
|
||||||
* Autoload classes from the Plugi package.
|
* Autoload classes from the Plugi package.
|
||||||
@@ -545,6 +603,7 @@ if (! function_exists('phpb_autoload')) {
|
|||||||
{
|
{
|
||||||
// PSR-0 autoloader
|
// PSR-0 autoloader
|
||||||
$className = ltrim($className, '\\');
|
$className = ltrim($className, '\\');
|
||||||
|
$isExtension = str_contains($className, 'Plugi\\Extensions\\');
|
||||||
$fileName = '';
|
$fileName = '';
|
||||||
$namespace = '';
|
$namespace = '';
|
||||||
if ($lastNsPos = strripos($className, '\\')) {
|
if ($lastNsPos = strripos($className, '\\')) {
|
||||||
@@ -553,13 +612,23 @@ if (! function_exists('phpb_autoload')) {
|
|||||||
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
|
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
|
||||||
}
|
}
|
||||||
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
|
$fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
|
||||||
|
|
||||||
// remove leading Plugi/ from the class path
|
// remove leading Plugi/ from the class path
|
||||||
$fileName = str_replace('Plugi' . DIRECTORY_SEPARATOR, '', $fileName);
|
$fileName = str_replace('Plugi' . DIRECTORY_SEPARATOR, '', $fileName);
|
||||||
|
if ($isExtension) {
|
||||||
|
$fileName = str_replace('Extensions' . DIRECTORY_SEPARATOR, '', $fileName);
|
||||||
|
$fileFragments = explode(DIRECTORY_SEPARATOR, $fileName, 2);
|
||||||
|
$extensionName = strtolower($fileFragments[0]);
|
||||||
|
if (key_exists($extensionName, \Plugi\Extensions::getConfigs())) {
|
||||||
|
$dir = \Plugi\Extensions::getConfigs()[$extensionName]['dir'];
|
||||||
|
require $dir . '/admin/Classes/' . $fileFragments[1];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
// include class files starting in the src directory
|
// include class files starting in the src directory
|
||||||
require __DIR__ . '/../' . $fileName;
|
require __DIR__ . '/../' . $fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! function_exists('phpb_registered_assets')) {
|
if (! function_exists('phpb_registered_assets')) {
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ class Extensions
|
|||||||
];
|
];
|
||||||
|
|
||||||
protected static $htmlBlocks = [
|
protected static $htmlBlocks = [
|
||||||
'head-end' => [],
|
'head' => [],
|
||||||
'body-start' => [],
|
'body-start' => [],
|
||||||
'body-end' => [],
|
'body-end' => [],
|
||||||
'admin-head-end' => [],
|
'admin-head' => [],
|
||||||
'admin-body-start' => [],
|
'admin-body-start' => [],
|
||||||
'admin-body-end' => [],
|
'admin-body-end' => [],
|
||||||
];
|
];
|
||||||
@@ -71,10 +71,8 @@ class Extensions
|
|||||||
* @param string $html
|
* @param string $html
|
||||||
* @param string $location
|
* @param string $location
|
||||||
*/
|
*/
|
||||||
public static function registerHtmlBlock(string $html, string $location = 'head-end') {
|
public static function registerHtmlBlock(string $html, string $location = 'head') {
|
||||||
self::$assets[$location][] = [
|
self::$htmlBlocks[$location][] = $html;
|
||||||
'html' => $html,
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -181,7 +179,7 @@ class Extensions
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$setting['value'] = $settingIns::get($setting['key']) ?: $setting['default'];
|
$setting['value'] = $settingIns::get($setting['key']) ?: $setting['default'];
|
||||||
$hydrSettings[] = $setting;
|
$hydrSettings[$setting['name']] = $setting;
|
||||||
}
|
}
|
||||||
return $hydrSettings;
|
return $hydrSettings;
|
||||||
}
|
}
|
||||||
@@ -245,14 +243,16 @@ class Extensions
|
|||||||
/**
|
/**
|
||||||
* Get all header assets.
|
* Get all header assets.
|
||||||
*/
|
*/
|
||||||
public static function getHtmlBlocks(string $location = 'head-end') {
|
public static function getHtmlBlocks(string $location = 'head'): string
|
||||||
|
{
|
||||||
return implode('', self::$htmlBlocks[$location]);
|
return implode('', self::$htmlBlocks[$location]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all header assets.
|
* Get all header assets.
|
||||||
*/
|
*/
|
||||||
public static function getHeaderAssets() {
|
public static function getHeaderAssets(): array
|
||||||
|
{
|
||||||
return self::$assets['header'];
|
return self::$assets['header'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container p-4">
|
||||||
<?php
|
<?php
|
||||||
require __DIR__ . '/' . $viewFile . '.php';
|
require __DIR__ . '/' . $viewFile . '.php';
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -15,15 +15,15 @@ if (isset($_GET['tab'])) {
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<title><?= phpb_trans('website-manager.title') ?></title>
|
<title><?= phpb_trans('website-manager.title') ?></title>
|
||||||
<link rel="icon" href="/plugi-core/dist/images/logo-color.png">
|
<link rel="icon" href="/plugi-core/dist/images/logo-color.png">
|
||||||
<?= phpb_registered_assets('admin-header') ?>
|
<?php phpb_registered_assets('admin-header') ?>
|
||||||
<link href="<?= phpb_asset('WebsiteManager.css') ?>" rel="stylesheet">
|
<link href="<?= phpb_asset('WebsiteManager.css') ?>" rel="stylesheet">
|
||||||
<link href="<?= phpb_asset('icons/duotone/style.css') ?>" rel="stylesheet">
|
<link href="<?= phpb_asset('icons/duotone/style.css') ?>" rel="stylesheet">
|
||||||
<link href="<?= phpb_asset('icons/regular/style.css') ?>" rel="stylesheet">
|
<link href="<?= phpb_asset('icons/regular/style.css') ?>" rel="stylesheet">
|
||||||
<link href="<?= phpb_asset('icons/bold/style.css') ?>" rel="stylesheet">
|
<link href="<?= phpb_asset('icons/bold/style.css') ?>" rel="stylesheet">
|
||||||
<?= Extensions::getHtmlBlocks('head-end') ?>
|
<?= Extensions::getHtmlBlocks('admin-head') ?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?= Extensions::getHtmlBlocks('body-start') ?>
|
<?= Extensions::getHtmlBlocks('admin-body-start') ?>
|
||||||
|
|
||||||
<div class="drawer lg:drawer-open">
|
<div class="drawer lg:drawer-open">
|
||||||
<input id="my-drawer-2" type="checkbox" class="drawer-toggle" />
|
<input id="my-drawer-2" type="checkbox" class="drawer-toggle" />
|
||||||
@@ -90,6 +90,6 @@ if (isset($_GET['tab'])) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="<?= phpb_asset('WebsiteManager.js') ?>"></script>
|
<script src="<?= phpb_asset('WebsiteManager.js') ?>"></script>
|
||||||
<?= Extensions::getHtmlBlocks('body-end') ?>
|
<?= Extensions::getHtmlBlocks('admin-body-end') ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ $pageTranslations = $page ? $page->getTranslations() : [];
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="max-w-lg p-4 mx-auto">
|
<div class="max-w-lg p-4 mx-auto" x-data="{type: '<?= phpb_field_value('type', $page) ?? 'static' ?>'}">
|
||||||
<div class="form-control w-full mb-4">
|
<div class="form-control w-full mb-4">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
<span class="label-text"> <?= phpb_trans('website-manager.name') ?></span>
|
<span class="label-text"> <?= phpb_trans('website-manager.name') ?></span>
|
||||||
@@ -33,6 +33,26 @@ $pageTranslations = $page ? $page->getTranslations() : [];
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-control w-full mb-4">
|
<div class="form-control w-full mb-4">
|
||||||
|
<label class="label">
|
||||||
|
<span class="label-text"><?= phpb_trans('website-manager.page-type') ?></span>
|
||||||
|
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <!-- TODO add to lang -->
|
||||||
|
</label>
|
||||||
|
<select class="select select-bordered" x-model="type" id="type" name="type" required>
|
||||||
|
<?php
|
||||||
|
$types = ['static', 'redirect'];
|
||||||
|
$value = phpb_field_value('type', $page);
|
||||||
|
foreach ($types as $type):
|
||||||
|
if ($type === $value):
|
||||||
|
echo '<option value="' . phpb_e($type) . '" selected>' . phpb_trans('website-manager.page-types.'.$type) . '</option>';
|
||||||
|
else:
|
||||||
|
echo '<option value="' . phpb_e($type) . '">' . phpb_trans('website-manager.page-types.'.$type) . '</option>';
|
||||||
|
endif;
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-control w-full mb-4" x-show="type !== 'redirect'">
|
||||||
<label class="label">
|
<label class="label">
|
||||||
<span class="label-text"><?= phpb_trans('website-manager.layout') ?></span>
|
<span class="label-text"><?= phpb_trans('website-manager.layout') ?></span>
|
||||||
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <!-- TODO add to lang -->
|
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span> <!-- TODO add to lang -->
|
||||||
@@ -64,31 +84,38 @@ $pageTranslations = $page ? $page->getTranslations() : [];
|
|||||||
<span class="label-text"><?= phpb_trans('website-manager.page-title') ?></span>
|
<span class="label-text"><?= phpb_trans('website-manager.page-title') ?></span>
|
||||||
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span>
|
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-title" name="title[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($pageTranslations[$languageCode]['title'] ?? '') ?>" @input="if(empty){route=`${locale}/${slugify($event.target.value)}`}" required />
|
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-title" name="title[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($pageTranslations[$languageCode]['title'] ?? '') ?>" @input="if(empty){route=`${locale}/${slugify($event.target.value)}`}" :required="type==='static'" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-control w-full mb-2">
|
<div class="form-control w-full mb-2" x-show="type === 'static'">
|
||||||
<label class="label" for="<?= phpb_e($languageCode) ?>-page-meta-title">
|
<label class="label" for="<?= phpb_e($languageCode) ?>-page-meta-title">
|
||||||
<span class="label-text"><?= phpb_trans('website-manager.page-meta-title') ?></span>
|
<span class="label-text"><?= phpb_trans('website-manager.page-meta-title') ?></span>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-meta-title" name="meta_title[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($pageTranslations[$languageCode]['meta_title'] ?? '') ?>" />
|
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-meta-title" name="meta_title[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($pageTranslations[$languageCode]['meta_title'] ?? '') ?>" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-control w-full mb-2">
|
<div class="form-control w-full mb-2" x-show="type === 'static'">
|
||||||
<label class="label" for="<?= phpb_e($languageCode) ?>-page-meta-description">
|
<label class="label" for="<?= phpb_e($languageCode) ?>-page-meta-description">
|
||||||
<span class="label-text"><?= phpb_trans('website-manager.page-meta-description') ?></span>
|
<span class="label-text"><?= phpb_trans('website-manager.page-meta-description') ?></span>
|
||||||
</label>
|
</label>
|
||||||
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-meta-description" name="meta_description[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($pageTranslations[$languageCode]['meta_description'] ?? '') ?>" />
|
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-meta-description" name="meta_description[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($pageTranslations[$languageCode]['meta_description'] ?? '') ?>" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-control w-full mb-2" x-show="type === 'redirect'">
|
||||||
|
<label class="label" for="<?= phpb_e($languageCode) ?>-page-target-redirect">
|
||||||
|
<span class="label-text"><?= phpb_trans('website-manager.target-redirect') ?></span>
|
||||||
|
</label>
|
||||||
|
<input type="text" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-target-redirect" name="target[<?= phpb_e($languageCode) ?>]" value="<?= phpb_e($pageTranslations[$languageCode]['target'] ?? '') ?>" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-control w-full mb-2">
|
<div class="form-control w-full mb-2">
|
||||||
<label class="label" for="<?= phpb_e($languageCode) ?>-page-route">
|
<label class="label" for="<?= phpb_e($languageCode) ?>-page-route">
|
||||||
<span class="label-text"><?= phpb_trans('website-manager.route') ?></span>
|
<span class="label-text"><?= phpb_trans('website-manager.route') ?></span>
|
||||||
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span>
|
<span class="label-text-alt"><?= phpb_trans('website-manager.required') ?></span>
|
||||||
</label>
|
</label>
|
||||||
<div class="join" x-data="{disabled: true}">
|
<div class="join" x-data="{disabled: true}">
|
||||||
<input type="text" class="input input-bordered join-item w-full" id="<?= phpb_e($languageCode) ?>-page-route" name="route[<?= phpb_e($languageCode) ?>]" :value="route" :disabled="disabled" required />
|
<input type="text" :class="{'join-item': type !== 'redirect'}" class="input input-bordered w-full" id="<?= phpb_e($languageCode) ?>-page-route" name="route[<?= phpb_e($languageCode) ?>]" :value="route" :disabled="disabled && type !== 'redirect'" required />
|
||||||
<button class="btn join-item btn-outline text-2xl" @click.stop.prevent="disabled=!disabled" type="button" >
|
<button class="btn join-item btn-outline text-2xl" @click.stop.prevent="disabled=!disabled" type="button" x-show="type !== 'redirect'">
|
||||||
<i class="ph ph-pencil" x-show="disabled"></i>
|
<i class="ph ph-pencil" x-show="disabled"></i>
|
||||||
<i class="ph ph-pencil-slash" x-show="!disabled"></i>
|
<i class="ph ph-pencil-slash" x-show="!disabled"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ use Plugi\Setting;
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="align-top">Installed extensions</th>
|
<th class="align-top">Installed extensions</th>
|
||||||
<td>
|
<td x-data="{show: false}">
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
foreach (\Plugi\Extensions::getConfigs() as $ext) :
|
foreach (\Plugi\Extensions::getConfigs() as $ext) :
|
||||||
@@ -80,6 +80,12 @@ use Plugi\Setting;
|
|||||||
endforeach;
|
endforeach;
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
<div>
|
||||||
|
<button @click="show = !show" class="btn btn-xs btn-outline" x-text="show ? 'hide' : 'show config'"></button>
|
||||||
|
</div>
|
||||||
|
<pre class="mt-4" x-show="show"><?php
|
||||||
|
print_r(\Plugi\Extensions::getConfigs());
|
||||||
|
?></pre>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -26,10 +26,10 @@
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<a href="<?= phpb_e(phpb_full_url($page->getRoute())) ?>" title="<?= phpb_trans('website-manager.view') ?>" target="_blank" class="btn btn-light btn-outline btn-sm btn-circle">
|
<a href="<?= phpb_e(phpb_full_url($page->getRoute())) ?>" title="<?= phpb_trans('website-manager.view') ?>" target="_blank" class="btn btn-light btn-outline btn-sm btn-circle <?= $page->get('type') === 'redirect' ? 'btn-disabled' : '' ?>">
|
||||||
<i class="text-xl ph-duotone ph-eye"></i>
|
<i class="text-xl ph-duotone ph-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="<?= phpb_url('pagebuilder', ['page' => $page->getId()]) ?>" class="btn btn-primary hidden md:inline-flex btn-sm btn-circle" title="<?= phpb_trans('website-manager.edit') ?>">
|
<a href="<?= phpb_url('pagebuilder', ['page' => $page->getId()]) ?>" class="btn btn-primary hidden md:inline-flex btn-sm btn-circle <?= $page->get('type') === 'redirect' ? 'btn-disabled' : '' ?>" title="<?= phpb_trans('website-manager.edit') ?>">
|
||||||
<i class="text-xl ph-duotone ph-pencil-line"></i>
|
<i class="text-xl ph-duotone ph-pencil-line"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'edit', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.settings') ?>" class="btn btn-secondary btn-sm btn-circle">
|
<a href="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => 'edit', 'page' => $page->getId()]) ?>" title="<?= phpb_trans('website-manager.settings') ?>" class="btn btn-secondary btn-sm btn-circle">
|
||||||
|
|||||||
@@ -423,6 +423,13 @@ class Plugi
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Extensions::getRoute(phpb_current_relative_url(true))){
|
||||||
|
$ext = include Extensions::getRoutes()[phpb_current_relative_url(true)];
|
||||||
|
if($ext !== 'continue'){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// try to find page in cache
|
// try to find page in cache
|
||||||
$cache = phpb_instance('cache');
|
$cache = phpb_instance('cache');
|
||||||
if (phpb_config('cache.enabled') &&
|
if (phpb_config('cache.enabled') &&
|
||||||
@@ -438,13 +445,6 @@ class Plugi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Extensions::getRoute(phpb_current_relative_url())){
|
|
||||||
$ext = include Extensions::getRoutes()[phpb_current_relative_url()];
|
|
||||||
if($ext !== 'continue'){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// let the page router resolve the current URL
|
// let the page router resolve the current URL
|
||||||
$page = null;
|
$page = null;
|
||||||
$pageTranslation = $this->resolvePageLanguageVariantFromUrl(phpb_current_relative_url());
|
$pageTranslation = $this->resolvePageLanguageVariantFromUrl(phpb_current_relative_url());
|
||||||
@@ -465,6 +465,9 @@ class Plugi
|
|||||||
}
|
}
|
||||||
// render page if resolved
|
// render page if resolved
|
||||||
if ($page) {
|
if ($page) {
|
||||||
|
if ($page->get('type') === 'redirect') {
|
||||||
|
phpb_redirect($pageTranslation->target);
|
||||||
|
}
|
||||||
// TODO add menu etc
|
// TODO add menu etc
|
||||||
$renderedContent = $this->pageBuilder->renderPage($page, $pageTranslation->locale);
|
$renderedContent = $this->pageBuilder->renderPage($page, $pageTranslation->locale);
|
||||||
if (!str_contains($pageTranslation->route, '/*')) {
|
if (!str_contains($pageTranslation->route, '/*')) {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class PageRepository extends BaseRepository implements PageRepositoryContract
|
|||||||
$page = parent::create([
|
$page = parent::create([
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'layout' => $data['layout'],
|
'layout' => $data['layout'],
|
||||||
|
'type' => $data['type'],
|
||||||
]);
|
]);
|
||||||
if (! ($page instanceof PageContract)) {
|
if (! ($page instanceof PageContract)) {
|
||||||
throw new Exception("Page not of type PageContract");
|
throw new Exception("Page not of type PageContract");
|
||||||
@@ -77,6 +78,7 @@ class PageRepository extends BaseRepository implements PageRepositoryContract
|
|||||||
$updateResult = parent::update($page, [
|
$updateResult = parent::update($page, [
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'layout' => $data['layout'],
|
'layout' => $data['layout'],
|
||||||
|
'type' => $data['type'],
|
||||||
]);
|
]);
|
||||||
$page->invalidateCache();
|
$page->invalidateCache();
|
||||||
return $updateResult;
|
return $updateResult;
|
||||||
@@ -92,7 +94,7 @@ class PageRepository extends BaseRepository implements PageRepositoryContract
|
|||||||
protected function replaceTranslations(PageContract $page, array $data)
|
protected function replaceTranslations(PageContract $page, array $data)
|
||||||
{
|
{
|
||||||
$activeLanguages = phpb_active_languages();
|
$activeLanguages = phpb_active_languages();
|
||||||
foreach (['title', 'meta_title', 'meta_description', 'route'] as $field) {
|
foreach (['title', 'meta_title', 'meta_description', 'route', 'target'] as $field) {
|
||||||
foreach ($activeLanguages as $languageCode => $languageTranslation) {
|
foreach ($activeLanguages as $languageCode => $languageTranslation) {
|
||||||
if (! isset($data[$field][$languageCode])) {
|
if (! isset($data[$field][$languageCode])) {
|
||||||
return false;
|
return false;
|
||||||
@@ -110,6 +112,7 @@ class PageRepository extends BaseRepository implements PageRepositoryContract
|
|||||||
'meta_title' => $data['meta_title'][$languageCode],
|
'meta_title' => $data['meta_title'][$languageCode],
|
||||||
'meta_description' => $data['meta_description'][$languageCode],
|
'meta_description' => $data['meta_description'][$languageCode],
|
||||||
'route' => $data['route'][$languageCode],
|
'route' => $data['route'][$languageCode],
|
||||||
|
'target' => $data['target'][$languageCode],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Plugi\Extensions;
|
||||||
use Plugi\Repositories\MenuRepository;
|
use Plugi\Repositories\MenuRepository;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -17,9 +18,12 @@ use Plugi\Repositories\MenuRepository;
|
|||||||
<link href="<?= phpb_asset('icons/bold/style.css') ?>" rel="stylesheet">
|
<link href="<?= phpb_asset('icons/bold/style.css') ?>" rel="stylesheet">
|
||||||
|
|
||||||
<link href="<?= phpb_theme_asset('dist/style.css') ?>" rel="stylesheet">
|
<link href="<?= phpb_theme_asset('dist/style.css') ?>" rel="stylesheet">
|
||||||
|
<?= Extensions::getHtmlBlocks() ?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<?= Extensions::getHtmlBlocks('body-start') ?>
|
||||||
|
|
||||||
<div class="navbar bg-base-100">
|
<div class="navbar bg-base-100">
|
||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
@@ -122,5 +126,7 @@ use Plugi\Repositories\MenuRepository;
|
|||||||
scriptTag.dispatchEvent(new Event('run-script'));
|
scriptTag.dispatchEvent(new Event('run-script'));
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<?= Extensions::getHtmlBlocks('body-end') ?>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user