Skip to content
Commits auf Quelle (6)
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\/presentation-bricks",
"name": "quiqqer/presentation-bricks",
"type": "quiqqer-plugin",
"description": "This package contains bricks for the presentation of app or program on your website.",
"license": "GPL-3.0+",
......@@ -7,27 +7,27 @@
{
"name": "Michael Danielczok",
"email": "michael@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": {
"quiqqer\/quiqqer": "^1|dev-master|dev-dev",
"quiqqer\/fontawesome": "^5|^4|dev-master|dev-dev",
"quiqqer\/unsemantic": "^1|dev-master|dev-dev",
"quiqqer\/utils": "^1.7|dev-master|dev-dev",
"quiqqer\/buttons": "^1|dev-master|dev-dev"
"quiqqer/core": "^2",
"quiqqer/fontawesome": "^6",
"quiqqer/unsemantic": "^2",
"quiqqer/utils": "^2",
"quiqqer/buttons": "^2"
},
"suggest": {
"quiqqer\/template-presentation": "Business and marketing template for promoting your company or product online."
"quiqqer/template-presentation": "Business and marketing template for promoting your company or product online."
},
"autoload": {
"psr-4": {
"QUI\\PresentationBricks\\": "src\/QUI\/PresentationBricks"
"QUI\\PresentationBricks\\": "src/QUI/PresentationBricks"
}
}
}
\ No newline at end of file
includes:
- phpstan-baseline.neon
parameters:
level: 1
paths:
- src
bootstrapFiles:
- tests/phpstan-bootstrap.php
customRulesetUsed: true
services:
-
class: \PHPStan\Rules\Properties\TypesAssignedToPropertiesRule
tags:
- phpstan.rules.rule
......@@ -20,25 +20,25 @@ class BackgroundVideo extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
'video' => false,
'poster' => false,
'backgroundColor' => '#333',
'shortVideo' => false,
'autoplay' => true,
'muted' => true,
'loop' => true,
'playsinline' => true,
'playIfInView' => true,
'video' => false,
'poster' => false,
'backgroundColor' => '#333',
'shortVideo' => false,
'autoplay' => true,
'muted' => true,
'loop' => true,
'playsinline' => true,
'playIfInView' => true,
'backgroundVideoBrightness' => 50,
'fontColor' => '#fff',
'contentMaxWidth' => false,
'contentPosition' => 'center',
'openVideoInPopup' => 'clickOnDefaultButton',
'defaultButtonPosition' => ''
'fontColor' => '#fff',
'contentMaxWidth' => false,
'contentPosition' => 'center',
'openVideoInPopup' => 'clickOnDefaultButton',
'defaultButtonPosition' => ''
]);
parent::__construct($attributes);
......@@ -46,7 +46,7 @@ public function __construct($attributes = [])
$this->setJavaScriptControl('package/quiqqer/presentation-bricks/bin/Controls/BackgroundVideo');
$this->addCSSFile(
dirname(__FILE__).'/BackgroundVideo.css'
dirname(__FILE__) . '/BackgroundVideo.css'
);
}
......@@ -55,18 +55,18 @@ public function __construct($attributes = [])
*
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$backgroundColor = '#333';
$autoplay = false;
$muted = false;
$loop = false;
$playsinline = false;
$Engine = QUI::getTemplateManager()->getEngine();
$backgroundColor = '#333';
$autoplay = false;
$muted = false;
$loop = false;
$playsinline = false;
$backgroundVideoBrightness = 50;
$fontColor = '#fff';
$contentMaxWidth = false;
$defaultBtnPos = '';
$fontColor = '#fff';
$contentMaxWidth = false;
$defaultBtnPos = '';
if ($this->getAttribute('backgroundColor')) {
$backgroundColor = $this->getAttribute('backgroundColor');
......@@ -90,9 +90,11 @@ public function getBody()
$this->setJavaScriptControlOption('playifinview', $this->getAttribute('playIfInView'));
if (intval($this->getAttribute('backgroundVideoBrightness')) &&
if (
intval($this->getAttribute('backgroundVideoBrightness')) &&
intval($this->getAttribute('backgroundVideoBrightness')) > 0 &&
intval($this->getAttribute('backgroundVideoBrightness')) <= 100) {
intval($this->getAttribute('backgroundVideoBrightness')) <= 100
) {
$backgroundVideoBrightness = intval($this->getAttribute('backgroundVideoBrightness'));
}
......@@ -102,24 +104,18 @@ public function getBody()
$fontColor = $this->getAttribute('fontColor');
}
if (intval($this->getAttribute('contentMaxWidth')) &&
intval($this->getAttribute('contentMaxWidth')) > 0) {
if (
intval($this->getAttribute('contentMaxWidth')) &&
intval($this->getAttribute('contentMaxWidth')) > 0
) {
$contentMaxWidth = $this->getAttribute('contentMaxWidth');
}
switch ($this->getAttribute('contentPosition')) {
case 'top':
$contentPosition = 'start';
break;
case 'bottom':
$contentPosition = 'end';
break;
default:
$contentPosition = 'center';
break;
}
$contentPosition = match ($this->getAttribute('contentPosition')) {
'top' => 'start',
'bottom' => 'end',
default => 'center',
};
$initVideoInPopup = false;
......@@ -135,9 +131,9 @@ public function getBody()
$posterUrl = false;
try {
$Poster = QUI\Projects\Media\Utils::getImageByUrl($this->getAttribute('poster'));
$Poster = QUI\Projects\Media\Utils::getImageByUrl($this->getAttribute('poster'));
$posterUrl = $Poster->getUrl(true);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
// nothing
}
......@@ -149,7 +145,7 @@ public function getBody()
try {
$Video = QUI\Projects\Media\Utils::getMediaItemByUrl($this->getAttribute('video'));
$this->setJavaScriptControlOption('video', $Video->getUrl(true));
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
// nothing
}
}
......@@ -159,20 +155,20 @@ public function getBody()
}
$Engine->assign([
'this' => $this,
'posterUrl' => $posterUrl,
'backgroundColor' => $backgroundColor,
'autoplay' => $autoplay,
'muted' => $muted,
'loop' => $loop,
'playsinline' => $playsinline,
'this' => $this,
'posterUrl' => $posterUrl,
'backgroundColor' => $backgroundColor,
'autoplay' => $autoplay,
'muted' => $muted,
'loop' => $loop,
'playsinline' => $playsinline,
'backgroundVideoBrightness' => $backgroundVideoBrightness,
'fontColor' => $fontColor,
'contentMaxWidth' => $contentMaxWidth,
'contentPosition' => $contentPosition,
'defaultBtnPos' => $defaultBtnPos,
'fontColor' => $fontColor,
'contentMaxWidth' => $contentMaxWidth,
'contentPosition' => $contentPosition,
'defaultBtnPos' => $defaultBtnPos,
]);
return $Engine->fetch(dirname(__FILE__).'/BackgroundVideo.html');
return $Engine->fetch(dirname(__FILE__) . '/BackgroundVideo.html');
}
}
......@@ -20,15 +20,15 @@ class CountUpBasic extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = array())
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes(array(
'class' => 'qui-control-countUpBasic',
'entries' => array(),
'iconTop' => false,
$this->setAttributes([
'class' => 'qui-control-countUpBasic',
'entries' => [],
'iconTop' => false,
'template' => 'simple'
));
]);
parent::__construct($attributes);
}
......@@ -38,9 +38,9 @@ public function __construct($attributes = array())
*
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$Engine = QUI::getTemplateManager()->getEngine();
$entries = $this->getAttribute('entries');
if (is_string($entries)) {
......@@ -53,15 +53,15 @@ public function getBody()
case 'simple':
default:
$html = dirname(__FILE__) . '/CountUpBasic.Simple.html';
$css = dirname(__FILE__) . '/CountUpBasic.Simple.css';
$css = dirname(__FILE__) . '/CountUpBasic.Simple.css';
break;
}
$Engine->assign(array(
'this' => $this,
$Engine->assign([
'this' => $this,
'entries' => $entries,
'iconTop' => $this->getAttribute('iconTop')
));
'iconTop' => $this->getAttribute('iconTop')
]);
$this->addCSSFile($css);
......
......@@ -7,7 +7,6 @@
namespace QUI\PresentationBricks\Controls;
use QUI;
use QUI\Exception;
/**
* Class Author
......@@ -22,15 +21,15 @@ class Progressbar extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
'additionalText' => '',
'additionalText' => '',
'progressbarData' => [],
'textOnRight' => false,
'maxWidth' => '', //in pixels
'textPosition' => 'top'
'textOnRight' => false,
'maxWidth' => '', //in pixels
'textPosition' => 'top'
]);
$this->addCSSFile(dirname(__FILE__) . '/Progressbar.css');
......@@ -43,15 +42,16 @@ public function __construct($attributes = [])
*
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$Engine = QUI::getTemplateManager()->getEngine();
$entries = json_decode($this->getAttribute('entries'), true);
$additionalText = $this->getAttribute('additionalText');
$maxWidth = '1920px';
$textOnRight = 'quiqqer-progressbar__textLeft';
$additionalText = $this->getAttribute('additionalText');
$maxWidth = '1920px';
$textOnRight = 'quiqqer-progressbar__textLeft';
$progressbarData = [];
$textPosition = '';
if ($this->getAttribute('textPosition')) {
$textPosition = $this->getAttribute('textPosition');
......@@ -61,8 +61,10 @@ public function getBody()
$textOnRight = 'quiqqer-progressbar__textRight';
}
if ($this->getAttribute('maxWidth') > 0 &&
$this->getAttribute('maxWidth') <= 1920) {
if (
$this->getAttribute('maxWidth') > 0 &&
$this->getAttribute('maxWidth') <= 1920
) {
$maxWidth = $this->getAttribute('maxWidth') . 'px';
}
......@@ -71,16 +73,19 @@ public function getBody()
$entry['percent'] = 100;
}
\array_push($progressbarData, ['title' => $entry['title'], "percent" => $entry['percent']]);
$progressbarData[] = [
'title' => $entry['title'],
"percent" => $entry['percent']
];
}
$Engine->assign([
'this' => $this,
'additionalText' => $additionalText,
'this' => $this,
'additionalText' => $additionalText,
'progressbarData' => $progressbarData,
'textOnRight' => $textOnRight,
'maxWidth' => $maxWidth,
'textPosition' => $textPosition
'textOnRight' => $textOnRight,
'maxWidth' => $maxWidth,
'textPosition' => $textPosition
]);
return $Engine->fetch(dirname(__FILE__) . '/Progressbar.html');
......
......@@ -6,6 +6,7 @@
namespace QUI\PresentationBricks\Controls;
use Exception;
use QUI;
use QUI\Projects\Site\Utils;
......@@ -21,19 +22,19 @@ class StickyContent extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = array())
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes(array(
'class' => 'qui-control-brick',
'limit' => 5,
'order' => 'c_date DESC',
$this->setAttributes([
'class' => 'qui-control-brick',
'limit' => 5,
'order' => 'c_date DESC',
'parentInputList' => false,
'template' => 'default',
'quiClass' => 'package/quiqqer/presentation-bricks/bin/Controls/StickyContentDefault',
'imgagMockup' => ''
'template' => 'default',
'quiClass' => 'package/quiqqer/presentation-bricks/bin/Controls/StickyContentDefault',
'imgagMockup' => ''
));
]);
parent::__construct($attributes);
}
......@@ -41,14 +42,15 @@ public function __construct($attributes = array())
/**
* (non-PHPdoc)
*
* @throws Exception
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$start = 0;
$limit = $this->getAttribute('limit');
$start = 0;
$limit = $this->getAttribute('limit');
$Project = $this->getProject();
......@@ -56,11 +58,11 @@ public function getBody()
$limit = 5;
}
$children = Utils::getSitesByInputList($Project, $this->getAttribute('site'), array(
$children = Utils::getSitesByInputList($Project, $this->getAttribute('site'), [
'where' => $this->getAttribute('where'),
'limit' => $start . ',' . $limit,
'order' => $this->getAttribute('order')
));
]);
$template = $this->getAttribute('template');
......@@ -68,28 +70,28 @@ public function getBody()
switch ($template) {
case 'simple':
default:
$html = dirname(__FILE__) . '/StickyContent.Default.html';
$css = dirname(__FILE__) . '/StickyContent.Default.css';
$html = dirname(__FILE__) . '/StickyContent.Default.html';
$css = dirname(__FILE__) . '/StickyContent.Default.css';
$quiClass = 'package/quiqqer/presentation-bricks/bin/Controls/StickyContentDefault';
break;
case 'mockup':
$html = dirname(__FILE__) . '/StickyContent.MockUp.html';
$css = dirname(__FILE__) . '/StickyContent.MockUp.css';
$html = dirname(__FILE__) . '/StickyContent.MockUp.html';
$css = dirname(__FILE__) . '/StickyContent.MockUp.css';
$quiClass = 'package/quiqqer/presentation-bricks/bin/Controls/StickyContentMockUp';
break;
}
$mockup = $this->getAttribute('imgagMockup') . '.png';
$mockup = $this->getAttribute('imgagMockup') . '.png';
$mockupUrl = 'quiqqer/presentation-bricks/bin/img/';
$Engine->assign(array(
'this' => $this,
'Site' => $this->getSite(),
'Project' => $this->getProject(),
'children' => $children,
'inlineStyle' => 'opacity: 1;',
$Engine->assign([
'this' => $this,
'Site' => $this->getSite(),
'Project' => $this->getProject(),
'children' => $children,
'inlineStyle' => 'opacity: 1;',
'imageMockupUrl' => URL_OPT_DIR . $mockupUrl . $mockup
));
]);
$this->addCSSFile($css);
$this->setAttribute('qui-class', $quiClass);
......@@ -102,7 +104,7 @@ public function getBody()
*
* @throws QUI\Exception
*/
public function checkLimit()
public function checkLimit(): void
{
$Site = $this->getSite();
......@@ -121,9 +123,9 @@ public function checkLimit()
$sheet = (int)$_REQUEST['sheet'];
}
$count_children = $Site->getChildren(array(
$count_children = $Site->getChildren([
'count' => 'count'
));
]);
$sheets = ceil($count_children / $limit);
......@@ -134,8 +136,9 @@ public function checkLimit()
/**
* @return mixed|QUI\Projects\Site
* @throws QUI\Exception
*/
protected function getSite()
protected function getSite(): mixed
{
if ($this->getAttribute('Site')) {
return $this->getAttribute('Site');
......
......@@ -20,24 +20,24 @@ class Video extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
'class' => 'quiqqer-presentationBricks-video',
'video' => false,
'poster' => false,
'shortVideo' => false,
'autoplay' => true,
'muted' => true,
'loop' => true,
'playsinline' => true,
'playIfInView' => true,
'videoButton' => 'showPermanent', // showPermanent, showOnMouseOver, disable
'class' => 'quiqqer-presentationBricks-video',
'video' => false,
'poster' => false,
'shortVideo' => false,
'autoplay' => true,
'muted' => true,
'loop' => true,
'playsinline' => true,
'playIfInView' => true,
'videoButton' => 'showPermanent', // showPermanent, showOnMouseOver, disable
'videoButtonAction' => 'playInWebsite', // playInWebsite, openInPopup
'videoBrightness' => 50,
'maxVideoWidth' => '',
'maxContentWidth' => '',
'videoBrightness' => 50,
'maxVideoWidth' => '',
'maxContentWidth' => '',
]);
parent::__construct($attributes);
......@@ -45,7 +45,7 @@ public function __construct($attributes = [])
$this->setJavaScriptControl('package/quiqqer/presentation-bricks/bin/Controls/Video');
$this->addCSSFile(
dirname(__FILE__).'/Video.css'
dirname(__FILE__) . '/Video.css'
);
}
......@@ -54,13 +54,13 @@ public function __construct($attributes = [])
*
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$autoplay = false;
$muted = false;
$loop = false;
$playsinline = false;
$Engine = QUI::getTemplateManager()->getEngine();
$autoplay = false;
$muted = false;
$loop = false;
$playsinline = false;
$videoBrightness = 50;
$this->setJavaScriptControlOption('openinpopup', 0);
......@@ -83,9 +83,11 @@ public function getBody()
$this->setJavaScriptControlOption('playifinview', $this->getAttribute('playIfInView'));
if (intval($this->getAttribute('videoBrightness')) &&
if (
intval($this->getAttribute('videoBrightness')) &&
intval($this->getAttribute('videoBrightness')) > 0 &&
intval($this->getAttribute('videoBrightness')) <= 100) {
intval($this->getAttribute('videoBrightness')) <= 100
) {
$videoBrightness = intval($this->getAttribute('videoBrightness'));
}
......@@ -96,9 +98,9 @@ public function getBody()
$posterUrl = false;
try {
$Poster = QUI\Projects\Media\Utils::getImageByUrl($this->getAttribute('poster'));
$Poster = QUI\Projects\Media\Utils::getImageByUrl($this->getAttribute('poster'));
$posterUrl = $Poster->getUrl(true);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
// nothing
}
......@@ -114,7 +116,7 @@ public function getBody()
try {
$Video = QUI\Projects\Media\Utils::getMediaItemByUrl($this->getAttribute('video'));
$this->setJavaScriptControlOption('video', $Video->getUrl(true));
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
// nothing
}
}
......@@ -125,21 +127,21 @@ public function getBody()
$this->setStyles([
'--qui-video-videoBrightness' => $videoBrightness,
'--qui-video-maxVideoWidth' => $this->checkMaxWidth($this->getAttribute('maxVideoWidth')),
'--qui-video-maxVideoWidth' => $this->checkMaxWidth($this->getAttribute('maxVideoWidth')),
'--qui-video-maxContentWidth' => $this->checkMaxWidth($this->getAttribute('maxContentWidth')),
]);
$Engine->assign([
'this' => $this,
'posterUrl' => $posterUrl,
'autoplay' => $autoplay,
'muted' => $muted,
'loop' => $loop,
'this' => $this,
'posterUrl' => $posterUrl,
'autoplay' => $autoplay,
'muted' => $muted,
'loop' => $loop,
'playsinline' => $playsinline,
'buttonFile' => dirname(__FILE__).'/Video.button.html'
'buttonFile' => dirname(__FILE__) . '/Video.button.html'
]);
return $Engine->fetch(dirname(__FILE__).'/Video.default.html');
return $Engine->fetch(dirname(__FILE__) . '/Video.default.html');
}
/**
......@@ -148,15 +150,17 @@ public function getBody()
* @param $value
* @return string
*/
protected function checkMaxWidth($value)
protected function checkMaxWidth($value): string
{
$width = 'initial';
if (!$value ||
intval($value) <= 0) {
if (
!$value ||
intval($value) <= 0
) {
return $width;
}
return intval($value).'px';
return intval($value) . 'px';
}
}
......@@ -20,24 +20,24 @@ class WallpaperText extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
'imageBackgroundFixed' => false,
'bgColor' => '#eee',
'imageBackgroundPos' => 'center',
'fixed' => false,
'contentPosition' => 'flex-start',
'minHeight' => false,
'contentMaxWidth' => 600,
'fontColor' => 'inherit',
'bgColor' => '#eee',
'imageBackgroundPos' => 'center',
'fixed' => false,
'contentPosition' => 'flex-start',
'minHeight' => false,
'contentMaxWidth' => 600,
'fontColor' => 'inherit',
]);
parent::__construct($attributes);
$this->addCSSFile(
dirname(__FILE__).'/WallpaperText.css'
dirname(__FILE__) . '/WallpaperText.css'
);
}
......@@ -46,7 +46,7 @@ public function __construct($attributes = [])
*
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
......@@ -66,13 +66,13 @@ public function getBody()
}
$Engine->assign([
'this' => $this,
'this' => $this,
'imageBackground' => $this->getAttribute('image-background'),
'bgColor' => $bgColor,
'fixed' => $fixed,
'bgColor' => $bgColor,
'fixed' => $fixed,
'contentPosition' => $this->getAttribute('content-position')
]);
return $Engine->fetch(dirname(__FILE__).'/WallpaperText.html');
return $Engine->fetch(dirname(__FILE__) . '/WallpaperText.html');
}
}
......@@ -20,20 +20,20 @@ class WallpaperTextArrow extends QUI\Control
*
* @param array $attributes
*/
public function __construct($attributes = [])
public function __construct(array $attributes = [])
{
// default options
$this->setAttributes([
'imageBackgroundFixed' => 'false',
'arrowType' => 'arrow-down',
'fixed' => false,
'effect' => 'scale'
'arrowType' => 'arrow-down',
'fixed' => false,
'effect' => 'scale'
]);
parent::__construct($attributes);
$this->addCSSFile(
dirname(__FILE__).'/WallpaperTextArrow.css'
dirname(__FILE__) . '/WallpaperTextArrow.css'
);
}
......@@ -42,9 +42,9 @@ public function __construct($attributes = [])
*
* @see \QUI\Control::create()
*/
public function getBody()
public function getBody(): string
{
$Engine = QUI::getTemplateManager()->getEngine();
$Engine = QUI::getTemplateManager()->getEngine();
$arrowType = $this->getAttribute('arrow-type');
$fixed = '';
......@@ -60,14 +60,14 @@ public function getBody()
}
$Engine->assign([
'this' => $this,
'this' => $this,
'imageBackground' => $this->getAttribute('image-background'),
'fixed' => $fixed,
'image' => $this->getAttribute('image'),
'arrowType' => $this->getAttribute('arrow-type'),
'effect' => $this->getAttribute('effect')
'fixed' => $fixed,
'image' => $this->getAttribute('image'),
'arrowType' => $this->getAttribute('arrow-type'),
'effect' => $this->getAttribute('effect')
]);
return $Engine->fetch(dirname(__FILE__).'/WallpaperTextArrow.html');
return $Engine->fetch(dirname(__FILE__) . '/WallpaperTextArrow.html');
}
}
<?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';