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

Merge branch 'dev' into 'next'

feat: quiqqer v2 compatibility

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