Skip to content
Code-Schnipsel Gruppen Projekte
Commit 67eedf58 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'next' into 'master'

feat!: quiqqer v2

See merge request !25
Übergeordnete 8c378527 e0e0bf33
No related branches found
No related tags found
2 Merge Requests!34Update 'next-4.x' with latest changes from 'main',!25feat!: quiqqer v2
Pipeline #7411 bestanden mit Phase
in 1 Minute und 2 Sekunden
werden angezeigt mit 140 Ergänzungen und 97 Löschungen
......@@ -2,6 +2,7 @@
namespace QUI\Menu\Independent;
use Exception;
use QUI;
use QUI\Menu\Independent\Items\AbstractMenuItem;
......@@ -33,7 +34,7 @@ class Menu
* @throws QUI\Exception
* @throws QUI\Database\Exception
*/
public function __construct($menuId)
public function __construct(int|array $menuId)
{
if (is_numeric($menuId)) {
$data = Handler::getMenuData($menuId);
......@@ -92,7 +93,7 @@ public function __construct($menuId)
* @param array $children
* @return void
*/
protected function buildChildren($Parent, array $children)
protected function buildChildren(AbstractMenuItem|Menu $Parent, array $children): void
{
foreach ($children as $item) {
$type = $item['type'];
......@@ -124,7 +125,7 @@ protected function buildChildren($Parent, array $children)
*
* @param AbstractMenuItem $Item
*/
public function appendChild(AbstractMenuItem $Item)
public function appendChild(AbstractMenuItem $Item): void
{
$this->children[] = $Item;
}
......@@ -244,7 +245,7 @@ public function getData(): array
* @throws QUI\Database\Exception
* @throws QUI\Permissions\Exception
*/
public function save(?QUI\Interfaces\Users\User $PermissionUser = null)
public function save(?QUI\Interfaces\Users\User $PermissionUser = null): void
{
QUI\Permissions\Permission::checkPermission('quiqqer.menu.edit', $PermissionUser);
......@@ -258,7 +259,7 @@ public function save(?QUI\Interfaces\Users\User $PermissionUser = null)
try {
QUI::getEvents()->fireEvent('quiqqerMenuIndependentSave', [$this]);
} catch (\Exception $Exception) {
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
}
}
......@@ -269,7 +270,7 @@ public function save(?QUI\Interfaces\Users\User $PermissionUser = null)
* @param array|null $title - ['de' => '', 'en' => '']
* @return void
*/
public function setTitle(?array $title)
public function setTitle(?array $title): void
{
if ($title === null) {
return;
......@@ -294,7 +295,7 @@ public function setTitle(?array $title)
* @param array|null $title - ['de' => '', 'en' => '']
* @return void
*/
public function setWorkingTitle(?array $title)
public function setWorkingTitle(?array $title): void
{
if ($title === null) {
return;
......@@ -317,7 +318,7 @@ public function setWorkingTitle(?array $title)
* @param array|null $data
* @return void
*/
public function setData(?array $data)
public function setData(?array $data): void
{
if ($data === null) {
return;
......
......@@ -14,7 +14,9 @@ class Smarty
/**
* Menu function for smarty
*
* @return void
* @param $params
* @param $smarty
* @return string
*/
public static function menu($params, $smarty): string
{
......@@ -25,7 +27,7 @@ public static function menu($params, $smarty): string
try {
$Project = QUI::getRewrite()->getProject();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
return '';
}
......@@ -34,7 +36,7 @@ public static function menu($params, $smarty): string
try {
return QUI\Cache\Manager::get($cacheName);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
try {
......
......@@ -3,6 +3,8 @@
namespace QUI\Menu\Mega;
use QUI;
use QUI\Exception;
use QUI\Interfaces\Projects\Site;
/**
* Class AbstractMenu
......@@ -15,14 +17,15 @@ abstract class AbstractChild extends QUI\Control
/**
* @var null|array
*/
protected $children = null;
protected ?array $children = null;
/**
* Return the current site
*
* @return mixed|QUI\Projects\Site
* @return Site
* @throws Exception
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......@@ -32,9 +35,10 @@ protected function getSite()
}
/**
* @return array
* @return array|null
* @throws Exception
*/
public function getChildren()
public function getChildren(): ?array
{
if (is_null($this->children)) {
$this->children = $this->getSite()->getNavigation();
......@@ -47,8 +51,9 @@ public function getChildren()
* Returns the number of children
*
* @return int
* @throws Exception
*/
public function count()
public function count(): int
{
return count($this->getChildren());
}
......
......@@ -16,9 +16,9 @@
class Icons extends AbstractChild
{
/**
* @var null
* @var array|null
*/
protected $children = null;
protected ?array $children = null;
/**
* Standard constructor.
......@@ -39,7 +39,7 @@ public function __construct(array $params = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
......
......@@ -17,9 +17,9 @@
class IconsDescription extends AbstractChild
{
/**
* @var null
* @var array|null
*/
protected $children = null;
protected ?array $children = null;
/**
* Standard constructor.
......@@ -40,7 +40,7 @@ public function __construct(array $params = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
......
......@@ -16,9 +16,9 @@
class Image extends AbstractChild
{
/**
* @var null
* @var array|null
*/
protected $children = null;
protected ?array $children = null;
/**
* Standard constructor.
......@@ -39,7 +39,7 @@ public function __construct(array $params = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
......
......@@ -16,9 +16,9 @@
class Simple extends AbstractChild
{
/**
* @var null
* @var array|null
*/
protected $children = null;
protected ?array $children = null;
/**
* Standard constructor.
......@@ -44,7 +44,7 @@ public function __construct(array $params = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
......
......@@ -16,9 +16,9 @@
class Standard extends AbstractChild
{
/**
* @var null
* @var array|null
*/
protected $children = null;
protected ?array $children = null;
/**
* Standard constructor.
......@@ -39,7 +39,7 @@ public function __construct(array $params = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
......
......@@ -6,8 +6,16 @@
namespace QUI\Menu;
use Exception;
use QUI;
use function array_filter;
use function array_merge;
use function array_unique;
use function is_object;
use function md5;
use function serialize;
/**
* Class MegaMenu
*
......@@ -16,19 +24,21 @@
class MegaMenu extends AbstractMenu
{
/**
* @var SlideOut
* @var SlideOut|SlideOutAdvanced|null
*/
protected $Mobile = null;
protected SlideOutAdvanced|null|SlideOut $Mobile = null;
/**
* @var array
*/
protected $subMenus = [];
protected array $subMenus = [];
/**
* @param array $attributes
* @throws QUI\Exception
* @throws Exception
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
$this->setAttributes([
'showStart' => false,
......@@ -86,19 +96,20 @@ public function __construct($attributes = [])
/**
* @return string
* @throws QUI\Exception
* @throws Exception
*/
public function getBody()
public function getBody(): string
{
$cache = EventHandler::menuCacheName() . '/megaMenu/';
$attributes = $this->getAttributes();
$attributes = \array_filter($attributes, function ($entry) {
return \is_object($entry) === false;
$attributes = array_filter($attributes, function ($entry) {
return is_object($entry) === false;
});
$cache .= \md5(
$cache .= md5(
$this->getSite()->getCachePath() .
\serialize($attributes)
serialize($attributes)
);
$childControl = $this->getMenuControl($this->getAttribute('display'));
......@@ -125,7 +136,7 @@ public function getBody()
foreach ($cacheResult['subMenus'] as $childControl) {
$Instance = new $childControl();
$cssFiles = \array_merge($cssFiles, $Instance->getCSSFiles());
$cssFiles = array_merge($cssFiles, $Instance->getCSSFiles());
}
foreach ($cssFiles as $cssFile) {
......@@ -133,7 +144,7 @@ public function getBody()
}
return $cacheResult['html'];
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
$Engine = QUI::getTemplateManager()->getEngine();
......@@ -207,7 +218,7 @@ public function getBody()
$result['html'] = $Engine->fetch(dirname(__FILE__) . '/MegaMenu.html');
}
$result['subMenus'] = \array_unique($this->subMenus);
$result['subMenus'] = array_unique($this->subMenus);
QUI\Cache\Manager::set($cache, $result);
......@@ -215,9 +226,11 @@ public function getBody()
}
/**
* @return QUI\Projects\Site
* @return QUI\Interfaces\Projects\Site
* @throws QUI\Exception
* @throws Exception
*/
public function getStart()
public function getStart(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Start')) {
return $this->getAttribute('Start');
......@@ -230,9 +243,9 @@ public function getStart()
* Return the menu control class name for a menu control shortcut
*
* @param $control
* @return mixed
* @return false|string
*/
public function getMenuControl($control)
public function getMenuControl($control): bool|string
{
switch ($control) {
case 'Image':
......@@ -292,7 +305,7 @@ public function getMenuControl($control)
/**
* @param $subMenu
*/
public function addSubMenu($subMenu)
public function addSubMenu($subMenu): void
{
$this->subMenus[] = $subMenu;
}
......@@ -300,9 +313,10 @@ public function addSubMenu($subMenu)
/**
* Return the current site
*
* @return mixed|QUI\Projects\Site
* @return QUI\Interfaces\Projects\Site
* @throws QUI\Exception
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......@@ -317,8 +331,9 @@ protected function getSite()
* @param $slideOutParam
* @return SlideOutAdvanced|SlideOut
* @throws QUI\Exception
* @throws Exception
*/
protected function getMobileMenu($slideOutParam)
protected function getMobileMenu($slideOutParam): SlideOut|SlideOutAdvanced
{
if ($this->getProject()->getConfig('mobileMenu.settings.type') == 'slideoutAdvanced') {
$Menu = new QUI\Menu\SlideOutAdvanced($slideOutParam);
......
......@@ -7,6 +7,9 @@
namespace QUI\Menu;
use QUI;
use QUI\Projects\Site\Utils;
use function count;
/**
* Class NavTabs
......@@ -25,12 +28,12 @@ class NavTabs extends QUI\Control
*
* @var array
*/
private $entries = [];
private array $entries = [];
/**
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
$this->setAttributes([
'nodeName' => 'div',
......@@ -53,7 +56,7 @@ public function __construct($attributes = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$this->setJavaScriptControlOption('animation', 'slide');
......@@ -83,13 +86,13 @@ public function getBody()
* @return array|string
* @throws QUI\Exception
*/
private function getChildrenFromParent()
private function getChildrenFromParent(): array|string
{
$ParentSite = null;
if ($this->getAttribute('parentSite')) {
try {
$ParentSite = \QUI\Projects\Site\Utils::getSiteByLink($this->getAttribute('parentSite'));
$ParentSite = Utils::getSiteByLink($this->getAttribute('parentSite'));
} catch (QUI\Exception $Exception) {
QUI\System\Log::addDebug($Exception->getMessage());
......@@ -143,7 +146,7 @@ private function getChildrenFromParent()
*/
public function setData(array $data)
{
if (\count($data) < 1) {
if (count($data) < 1) {
return false;
}
......@@ -151,7 +154,7 @@ public function setData(array $data)
/** @var QUI\Projects\Site $Site */
foreach ($data as $dataSet) {
if (\count($dataSet) < 2) {
if (count($dataSet) < 2) {
continue;
}
......
......@@ -21,7 +21,7 @@ class NavTabsVertical extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
......@@ -46,7 +46,7 @@ public function __construct($attributes = [])
*
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$entries = $this->getAttribute('entries');
......@@ -61,7 +61,7 @@ public function getBody()
continue;
}
array_push($enabledEntries, $entry);
$enabledEntries[] = $entry;
}
$Engine->assign([
......
......@@ -20,7 +20,7 @@ class OnePageNav extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
......@@ -42,7 +42,7 @@ public function __construct($attributes = [])
*
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$entries = $this->getAttribute('entries');
......
......@@ -29,7 +29,7 @@ class Provider implements ProviderInterface
*
* @param Server $Server
*/
public function register(Server $Server)
public function register(Server $Server): void
{
$Slim = $Server->getSlim();
......@@ -158,12 +158,9 @@ public function create(RequestInterface $Request, ResponseInterface $Response):
return Handler::getGenericExceptionResponse($Exception);
}
return Handler::getGenericSuccessResponse(
'Menu created.',
[
'id' => $newMenuId
]
);
return Handler::getGenericSuccessResponse('Menu created.', [
'id' => $newMenuId
]);
}
/**
......@@ -318,11 +315,11 @@ public function delete(RequestInterface $Request, ResponseInterface $Response):
}
/**
* Get file containting OpenApi definition for this API.
* Get file containing OpenApi definition for this API.
*
* @return string|false - Absolute file path or false if no definition exists
*/
public function getOpenApiDefinitionFile()
public function getOpenApiDefinitionFile(): bool|string
{
return false;
}
......
......@@ -6,6 +6,7 @@
namespace QUI\Menu;
use Exception;
use QUI;
use QUI\Projects\Site\Utils;
......@@ -21,7 +22,7 @@ class SidebarDropDownMenu extends QUI\Control
/**
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// defaults values
$this->setAttributes([
......@@ -48,9 +49,10 @@ public function __construct($attributes = [])
/**
* (non-PHPdoc)
*
* @throws Exception
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$Project = $this->getProject();
......@@ -164,12 +166,13 @@ public function getBody()
$this->addCSSFile($css);
$html = $Engine->fetch($template);
$html = '<nav>' . $html . '</nav>';
return $html;
return '<nav>' . $html . '</nav>';
}
public function getChildren(QUI\Projects\Site $Site)
/**
* @throws QUI\Exception
*/
public function getChildren(QUI\Projects\Site $Site): array|int
{
if (!$this->getAttribute('showAllChildren')) {
return $Site->getNavigation();
......
......@@ -20,7 +20,7 @@ class SlideOut extends QUI\Control
/**
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
$this->setAttributes([
'showHomeLink' => true,
......@@ -37,7 +37,7 @@ public function __construct($attributes = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
......@@ -77,9 +77,9 @@ public function getBody()
/**
* Return the current site
*
* @return mixed|QUI\Projects\Site
* @return QUI\Interfaces\Projects\Site
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......
......@@ -8,9 +8,11 @@
use QUI;
use function dirname;
/**
* Class MenuAdvanced
* Creates an slideout menu
* Creates a slide-out menu
*
* @package QUI\Menu
*/
......@@ -19,7 +21,7 @@ class SlideOutAdvanced extends QUI\Control
/**
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
$this->setAttributes([
'menuId' => false, // if set independent menu template will be used
......@@ -31,7 +33,7 @@ public function __construct($attributes = [])
parent::__construct($attributes);
$this->addCSSFile(
\dirname(__FILE__) . '/SlideOutAdvanced.css'
dirname(__FILE__) . '/SlideOutAdvanced.css'
);
}
......@@ -39,7 +41,7 @@ public function __construct($attributes = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
......@@ -73,9 +75,9 @@ public function getBody()
/**
* Return the current site
*
* @return mixed|QUI\Projects\Site
* @return QUI\Interfaces\Projects\Site
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......
......@@ -7,6 +7,7 @@
namespace QUI\Menu;
use QUI;
use QUI\Exception;
use QUI\Projects\Site\Utils;
/**
......@@ -29,7 +30,7 @@ class UrlList extends QUI\Control
/**
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// defaults values
$this->setAttributes([
......@@ -50,9 +51,10 @@ public function __construct($attributes = [])
/**
* (non-PHPdoc)
*
* @throws Exception
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
if ($this->getAttribute('menuId')) {
// independent menu
......@@ -70,7 +72,7 @@ public function getBody()
$icon = '';
$restLinkColorCss = '';
if ($this->getAttribute('icon') && strpos($this->getAttribute('icon'), 'fa ') === 0) {
if ($this->getAttribute('icon') && str_starts_with($this->getAttribute('icon'), 'fa ')) {
$icon = $this->getAttribute('icon');
}
......@@ -104,7 +106,7 @@ public function getBody()
* @return array
* @throws QUI\Exception
*/
public function getChildrenForIndependentMenu()
public function getChildrenForIndependentMenu(): array
{
$IndependentMenu = Independent\Handler::getMenu($this->getAttribute('menuId'));
......@@ -114,10 +116,10 @@ public function getChildrenForIndependentMenu()
/**
* Get sites for QUI site
*
* @return array
* @throws QUI\Exception
* @return array|int
* @throws Exception
*/
public function getChildrenForQUISite()
public function getChildrenForQUISite(): array|int
{
$Project = $this->getProject();
......@@ -144,7 +146,7 @@ public function getChildrenForQUISite()
* @return array|int
* @throws QUI\Exception
*/
public function getChildren(QUI\Projects\Site $Site)
public function getChildren(QUI\Projects\Site $Site): array|int
{
if (!$this->getAttribute('showAllChildren')) {
return $Site->getNavigation();
......
<?php
if (!defined('QUIQQER_SYSTEM')) {
define('QUIQQER_SYSTEM', true);
}
if (!defined('QUIQQER_AJAX')) {
define('QUIQQER_AJAX', true);
}
putenv("QUIQQER_OTHER_AUTOLOADERS=KEEP");
require_once __DIR__ . '/../../../../bootstrap.php';
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren