From 038a9c7a694db84a8db0ddf7873ed3436d0f2e6f Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Fri, 24 May 2024 16:53:35 +0200 Subject: [PATCH 01/13] chore: add .gitattributes file --- .gitattributes | 15 +++++++++++++++ .gitignore | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9ab59b1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,15 @@ + +# Ignore developer files when exporting +.gitattributes export-ignore +.gitignore export-ignore +.gitlab-ci.yml export-ignore +.phive export-ignore +captainhook.json export-ignore +phpcs.xml.dist export-ignore +phpstan-baseline.neon export-ignore +phpstan.dist.neon export-ignore +phpunit.dist.xml export-ignore +tests export-ignore + +# Explicitly set file type and line endings for PHP files, improves git diff output +*.php text eol=lf diff=php \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3c3629e..2b1d07b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules + +tools/ -- GitLab From 2eaade386bdcf7e77a9531f50ab930dfcd301c5c Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Fri, 24 May 2024 16:53:36 +0200 Subject: [PATCH 02/13] chore: setup PHPStan for project tooling --- .gitignore | 2 ++ .phive/phars.xml | 4 ++++ phpstan-baseline.neon | 0 phpstan.dist.neon | 8 ++++++++ tests/phpstan-bootstrap.php | 13 +++++++++++++ 5 files changed, 27 insertions(+) create mode 100644 .phive/phars.xml create mode 100644 phpstan-baseline.neon create mode 100644 phpstan.dist.neon create mode 100644 tests/phpstan-bootstrap.php diff --git a/.gitignore b/.gitignore index 2b1d07b..d8019f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules tools/ + +phpstan.neon diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 0000000..f909b52 --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phive xmlns="https://phar.io/phive"> + <phar name="phpstan" version="1.11.1" installed="1.11.1" location="./tools/phpstan" copy="false"/> +</phive> diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..e69de29 diff --git a/phpstan.dist.neon b/phpstan.dist.neon new file mode 100644 index 0000000..15e9210 --- /dev/null +++ b/phpstan.dist.neon @@ -0,0 +1,8 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 8 + paths: + - src + tipsOfTheDay: false diff --git a/tests/phpstan-bootstrap.php b/tests/phpstan-bootstrap.php new file mode 100644 index 0000000..b61ff4b --- /dev/null +++ b/tests/phpstan-bootstrap.php @@ -0,0 +1,13 @@ +<?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'; -- GitLab From ca0ad89accac3fa141fd4cf9a2ab6e734d0b56e8 Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Fri, 24 May 2024 16:53:36 +0200 Subject: [PATCH 03/13] chore: setup PHPUnit for project tooling --- .gitignore | 4 ++++ .phive/phars.xml | 1 + phpunit.dist.xml | 8 ++++++++ tests/phpunit-bootstrap.php | 11 +++++++++++ 4 files changed, 24 insertions(+) create mode 100644 phpunit.dist.xml create mode 100644 tests/phpunit-bootstrap.php diff --git a/.gitignore b/.gitignore index d8019f9..c70e522 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ node_modules tools/ phpstan.neon + +.phpunit.result.cache + +phpunit.xml diff --git a/.phive/phars.xml b/.phive/phars.xml index f909b52..6984891 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <phive xmlns="https://phar.io/phive"> <phar name="phpstan" version="1.11.1" installed="1.11.1" location="./tools/phpstan" copy="false"/> + <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/> </phive> diff --git a/phpunit.dist.xml b/phpunit.dist.xml new file mode 100644 index 0000000..f6c7bec --- /dev/null +++ b/phpunit.dist.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit bootstrap="tests/phpunit-bootstrap.php"> + <testsuites> + <testsuite name="Tests"> + <directory>tests/</directory> + </testsuite> + </testsuites> +</phpunit> diff --git a/tests/phpunit-bootstrap.php b/tests/phpunit-bootstrap.php new file mode 100644 index 0000000..eca92fd --- /dev/null +++ b/tests/phpunit-bootstrap.php @@ -0,0 +1,11 @@ +<?php + +if (!defined('QUIQQER_SYSTEM')) { + define('QUIQQER_SYSTEM', true); +} + +if (!defined('QUIQQER_AJAX')) { + define('QUIQQER_AJAX', true); +} + +require_once __DIR__ . '/../../../../bootstrap.php'; -- GitLab From 302961ee2d2961ea73b053a107d9c59ff75e9da9 Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Fri, 24 May 2024 16:53:36 +0200 Subject: [PATCH 04/13] chore: setup PHP_CodeSniffer for project tooling --- .phive/phars.xml | 2 ++ phpcs.xml.dist | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 phpcs.xml.dist diff --git a/.phive/phars.xml b/.phive/phars.xml index 6984891..3c7dea3 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -2,4 +2,6 @@ <phive xmlns="https://phar.io/phive"> <phar name="phpstan" version="1.11.1" installed="1.11.1" location="./tools/phpstan" copy="false"/> <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/> + <phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/> + <phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/> </phive> diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..d48084f --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<ruleset> + <!-- Use PSR-12 ruleset --> + <rule ref="PSR12"/> + + <!-- Only scan *.php files --> + <arg name="extensions" value="php"/> + + <!-- Ignore warnings --> + <arg name="warning-severity" value="0"/> + + <!-- Process 64 (or number of CPU cores) files in parallel --> + <arg name="parallel" value="64"/> + + <!-- Output relative file paths, by setting the current folder as the basepath --> + <arg name="basepath" value="."/> + + <!-- Show colored output --> + <arg name="colors"/> + + <!-- Scan everything in the current folder --> + <file>.</file> +</ruleset> -- GitLab From 82f0efb89d62a99f3f1883bb1816ba0b7b9ce7f1 Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Fri, 24 May 2024 16:53:37 +0200 Subject: [PATCH 05/13] chore: setup CaptainHook for project tooling --- .phive/phars.xml | 1 + captainhook.json | 16 ++++++++++++++++ tests/captainhook-bootstrap.php | 3 +++ 3 files changed, 20 insertions(+) create mode 100644 captainhook.json create mode 100644 tests/captainhook-bootstrap.php diff --git a/.phive/phars.xml b/.phive/phars.xml index 3c7dea3..63a030f 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -4,4 +4,5 @@ <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/> <phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/> <phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/> + <phar name="captainhook" version="^5.23.0" installed="5.23.0" location="./tools/captainhook" copy="false"/> </phive> diff --git a/captainhook.json b/captainhook.json new file mode 100644 index 0000000..30f1064 --- /dev/null +++ b/captainhook.json @@ -0,0 +1,16 @@ +{ + "config": { + "bootstrap": "tests/captainhook-bootstrap.php" + }, + "pre-commit": { + "enabled": true, + "actions": [ + { + "action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting" + }, + { + "action": "composer test" + } + ] + } +} \ No newline at end of file diff --git a/tests/captainhook-bootstrap.php b/tests/captainhook-bootstrap.php new file mode 100644 index 0000000..1b61b73 --- /dev/null +++ b/tests/captainhook-bootstrap.php @@ -0,0 +1,3 @@ +<?php + +// This file is supposed to be empty, see https://github.com/captainhookphp/captainhook/issues/248 -- GitLab From 966f4c8e680a2a376930534d1eec7337975d1218 Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Fri, 24 May 2024 16:53:37 +0200 Subject: [PATCH 06/13] chore: add developer scripts to composer.json --- composer.json | 72 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 6e97087..fa7a8ab 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "quiqqer\/template-tailwindcss", + "name": "quiqqer/template-tailwindcss", "type": "quiqqer-template", "description": "TailwindCSS template", "license": "GPL-3.0+", @@ -7,30 +7,72 @@ { "name": "Michael Danielczok", "email": "support@pcsg.de", - "homepage": "https:\/\/www.pcsg.de", + "homepage": "https://www.pcsg.de", "role": "Developer" } ], "support": { "email": "support@pcsg.de", - "url": "http:\/\/www.pcsg.de" + "url": "http://www.pcsg.de" }, "require": { "php": ">=5.3", - "quiqqer\/quiqqer": "*@dev", - "quiqqer\/bricks": "*@dev", - "quiqqer\/fontawesome": "*@dev", - "quiqqer\/sitetypes": "*@dev", - "quiqqer\/menu": "2.*|dev-dev|dev-master", - "quiqqer\/unsemantic": "*@dev", - "quiqqer\/utils": ">=1.7|dev-dev", - "quiqqer\/page-transition": "^1.2", - "quiqqer\/pace": ">=1.2.0|dev-master|dev-dev", - "quiqqer\/buttons": ">=1.0.0|dev-master|dev-dev" + "quiqqer/quiqqer": "*@dev", + "quiqqer/bricks": "*@dev", + "quiqqer/fontawesome": "*@dev", + "quiqqer/sitetypes": "*@dev", + "quiqqer/menu": "2.*|dev-dev|dev-master", + "quiqqer/unsemantic": "*@dev", + "quiqqer/utils": ">=1.7|dev-dev", + "quiqqer/page-transition": "^1.2", + "quiqqer/pace": ">=1.2.0|dev-master|dev-dev", + "quiqqer/buttons": ">=1.0.0|dev-master|dev-dev" }, "autoload": { "psr-4": { - "QUI\\TemplateTailwindCss\\": "src\/QUI\/TemplateTailwindCss" + "QUI\\TemplateTailwindCss\\": "src/QUI/TemplateTailwindCss" } + }, + "scripts": { + "test": [ + "@dev:lint", + "@dev:phpunit" + ], + "dev:phpunit": "./tools/phpunit", + "dev:lint": [ + "@dev:lint:phpstan", + "@dev:lint:style" + ], + "dev:lint:phpstan": "./tools/phpstan", + "dev:lint:style": "./tools/phpcs", + "dev:lint:style:fix": "./tools/phpcbf", + "dev:init": [ + "@dev:init:check-requirements", + "@dev:init:tools", + "@dev:init:git-hooks" + ], + "dev:init:check-requirements": [ + "which composer > /dev/null || (echo 'Error: composer has to be globally installed'; exit 1)", + "which phive > /dev/null || (echo 'Error: PHIVE has to be globally installed'; exit 1)" + ], + "dev:init:tools": "phive install --temporary", + "dev:init:git-hooks": "./tools/captainhook install --only-enabled --force" + }, + "scripts-aliases": { + "test": [ + "dev:test" + ] + }, + "scripts-descriptions": { + "test": "Runs linting, static analysis, and unit tests.", + "dev:phpunit": "Run PHPUnit test suites", + "dev:lint": "Run PHPStan and code style check", + "dev:lint:phpstan": "Run PHPStan", + "dev:lint:style": "Run code style check (PHP_CodeSniffer)", + "dev:lint:style:fix": "Try to fix code style errors automatically", + "dev:init": "Initialize the developer tooling (tools and git hooks)", + "dev:init:check-requirements": "Check if the necessary requirements are met", + "dev:init:tools": "Install all developer tools (requires PHIVE)", + "dev:init:git-hooks": "Install all git hooks (may require tools to be installed)" } -} +} \ No newline at end of file -- GitLab From 348890d5767c56e9feaea6401aa45b07575108cf Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Fri, 24 May 2024 16:53:37 +0200 Subject: [PATCH 07/13] ci: use quiqqer-package-bundle component --- .gitlab-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b5a64b4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,17 @@ +include: + - component: dev.quiqqer.com/quiqqer/stabilization/ci-cd-components/quiqqer-package-bundle/quiqqer-package-bundle@main + +# Remove the entire phpunit-php8.1 block, to allow PHPUnit to run on PHP 8.1 in your pipeline +phpunit-php8.1: + rules: + - when: never + +# Remove the entire phpunit-php8.2 block, to allow PHPUnit to run on PHP 8.2 in your pipeline +phpunit-php8.2: + rules: + - when: never + +# Remove the entire phpunit-php8.3 block, to allow PHPUnit to run on PHP 8.3 in your pipeline +phpunit-php8.3: + rules: + - when: never \ No newline at end of file -- GitLab From d4225ce4f9208c179eb496dd73500c09381b0b00 Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Fri, 24 May 2024 16:53:37 +0200 Subject: [PATCH 08/13] docs: add CONTRIBUTING.md file --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..4a69a59 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing + +This package follows the [QUIQQER contribution guidelines](https://dev.quiqqer.com/quiqqer/stabilization/documentation/-/wikis/home). \ No newline at end of file -- GitLab From 7b67a445d35b813f1d048e3b924cd0944dd391e4 Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Thu, 1 Aug 2024 17:35:18 +0200 Subject: [PATCH 09/13] chore: set PHPStan to level 5 with baseline --- .phive/phars.xml | 2 +- phpstan-baseline.neon | 31 +++++++++++++++++++++++++++++++ phpstan.dist.neon | 4 +++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.phive/phars.xml b/.phive/phars.xml index 63a030f..ebb5988 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <phive xmlns="https://phar.io/phive"> - <phar name="phpstan" version="1.11.1" installed="1.11.1" location="./tools/phpstan" copy="false"/> + <phar name="phpstan" version="1.11.8" installed="1.11.8" location="./tools/phpstan" copy="false"/> <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/> <phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/> <phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/> diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e69de29..ac03a22 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -0,0 +1,31 @@ +parameters: + ignoreErrors: + - + message: "#^If condition is always true\\.$#" + count: 1 + path: src/QUI/TemplateTailwindCss/Controls/Children/SiteListPreview.php + + - + message: "#^PHPDoc tag @return with type mixed is not subtype of native type QUI\\\\Projects\\\\Site\\.$#" + count: 1 + path: src/QUI/TemplateTailwindCss/Controls/Children/SiteListPreview.php + + - + message: "#^Instanceof between array\\|float\\|int\\|string\\|false\\|null and QUI\\\\Projects\\\\Site will always evaluate to false\\.$#" + count: 1 + path: src/QUI/TemplateTailwindCss/Utils.php + + - + message: "#^Result of && is always false\\.$#" + count: 1 + path: src/QUI/TemplateTailwindCss/Utils.php + + - + message: "#^Strict comparison using \\=\\=\\= between bool and 'huhu' will always evaluate to false\\.$#" + count: 1 + path: src/QUI/TemplateTailwindCss/Utils.php + + - + message: "#^Variable \\$Project might not be defined\\.$#" + count: 8 + path: src/QUI/TemplateTailwindCss/settings.css.php diff --git a/phpstan.dist.neon b/phpstan.dist.neon index 15e9210..58a61ff 100644 --- a/phpstan.dist.neon +++ b/phpstan.dist.neon @@ -2,7 +2,9 @@ includes: - phpstan-baseline.neon parameters: - level: 8 + level: 5 paths: - src + bootstrapFiles: + - tests/phpstan-bootstrap.php tipsOfTheDay: false -- GitLab From 2c958fdfdfb8d10c4d55271e3b967fbcbde6fb37 Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Thu, 1 Aug 2024 17:35:19 +0200 Subject: [PATCH 10/13] chore: upgrade CaptainHook to version ^5.23.3 --- .phive/phars.xml | 2 +- captainhook.json | 25 +++++++++++-------------- tests/captainhook-bootstrap.php | 3 --- 3 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 tests/captainhook-bootstrap.php diff --git a/.phive/phars.xml b/.phive/phars.xml index ebb5988..5bfa092 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -4,5 +4,5 @@ <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/> <phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/> <phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/> - <phar name="captainhook" version="^5.23.0" installed="5.23.0" location="./tools/captainhook" copy="false"/> + <phar name="captainhook" version="^5.23.3" installed="5.23.3" location="./tools/captainhook" copy="false"/> </phive> diff --git a/captainhook.json b/captainhook.json index 30f1064..3702e1a 100644 --- a/captainhook.json +++ b/captainhook.json @@ -1,16 +1,13 @@ { - "config": { - "bootstrap": "tests/captainhook-bootstrap.php" - }, - "pre-commit": { - "enabled": true, - "actions": [ - { - "action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting" - }, - { - "action": "composer test" - } - ] - } + "pre-commit": { + "enabled": true, + "actions": [ + { + "action": "\\CaptainHook\\App\\Hook\\PHP\\Action\\Linting" + }, + { + "action": "composer test" + } + ] + } } \ No newline at end of file diff --git a/tests/captainhook-bootstrap.php b/tests/captainhook-bootstrap.php deleted file mode 100644 index 1b61b73..0000000 --- a/tests/captainhook-bootstrap.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php - -// This file is supposed to be empty, see https://github.com/captainhookphp/captainhook/issues/248 -- GitLab From a1b89a95d4a76a1ec7647060e1c128e158cffbf7 Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Tue, 6 Aug 2024 14:35:04 +0200 Subject: [PATCH 11/13] ci: use "quiqqer-package-bundle" component for QUIQQER version 1 --- .gitlab-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b5a64b4..958e6db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,7 @@ include: - - component: dev.quiqqer.com/quiqqer/stabilization/ci-cd-components/quiqqer-package-bundle/quiqqer-package-bundle@main + - component: dev.quiqqer.com/quiqqer/stabilization/ci-cd-components/quiqqer-package-bundle/quiqqer-package-bundle@2 + inputs: + quiqqer-major-version: 1 # Remove the entire phpunit-php8.1 block, to allow PHPUnit to run on PHP 8.1 in your pipeline phpunit-php8.1: -- GitLab From 5eb0edf093fe930342eca4f22464e475580230ef Mon Sep 17 00:00:00 2001 From: Jan Wennrich <jan.wennrich@pcsg.de> Date: Tue, 6 Aug 2024 16:28:38 +0200 Subject: [PATCH 12/13] style: fix PSR-12 code style violations --- index.php | 9 ++++-- .../Controls/Children/ListPreview.php | 28 +++++++++++-------- .../Controls/Children/SiteListPreview.php | 28 +++++++++++-------- .../Controls/Separator.php | 4 +-- src/QUI/TemplateTailwindCss/EventHandler.php | 5 ++-- src/QUI/TemplateTailwindCss/Utils.php | 14 +++++----- 6 files changed, 50 insertions(+), 38 deletions(-) diff --git a/index.php b/index.php index 3cc9bcc..2b72488 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,8 @@ QUI\Utils\Site::setRecursiveAttribute($Site, 'site.settings.independentMenu.id'); // Inhaltsverhalten -if ($Site->getAttribute('templateTailwindCss.showTitle') || +if ( + $Site->getAttribute('templateTailwindCss.showTitle') || $Site->getAttribute('templateTailwindCss.showShort') ) { $Template->setAttribute('content-header', false); @@ -239,8 +240,10 @@ class="header-bar-search-link searchMobile"> 'Start' => $ProductPage ]; - if ($Project->getConfig('templateTailwindCSS.settings.independentMenu.enable') - && $Project->getConfig('templateTailwindCSS.settings.independentMenu.menuId')) { + if ( + $Project->getConfig('templateTailwindCSS.settings.independentMenu.enable') + && $Project->getConfig('templateTailwindCSS.settings.independentMenu.menuId') + ) { $menuParams['menuId'] = $Project->getConfig('templateTailwindCSS.settings.independentMenu.menuId'); $menuParams['showFirstLevelIcons'] = $Project->getConfig('templateTailwindCSS.settings.independentMenu.showFirstLevelIcons'); } diff --git a/src/QUI/TemplateTailwindCss/Controls/Children/ListPreview.php b/src/QUI/TemplateTailwindCss/Controls/Children/ListPreview.php index 4b653e6..68694c0 100644 --- a/src/QUI/TemplateTailwindCss/Controls/Children/ListPreview.php +++ b/src/QUI/TemplateTailwindCss/Controls/Children/ListPreview.php @@ -148,25 +148,25 @@ public function getBody(): string case 'default': case 'simpleOrdered': case 'simpleUnordered': - $this->listCSSFile = \dirname(__FILE__).'/ListPreview.List.'.$this->getAttribute('listTemplate').'.css'; - $this->listHTMLFile = \dirname(__FILE__).'/ListPreview.List.'.$this->getAttribute('listTemplate').'.html'; + $this->listCSSFile = \dirname(__FILE__) . '/ListPreview.List.' . $this->getAttribute('listTemplate') . '.css'; + $this->listHTMLFile = \dirname(__FILE__) . '/ListPreview.List.' . $this->getAttribute('listTemplate') . '.html'; break; default: - $this->listCSSFile = \dirname(__FILE__).'/ListPreview.List.default.css'; - $this->listHTMLFile = \dirname(__FILE__).'/ListPreview.List.default.html'; + $this->listCSSFile = \dirname(__FILE__) . '/ListPreview.List.default.css'; + $this->listHTMLFile = \dirname(__FILE__) . '/ListPreview.List.default.html'; break; } switch ($this->getAttribute('previewTemplate')) { case 'circle': - $this->previewCSSFile = \dirname(__FILE__).'/ListPreview.Preview.'.$this->getAttribute('previewTemplate').'.css'; - $this->previewHTMLFile = \dirname(__FILE__).'/ListPreview.Preview.'.$this->getAttribute('previewTemplate').'.html'; + $this->previewCSSFile = \dirname(__FILE__) . '/ListPreview.Preview.' . $this->getAttribute('previewTemplate') . '.css'; + $this->previewHTMLFile = \dirname(__FILE__) . '/ListPreview.Preview.' . $this->getAttribute('previewTemplate') . '.html'; break; default: - $this->previewCSSFile = \dirname(__FILE__).'/ListPreview.Preview.circle.css'; - $this->previewHTMLFile = \dirname(__FILE__).'/ListPreview.Preview.circle.html'; + $this->previewCSSFile = \dirname(__FILE__) . '/ListPreview.Preview.circle.css'; + $this->previewHTMLFile = \dirname(__FILE__) . '/ListPreview.Preview.circle.html'; break; } @@ -239,10 +239,12 @@ public function getPreview($params = []): string protected function setCustomTemplates() { // list template - if ($this->getAttribute('customListTemplate') + if ( + $this->getAttribute('customListTemplate') && \file_exists($this->getAttribute('customListTemplate')) ) { - if ($this->getAttribute('customListCss') + if ( + $this->getAttribute('customListCss') && \file_exists($this->getAttribute('customListCss')) ) { $this->listCSSFile = $this->getAttribute('customListCss'); @@ -252,10 +254,12 @@ protected function setCustomTemplates() } // preview template - if ($this->getAttribute('customPreviewTemplate') + if ( + $this->getAttribute('customPreviewTemplate') && \file_exists($this->getAttribute('customPreviewTemplate')) ) { - if ($this->getAttribute('customPreviewCss') + if ( + $this->getAttribute('customPreviewCss') && \file_exists($this->getAttribute('customPreviewCss')) ) { $this->listCSSFile = $this->getAttribute('customPreviewCss'); diff --git a/src/QUI/TemplateTailwindCss/Controls/Children/SiteListPreview.php b/src/QUI/TemplateTailwindCss/Controls/Children/SiteListPreview.php index 6f75360..e7cb6ec 100644 --- a/src/QUI/TemplateTailwindCss/Controls/Children/SiteListPreview.php +++ b/src/QUI/TemplateTailwindCss/Controls/Children/SiteListPreview.php @@ -172,25 +172,25 @@ public function getBody(): string case 'default': case 'simpleOrdered': case 'simpleUnordered': - $this->listCSSFile = \dirname(__FILE__).'/SiteListPreview.List.'.$this->getAttribute('listTemplate').'.css'; - $this->listHTMLFile = \dirname(__FILE__).'/SiteListPreview.List.'.$this->getAttribute('listTemplate').'.html'; + $this->listCSSFile = \dirname(__FILE__) . '/SiteListPreview.List.' . $this->getAttribute('listTemplate') . '.css'; + $this->listHTMLFile = \dirname(__FILE__) . '/SiteListPreview.List.' . $this->getAttribute('listTemplate') . '.html'; break; default: - $this->listCSSFile = \dirname(__FILE__).'/SiteListPreview.List.default.css'; - $this->listHTMLFile = \dirname(__FILE__).'/SiteListPreview.List.default.html'; + $this->listCSSFile = \dirname(__FILE__) . '/SiteListPreview.List.default.css'; + $this->listHTMLFile = \dirname(__FILE__) . '/SiteListPreview.List.default.html'; break; } switch ($this->getAttribute('previewTemplate')) { case 'circle': - $this->previewCSSFile = \dirname(__FILE__).'/SiteListPreview.Preview.'.$this->getAttribute('previewTemplate').'.css'; - $this->previewHTMLFile = \dirname(__FILE__).'/SiteListPreview.Preview.'.$this->getAttribute('previewTemplate').'.html'; + $this->previewCSSFile = \dirname(__FILE__) . '/SiteListPreview.Preview.' . $this->getAttribute('previewTemplate') . '.css'; + $this->previewHTMLFile = \dirname(__FILE__) . '/SiteListPreview.Preview.' . $this->getAttribute('previewTemplate') . '.html'; break; default: - $this->previewCSSFile = \dirname(__FILE__).'/SiteListPreview.Preview.circle.css'; - $this->previewHTMLFile = \dirname(__FILE__).'/SiteListPreview.Preview.circle.html'; + $this->previewCSSFile = \dirname(__FILE__) . '/SiteListPreview.Preview.circle.css'; + $this->previewHTMLFile = \dirname(__FILE__) . '/SiteListPreview.Preview.circle.html'; break; } @@ -279,10 +279,12 @@ protected function getSite(): QUI\Projects\Site protected function setCustomTemplates() { // list template - if ($this->getAttribute('customListTemplate') + if ( + $this->getAttribute('customListTemplate') && \file_exists($this->getAttribute('customListTemplate')) ) { - if ($this->getAttribute('customListCss') + if ( + $this->getAttribute('customListCss') && \file_exists($this->getAttribute('customListCss')) ) { $this->listCSSFile = $this->getAttribute('customListCss'); @@ -292,10 +294,12 @@ protected function setCustomTemplates() } // preview template - if ($this->getAttribute('customPreviewTemplate') + if ( + $this->getAttribute('customPreviewTemplate') && \file_exists($this->getAttribute('customPreviewTemplate')) ) { - if ($this->getAttribute('customPreviewCss') + if ( + $this->getAttribute('customPreviewCss') && \file_exists($this->getAttribute('customPreviewCss')) ) { $this->listCSSFile = $this->getAttribute('customPreviewCss'); diff --git a/src/QUI/TemplateTailwindCss/Controls/Separator.php b/src/QUI/TemplateTailwindCss/Controls/Separator.php index b193e0a..e6ba799 100644 --- a/src/QUI/TemplateTailwindCss/Controls/Separator.php +++ b/src/QUI/TemplateTailwindCss/Controls/Separator.php @@ -36,7 +36,7 @@ public function __construct($attributes = []) parent::__construct($attributes); $this->addCSSFile( - dirname(__FILE__).'/Separator.css' + dirname(__FILE__) . '/Separator.css' ); } @@ -85,7 +85,7 @@ public function getBody() 'colorScheme' => $colorScheme ]); - return $Engine->fetch(dirname(__FILE__).'/Separator.html'); + return $Engine->fetch(dirname(__FILE__) . '/Separator.html'); } /** diff --git a/src/QUI/TemplateTailwindCss/EventHandler.php b/src/QUI/TemplateTailwindCss/EventHandler.php index ed3a849..0a88cd3 100644 --- a/src/QUI/TemplateTailwindCss/EventHandler.php +++ b/src/QUI/TemplateTailwindCss/EventHandler.php @@ -1,4 +1,5 @@ <?php + /** * This file contains \QUI\TemplateTailwindCss\EventHandler */ @@ -34,10 +35,10 @@ public static function onProjectConfigSave() public static function onSiteSave($Site) { $Project = $Site->getProject(); - $cacheName = md5($Project->getName().$Project->getLang().$Site->getId()); + $cacheName = md5($Project->getName() . $Project->getLang() . $Site->getId()); try { - QUI\Cache\Manager::clear('quiqqer/templateTailwindCss'.$cacheName); + QUI\Cache\Manager::clear('quiqqer/templateTailwindCss' . $cacheName); } catch (QUI\Exception $Exception) { QUI\System\Log::writeException($Exception); } diff --git a/src/QUI/TemplateTailwindCss/Utils.php b/src/QUI/TemplateTailwindCss/Utils.php index 5bee33b..8fd7916 100644 --- a/src/QUI/TemplateTailwindCss/Utils.php +++ b/src/QUI/TemplateTailwindCss/Utils.php @@ -28,11 +28,11 @@ public static function getConfig($params) $Project = $params['Project']; $Template = $params['Template']; $Site = $params['Site']; - $cacheName = md5($Project->getName().$Project->getLang().$Site->getId()); + $cacheName = md5($Project->getName() . $Project->getLang() . $Site->getId()); try { return QUI\Cache\Manager::get( - 'quiqqer/templateTailwindCss/'.$cacheName + 'quiqqer/templateTailwindCss/' . $cacheName ); } catch (QUI\Exception $Exception) { } @@ -156,13 +156,13 @@ public static function getConfig($params) $settingsCSS = include 'settings.css.php'; $settingsCssInline = ''; - $binDir = OPT_DIR.'quiqqer/template-tailwindcss/bin/css'; + $binDir = OPT_DIR . 'quiqqer/template-tailwindcss/bin/css'; // todo mit mor besprechen if (is_dir($binDir) === 'huhu') { - file_put_contents($binDir.'/settings.css', $settingsCSS); + file_put_contents($binDir . '/settings.css', $settingsCSS); } else { - $settingsCssInline = '<style data-no-cache="1">'.$settingsCSS.'</style>'; + $settingsCssInline = '<style data-no-cache="1">' . $settingsCSS . '</style>'; } // disable title and short in site content - do not show it twice @@ -172,7 +172,7 @@ public static function getConfig($params) $config += [ 'quiTplType' => $Project->getConfig('templateTailwindCss.settings.standardType'), - 'typeClass' => 'type-'.str_replace(['/', ':'], '-', $Site->getAttribute('type')), + 'typeClass' => 'type-' . str_replace(['/', ':'], '-', $Site->getAttribute('type')), 'pageTitle' => $title, 'pageShort' => $short, 'titleAndShortPos' => $titleAndShortPos, @@ -184,7 +184,7 @@ public static function getConfig($params) // set cache QUI\Cache\Manager::set( - 'quiqqer/templateTailwindCss/'.$cacheName, + 'quiqqer/templateTailwindCss/' . $cacheName, $config ); -- GitLab From abdf79a68d60b31ae716601cd061a3960adb79ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= <p.mueller@pcsg.de> Date: Fri, 7 Mar 2025 12:48:07 +0000 Subject: [PATCH 13/13] chore: update dependency versions --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index fa7a8ab..1a5255a 100644 --- a/composer.json +++ b/composer.json @@ -17,16 +17,16 @@ }, "require": { "php": ">=5.3", - "quiqqer/quiqqer": "*@dev", + "quiqqer/quiqqer": "^1", "quiqqer/bricks": "*@dev", "quiqqer/fontawesome": "*@dev", "quiqqer/sitetypes": "*@dev", - "quiqqer/menu": "2.*|dev-dev|dev-master", + "quiqqer/menu": "^2|*@dev", "quiqqer/unsemantic": "*@dev", - "quiqqer/utils": ">=1.7|dev-dev", + "quiqqer/utils": "^1.7", "quiqqer/page-transition": "^1.2", - "quiqqer/pace": ">=1.2.0|dev-master|dev-dev", - "quiqqer/buttons": ">=1.0.0|dev-master|dev-dev" + "quiqqer/pace": "^1.2.0", + "quiqqer/buttons": "^1.0.0" }, "autoload": { "psr-4": { -- GitLab