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

Merge branch 'next-2.x' into 'main'

feat!: quiqqer core v2 compatibility

See merge request !17
Übergeordnete 47f50f9f 4799ff65
No related branches found
No related tags found
1 Merge Request!17feat!: quiqqer core v2 compatibility
Pipeline #8778 bestanden mit Phase
in 49 Sekunden
werden angezeigt mit 142 Ergänzungen und 94 Löschungen
tools/
phpstan.neon
.phpunit.result.cache
phpunit.xml
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.10.67" installed="1.10.67" location="./tools/phpstan" copy="false"/>
</phive>
{
"name": "quiqqer\/portfolio",
"name": "quiqqer/portfolio",
"type": "quiqqer-module",
"description": "Manage your references \/ customer projects and present them on your website.",
"description": "Manage your references / customer projects and present them on your website.",
"license": [
"PCSG QL-1.0",
"GPL-3.0+"
......@@ -10,23 +10,23 @@
{
"name": "Henning Leutz",
"email": "support@pcsg.de",
"homepage": "http:\/\/www.pcsg.de",
"homepage": "https://www.pcsg.de",
"role": "Developer"
}
],
"support": {
"email": "support@pcsg.de",
"url": "http:\/\/www.pcsg.de"
"url": "https://www.pcsg.de"
},
"require": {
"php": ">=5.3",
"quiqqer\/quiqqer": "*@dev",
"quiqqer\/gallery": "*@dev",
"quiqqer\/bricks": "*@dev"
"php": "^8.1",
"quiqqer/core": "^2",
"quiqqer/gallery": "^2",
"quiqqer/bricks": "^2"
},
"autoload": {
"psr-4": {
"QUI\\Portfolio\\": "src\/QUI\/Portfolio"
"QUI\\Portfolio\\": "src/QUI/Portfolio"
}
}
}
\ No newline at end of file
includes:
- phpstan-baseline.neon
parameters:
level: 1
paths:
- src
- ajax
bootstrapFiles:
- tests/phpstan-bootstrap.php
customRulesetUsed: true
services:
-
class: \PHPStan\Rules\Properties\TypesAssignedToPropertiesRule
tags:
- phpstan.rules.rule
......@@ -6,6 +6,7 @@
namespace QUI\Portfolio\Bricks;
use Exception;
use QUI;
/**
......@@ -16,8 +17,9 @@ class PortfolioList extends QUI\Control
{
/**
* @return string
* @throws Exception
*/
public function getBody()
public function getBody(): string
{
$Portfolio = new QUI\Portfolio\Controls\Portfolio([
'showRandomButton' => $this->getAttribute('showRandomButton'),
......
......@@ -7,6 +7,7 @@
namespace QUI\Portfolio\Controls;
use QUI;
use QUI\Exception;
use QUI\Projects\Site\Utils;
/**
......@@ -19,7 +20,7 @@ class Portfolio extends QUI\Control
* constructor
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
......@@ -73,7 +74,7 @@ public function __construct($attributes = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$Site = $this->getSite();
......@@ -158,16 +159,10 @@ public function getBody()
break;
}
switch ($this->getAttribute('img-position')) {
case 'cover':
$imgPosition = 'object-fit: cover; -o-object-fit: cover;';
break;
case 'contain':
default:
$imgPosition = 'object-fit: contain; -o-object-fit: contain;';
break;
}
$imgPosition = match ($this->getAttribute('img-position')) {
'cover' => 'object-fit: cover; -o-object-fit: cover;',
default => 'object-fit: contain; -o-object-fit: contain;',
};
if ($this->getAttribute('data-qui-options-start-reference')) {
$displayNum = (int)$this->getAttribute('data-qui-options-start-reference');
......@@ -193,9 +188,11 @@ public function getBody()
/**
* Return current site
* @return QUI\Projects\Site
*
* @return QUI\Interfaces\Projects\Site
* @throws Exception
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......
......@@ -7,6 +7,7 @@
namespace QUI\Portfolio\Controls;
use QUI;
use QUI\Exception;
use QUI\Projects\Site\Utils;
/**
......@@ -19,7 +20,7 @@ class Portfolio2022 extends QUI\Control
* constructor
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
......@@ -59,7 +60,7 @@ public function __construct($attributes = [])
* @return string
* @throws QUI\Exception
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$Site = $this->getSite();
......@@ -303,23 +304,10 @@ public function getBody()
dirname(__FILE__) . $css
);
switch ($this->getAttribute('aspectRatio')) {
case '4/3':
case '3/2':
case '5/4':
case '16/9':
$imageFormat = 'landscape';
break;
case '1/1':
case '3/4':
case '2/3':
case '4/5':
case '9/16':
default:
$imageFormat = 'portrait';
break;
}
$imageFormat = match ($this->getAttribute('aspectRatio')) {
'4/3', '3/2', '5/4', '16/9' => 'landscape',
default => 'portrait',
};
$this->setStyles([
'--quiqqer-portfolio2022-transition-duration' => '300ms',
......@@ -364,9 +352,10 @@ public function getBody()
/**
* Return current site
* @return QUI\Projects\Site
* @return QUI\Interfaces\Projects\Site
* @throws Exception
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......@@ -381,7 +370,7 @@ protected function getSite()
* @param $categoriesArray - data from ajax
* @return array
*/
protected function getUniqueGroups($categoriesArray)
protected function getUniqueGroups($categoriesArray): array
{
// get array with unique groups
$uniqueGroups = [];
......@@ -398,12 +387,12 @@ protected function getUniqueGroups($categoriesArray)
!in_array($Categories['group'], $uniqueGroups)
&& $Categories['group'] !== ''
) {
array_push($uniqueGroups, $Categories['group']);
$uniqueGroups[] = $Categories['group'];
}
}
if (!empty($uniqueGroups) && $ungrouped !== '') {
array_push($uniqueGroups, $ungrouped);
$uniqueGroups[] = $ungrouped;
}
return $uniqueGroups;
......@@ -416,7 +405,7 @@ protected function getUniqueGroups($categoriesArray)
* @param $uniqueGroups - unique groups
* @return array
*/
protected function sortCategories($categoriesArray, $uniqueGroups)
protected function sortCategories($categoriesArray, $uniqueGroups): array
{
$categoriesGroups = [];
......@@ -424,8 +413,8 @@ protected function sortCategories($categoriesArray, $uniqueGroups)
$groups = [];
foreach ($categoriesArray as $Categories) {
if (strpos($Categories['group'], $UniqueGroups) !== false) {
array_push($groups, $Categories);
if (str_contains($Categories['group'], $UniqueGroups)) {
$groups[] = $Categories;
}
}
......@@ -442,7 +431,7 @@ protected function sortCategories($categoriesArray, $uniqueGroups)
* @param $categoriesGroups - all categories
* @return mixed - array with categories from active group
*/
protected function getCategories($activeGroup, $categoriesGroups)
protected function getCategories($activeGroup, $categoriesGroups): mixed
{
if (!$activeGroup || !isset($categoriesGroups[$activeGroup])) {
$keys = array_keys($categoriesGroups);
......@@ -459,7 +448,7 @@ protected function getCategories($activeGroup, $categoriesGroups)
* @param $uniqueGroups - Unique groups
* @return string - Active group name
*/
protected function getActiveGroup($uniqueGroups)
protected function getActiveGroup($uniqueGroups): string
{
if (empty($uniqueGroups)) {
return '';
......
......@@ -7,6 +7,7 @@
namespace QUI\Portfolio\Controls;
use QUI;
use QUI\Exception;
/**
* Class Reference - A portfolio entry
......@@ -19,7 +20,7 @@ class Reference extends QUI\Control
* constructor
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
......@@ -37,16 +38,11 @@ public function __construct($attributes = [])
/**
* @return string
* @throws Exception
*/
public function getBody()
public function getBody(): string
{
try {
$Engine = QUI::getTemplateManager()->getEngine();
} catch (QUI\Exception $Exception) {
QUI\System\Log::addDebug($Exception->getMessage());
return '';
}
$Engine = QUI::getTemplateManager()->getEngine();
$Site = $this->getSite();
$List = $this->getList();
......@@ -62,12 +58,12 @@ public function getBody()
try {
$Next = $Site->nextSibling();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
try {
$Prev = $Site->previousSibling();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
$showArrows = false;
......@@ -88,8 +84,8 @@ public function getBody()
foreach ($images as $Image) {
/* @var $Image QUI\Projects\Media\Image */
$Slider->addSlide($Image->getUrl());
$Slider->addMobileSlide($Image->getUrl());
$Slider->addSlide($Image->getUrl(), '', '');
$Slider->addMobileSlide($Image->getUrl(), '', '');
}
// website
......@@ -98,7 +94,7 @@ public function getBody()
if ($Site->getAttribute('quiqqer.portfolio.settings.website')) {
$website = $Site->getAttribute('quiqqer.portfolio.settings.website');
if (strpos($website, 'http://') === false && strpos($website, 'https://') === false) {
if (!str_contains($website, 'http://') && !str_contains($website, 'https://')) {
$website = 'http://' . $website;
}
}
......@@ -122,8 +118,9 @@ public function getBody()
* Return the images
*
* @return array
* @throws Exception
*/
public function getImages()
public function getImages(): array
{
$images = [];
$imageFolder = $this->getSite()->getAttribute(
......@@ -133,7 +130,7 @@ public function getImages()
try {
$siteImage = $this->getSite()->getAttribute('image_site');
$images[] = QUI\Projects\Media\Utils::getImageByUrl($siteImage);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
......@@ -156,9 +153,10 @@ public function getImages()
/**
* Return current site
* @return QUI\Projects\Site
* @return QUI\Interfaces\Projects\Site
* @throws Exception
*/
protected function getSite()
protected function getSite(): QUI\Interfaces\Projects\Site
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......@@ -171,8 +169,9 @@ protected function getSite()
* Return the portfolio list
*
* @return QUI\Projects\Site
* @throws Exception
*/
public function getList()
public function getList(): QUI\Interfaces\Projects\Site
{
$Site = $this->getSite();
......
......@@ -20,7 +20,7 @@ class Reference2022 extends QUI\Control
* constructor
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
......@@ -40,15 +40,9 @@ public function __construct($attributes = [])
/**
* @return string
*/
public function getBody()
public function getBody(): string
{
try {
$Engine = QUI::getTemplateManager()->getEngine();
} catch (QUI\Exception $Exception) {
QUI\System\Log::addDebug($Exception->getMessage());
return '';
}
$Engine = QUI::getTemplateManager()->getEngine();
$Site = $this->getSite();
$List = $this->getList();
......@@ -64,17 +58,17 @@ public function getBody()
try {
$Next = $Site->nextSibling();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
try {
$Prev = $Site->previousSibling();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
try {
$Parent = $Site->getParent();
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
$showArrows = false;
......@@ -129,7 +123,7 @@ class_exists('QUI\Gallery\Bricks\GridAdvanced') &&
if ($Site->getAttribute('quiqqer.portfolio.settings.website')) {
$website = $Site->getAttribute('quiqqer.portfolio.settings.website');
if (strpos($website, 'http://') === false && strpos($website, 'https://') === false) {
if (!str_contains($website, 'http://') && !str_contains($website, 'https://')) {
$website = 'http://' . $website;
}
}
......@@ -162,7 +156,7 @@ class_exists('QUI\Gallery\Bricks\GridAdvanced') &&
*
* @return array
*/
public function getImages()
public function getImages(): array
{
$images = [];
$imageFolder = $this->getSite()->getAttribute(
......@@ -172,7 +166,7 @@ public function getImages()
try {
$siteImage = $this->getSite()->getAttribute('image_site');
$images[] = QUI\Projects\Media\Utils::getImageByUrl($siteImage);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
}
......@@ -195,9 +189,9 @@ public function getImages()
/**
* Return current site
* @return 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');
......@@ -211,7 +205,7 @@ protected function getSite()
*
* @return null|QUI\Projects\Site
*/
public function getList()
public function getList(): QUI\Interfaces\Projects\Site|null
{
$Site = $this->getSite();
......@@ -228,7 +222,7 @@ public function getList()
return null;
}
public function getImageDimension()
public function getImageDimension(): array
{
$List = $this->getList();
......
......@@ -7,6 +7,7 @@
namespace QUI\Portfolio;
use QUI;
use QUI\Projects\Site\Edit;
/**
* Class PortfolioList
......@@ -20,17 +21,17 @@ class PortfolioList
* event on child create
*
* @param integer $newId
* @param \QUI\Projects\Site\Edit $Parent
* @param QUI\Interfaces\Projects\Site $Parent
* @throws QUI\Exception
*/
public static function onChildCreate($newId, $Parent)
public static function onChildCreate(int $newId, QUI\Interfaces\Projects\Site $Parent): void
{
if ($Parent->getAttribute('type') !== 'quiqqer/portfolio:types/list') {
return;
}
$Project = $Parent->getProject();
$Site = new QUI\Projects\Site\Edit($Project, $newId);
$Site = new Edit($Project, $newId);
$Site->setAttribute('release_from', date('Y-m-d H:i:s'));
$Site->setAttribute('type', 'quiqqer/portfolio:types/entry');
......
<?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';
<?php
/**
* @var QUI\Projects\Project $Project
* @var QUI\Projects\Site $Site
* @var QUI\Interfaces\Template\EngineInterface $Engine
* @var QUI\Template $Template
**/
$Reference = new QUI\Portfolio\Controls\Reference([
'Site' => $Site,
'sliderpos' => 'bottom'
......
<?php
/**
* @var QUI\Projects\Project $Project
* @var QUI\Projects\Site $Site
* @var QUI\Interfaces\Template\EngineInterface $Engine
* @var QUI\Template $Template
**/
$Reference = new QUI\Portfolio\Controls\Reference2022([
'Site' => $Site
]);
......
<?php
/**
* @var QUI\Projects\Project $Project
* @var QUI\Projects\Site $Site
* @var QUI\Interfaces\Template\EngineInterface $Engine
* @var QUI\Template $Template
**/
$Portfolio = new QUI\Portfolio\Controls\Portfolio([
'showRandomButton' => $Site->getAttribute('quiqqer.portfolio.settings.showRandomButton'),
'entry-effect' => $Site->getAttribute('quiqqer.portfolio.settings.portfolioEffect'),
......
<?php
/**
* @var QUI\Projects\Project $Project
* @var QUI\Projects\Site $Site
* @var QUI\Interfaces\Template\EngineInterface $Engine
* @var QUI\Template $Template
**/
$Portfolio2022 = new QUI\Portfolio\Controls\Portfolio2022([
'template' => $Site->getAttribute('quiqqer.portfolio2022.settings.template'),
'openBehavior' => $Site->getAttribute('quiqqer.portfolio2022.settings.openBehavior'),
......
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