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

Merge branch 'feat-quiqqer-v2' into 'dev'

feat: quiqqer v2 compatibility

See merge request !8
Übergeordnete ca60e8fb e50b8789
No related branches found
No related tags found
3 Merge Requests!10feat: quiqqer v2 compatibility,!9feat: quiqqer v2 compatibility,!8feat: quiqqer v2 compatibility
Pipeline #7482 bestanden mit Phase
in 11 Sekunden
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\/slider", "name": "quiqqer/slider",
"type": "quiqqer-module", "type": "quiqqer-module",
"description": "The package provides several sliders for QUIQQER.", "description": "The package provides several sliders for QUIQQER.",
"license": "GPL-3.0+", "license": "GPL-3.0+",
"authors": [ "authors": [
{ {
"name": "Henning Leutz", "name": "Henning Leutz",
"email": "leutz@pcsg.de", "email": "leutz@pcsg.de",
"homepage": "http:\/\/www.pcsg.de", "homepage": "https://www.pcsg.de",
"role": "Developer" "role": "Developer"
}
],
"support": {
"email": "support@pcsg.de"
},
"require": {
"quiqqer\/quiqqer": "^1|dev-master|dev-dev",
"quiqqer\/gallery": "^1|dev-master|dev-dev"
},
"autoload": {
"psr-4": {
"QUI\\Slider\\": "src\/QUI\/Slider"
}
} }
],
"support": {
"email": "support@pcsg.de"
},
"require": {
"quiqqer/core": "^2",
"quiqqer/gallery": "^2"
},
"autoload": {
"psr-4": {
"QUI\\Slider\\": "src/QUI/Slider"
}
}
} }
includes:
- phpstan-baseline.neon
parameters:
level: 1
paths:
- src
bootstrapFiles:
- tests/phpstan-bootstrap.php
\ No newline at end of file
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
namespace QUI\Slider\Controls\Logo; namespace QUI\Slider\Controls\Logo;
use QUI; use QUI;
use QUI\Projects\Media\Folder;
use function array_slice;
use function count;
use function dirname;
/** /**
* Class Carousel * Class Carousel
...@@ -20,28 +25,28 @@ class Carousel extends QUI\Control ...@@ -20,28 +25,28 @@ class Carousel extends QUI\Control
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = []) public function __construct(array $attributes = [])
{ {
// default options // default options
$this->setAttributes([ $this->setAttributes([
'class' => 'quiqqer-slider-logoCarousel', 'class' => 'quiqqer-slider-logoCarousel',
'nodeName' => 'section', 'nodeName' => 'section',
'site' => '', 'site' => '',
'Project' => false, 'Project' => false,
'folderId' => false, 'folderId' => false,
'perView' => 3, 'perView' => 3,
'maxImgHeight' => 100, 'maxImgHeight' => 100,
'delay' => 3000, 'delay' => 3000,
'minSlideWidth' => 150, 'minSlideWidth' => 150,
'logoBackgroundColor' => false, 'logoBackgroundColor' => false,
'order' => false, 'order' => false,
'data-qui' => 'package/quiqqer/slider/bin/Logo/Carousel', 'data-qui' => 'package/quiqqer/slider/bin/Logo/Carousel',
'grayscale' => false, 'grayscale' => false,
'hoverpause' => false 'hoverpause' => false
]); ]);
$this->addCSSFile( $this->addCSSFile(
\dirname(__FILE__).'/Carousel.css' dirname(__FILE__) . '/Carousel.css'
); );
parent::__construct($attributes); parent::__construct($attributes);
...@@ -52,13 +57,13 @@ public function __construct($attributes = []) ...@@ -52,13 +57,13 @@ public function __construct($attributes = [])
* *
* @see \QUI\Control::create() * @see \QUI\Control::create()
*/ */
public function getBody() public function getBody(): string
{ {
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
$Project = $this->getProject(); $Project = $this->getProject();
$Media = $Project->getMedia(); $Media = $Project->getMedia();
$folderId = $this->getAttribute('folderId'); $folderId = $this->getAttribute('folderId');
$Folder = false; $Folder = false;
$maxImageHeight = '200px'; $maxImageHeight = '200px';
if ($this->getAttribute('maxImgHeight') != '') { if ($this->getAttribute('maxImgHeight') != '') {
...@@ -95,20 +100,18 @@ public function getBody() ...@@ -95,20 +100,18 @@ public function getBody()
$this->setJavaScriptControlOption('hoverpause', boolval($hoverpause)); $this->setJavaScriptControlOption('hoverpause', boolval($hoverpause));
$this->setJavaScriptControlOption('minslidewidth', intval($minSlideWidth)); $this->setJavaScriptControlOption('minslidewidth', intval($minSlideWidth));
/* @var $Folder \QUI\Projects\Media\Folder */ /* @var $Folder Folder */
if (\strpos($folderId, 'image.php') !== false) { if (str_contains($folderId, 'image.php')) {
try { try {
$Folder = QUI\Projects\Media\Utils::getMediaItemByUrl( $Folder = QUI\Projects\Media\Utils::getMediaItemByUrl(
$folderId $folderId
); );
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
$Folder = false;
} }
} elseif ($folderId) { } elseif ($folderId) {
try { try {
$Folder = $Media->get((int)$folderId); $Folder = $Media->get((int)$folderId);
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
$Folder = false;
} }
} }
...@@ -135,19 +138,19 @@ public function getBody() ...@@ -135,19 +138,19 @@ public function getBody()
'order' => $order 'order' => $order
]); ]);
if ($this->getAttribute('max') && \count($images) > $this->getAttribute('max')) { if ($this->getAttribute('max') && count($images) > $this->getAttribute('max')) {
$images = \array_slice($images, 0, $this->getAttribute('max')); $images = array_slice($images, 0, $this->getAttribute('max'));
} }
$this->setStyles([ $this->setStyles([
'--qui--logoCarousel-height' => $maxImageHeight."px" '--qui--logoCarousel-height' => $maxImageHeight . "px"
]); ]);
$Engine->assign([ $Engine->assign([
'this' => $this, 'this' => $this,
'images' => $images, 'images' => $images,
'maxImgHeight' => $maxImageHeight, 'maxImgHeight' => $maxImageHeight,
'grayscale' => $grayscale, 'grayscale' => $grayscale,
'logoBackgroundColor' => $this->getAttribute('logoBackgroundColor') 'logoBackgroundColor' => $this->getAttribute('logoBackgroundColor')
]); ]);
...@@ -159,8 +162,8 @@ public function getBody() ...@@ -159,8 +162,8 @@ public function getBody()
* *
* @return string * @return string
*/ */
protected function getTemplate() protected function getTemplate(): string
{ {
return \dirname(__FILE__).'/Carousel.html'; return dirname(__FILE__) . '/Carousel.html';
} }
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/** /**
* This file contains QUI\Slider\Controls\Slider * This file contains QUI\Slider\Controls\Slider
*/ */
namespace QUI\Slider\Controls; namespace QUI\Slider\Controls;
use QUI; use QUI;
...@@ -22,35 +23,35 @@ class Slider extends QUI\Control ...@@ -22,35 +23,35 @@ class Slider extends QUI\Control
* *
* @var array * @var array
*/ */
protected $data = array(); protected array $data = [];
/** /**
* internal image parsing flag * internal image parsing flag
* *
* @var bool * @var bool
*/ */
protected $imagesParsing = false; protected bool $imagesParsing = false;
/** /**
* @var array * @var array
*/ */
protected $settings = array(); protected array $settings = [];
/** /**
* constructor * constructor
* *
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = array()) public function __construct(array $attributes = [])
{ {
// default options // default options
$this->setAttributes(array( $this->setAttributes([
'title' => '', 'title' => '',
'text' => '', 'text' => '',
'class' => 'quiqqer-slider', 'class' => 'quiqqer-slider',
'nodeName' => 'section', 'nodeName' => 'section',
'qui-class' => 'package/quiqqer/slider/bin/Slider' 'qui-class' => 'package/quiqqer/slider/bin/Slider'
)); ]);
$this->addCSSFile( $this->addCSSFile(
dirname(__FILE__) . '/Slider.css' dirname(__FILE__) . '/Slider.css'
...@@ -60,14 +61,14 @@ public function __construct($attributes = array()) ...@@ -60,14 +61,14 @@ public function __construct($attributes = array())
OPT_DIR . 'quiqqer/gallery/lib/QUI/Gallery/Controls/Slider.css' OPT_DIR . 'quiqqer/gallery/lib/QUI/Gallery/Controls/Slider.css'
); );
$this->settings = array( $this->settings = [
'autostart', 'autostart',
'shadow', 'shadow',
'showControlsAlways', 'showControlsAlways',
'showTitleAlways', 'showTitleAlways',
'period', 'period',
'type' 'type'
); ];
parent::__construct($attributes); parent::__construct($attributes);
...@@ -80,7 +81,7 @@ public function __construct($attributes = array()) ...@@ -80,7 +81,7 @@ public function __construct($attributes = array())
* *
* @see \QUI\Control::create() * @see \QUI\Control::create()
*/ */
public function getBody() public function getBody(): string
{ {
$Engine = QUI::getTemplateManager()->getEngine(); $Engine = QUI::getTemplateManager()->getEngine();
...@@ -100,9 +101,9 @@ public function getBody() ...@@ -100,9 +101,9 @@ public function getBody()
$this->setAttribute('data-' . $setting, $this->getAttribute($setting)); $this->setAttribute('data-' . $setting, $this->getAttribute($setting));
} }
$Engine->assign(array( $Engine->assign([
'this' => $this 'this' => $this
)); ]);
return $Engine->fetch(dirname(__FILE__) . '/Slider.html'); return $Engine->fetch(dirname(__FILE__) . '/Slider.html');
...@@ -112,15 +113,15 @@ public function getBody() ...@@ -112,15 +113,15 @@ public function getBody()
* Add an image to the slider * Add an image to the slider
* *
* @param string $imagePath * @param string $imagePath
* @param string|bool $link * @param bool|string $link
* @param string|bool $text * @param bool|string $text
* @param string|bool $target * @param bool|string $target
*/ */
public function addImage($imagePath, $link = false, $text = false, $target = false) public function addImage(string $imagePath, bool|string $link = false, bool|string $text = false, bool|string $target = false): void
{ {
try { try {
$Image = Utils::getImageByUrl($imagePath); $Image = Utils::getImageByUrl($imagePath);
} catch (QUI\Exception $Exception) { } catch (QUI\Exception) {
return; return;
} }
...@@ -132,7 +133,6 @@ public function addImage($imagePath, $link = false, $text = false, $target = fal ...@@ -132,7 +133,6 @@ public function addImage($imagePath, $link = false, $text = false, $target = fal
if (SiteUtils::isSiteLink($link)) { if (SiteUtils::isSiteLink($link)) {
$link = SiteUtils::rewriteSiteLink($link); $link = SiteUtils::rewriteSiteLink($link);
} }
} catch (QUI\Exception $Exception) { } catch (QUI\Exception $Exception) {
QUI\System\Log::addDebug('##################'); QUI\System\Log::addDebug('##################');
QUI\System\Log::addDebug($link); QUI\System\Log::addDebug($link);
...@@ -143,12 +143,12 @@ public function addImage($imagePath, $link = false, $text = false, $target = fal ...@@ -143,12 +143,12 @@ public function addImage($imagePath, $link = false, $text = false, $target = fal
} }
} }
$this->data[] = array( $this->data[] = [
'link' => $link, 'link' => $link,
'text' => $text, 'text' => $text,
'image' => $Image, 'image' => $Image,
'target' => $target 'target' => $target
); ];
} }
/** /**
...@@ -156,7 +156,7 @@ public function addImage($imagePath, $link = false, $text = false, $target = fal ...@@ -156,7 +156,7 @@ public function addImage($imagePath, $link = false, $text = false, $target = fal
* *
* @return array * @return array
*/ */
public function getList() public function getList(): array
{ {
return $this->data; return $this->data;
} }
...@@ -166,9 +166,9 @@ public function getList() ...@@ -166,9 +166,9 @@ public function getList()
* *
* @return array * @return array
*/ */
public function getImages() public function getImages(): array
{ {
$images = array(); $images = [];
foreach ($this->data as $data) { foreach ($this->data as $data) {
$images[] = $data['image']; $images[] = $data['image'];
......
...@@ -3,9 +3,8 @@ ...@@ -3,9 +3,8 @@
/** /**
* This file contains QUI\Slider\Controls\SliderNivo * This file contains QUI\Slider\Controls\SliderNivo
*/ */
namespace QUI\Slider\Controls;
use QUI; namespace QUI\Slider\Controls;
/** /**
* Class SliderNivo * Class SliderNivo
...@@ -18,13 +17,13 @@ class SliderNivo extends Slider ...@@ -18,13 +17,13 @@ class SliderNivo extends Slider
/** /**
* @param array $attributes * @param array $attributes
*/ */
public function __construct($attributes = array()) public function __construct(array $attributes = [])
{ {
parent::__construct($attributes); parent::__construct($attributes);
$this->setAttribute('type', 'nivo'); $this->setAttribute('type', 'nivo');
$this->settings = array( $this->settings = [
'effect', 'effect',
'group', 'group',
'animspeed', 'animspeed',
...@@ -36,6 +35,6 @@ public function __construct($attributes = array()) ...@@ -36,6 +35,6 @@ public function __construct($attributes = array())
'type', 'type',
'controlsPosition', 'controlsPosition',
'slices' 'slices'
); ];
} }
} }
<?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