Skip to content

Commit

Permalink
Added build-tools a fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Feb 12, 2024
1 parent 86b965c commit 459775d
Show file tree
Hide file tree
Showing 44 changed files with 446 additions and 821 deletions.
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"require-dev": {
"contao/manager-plugin": "^2.0",
"phpunit/phpunit": "^9.5",
"terminal42/dc_multilingual": "^4.0"
"terminal42/dc_multilingual": "^4.0",
"terminal42/contao-build-tools": "dev-main"
},
"conflict": {
"contao/manager-plugin": "<2.0 || >=3.0"
Expand All @@ -47,13 +48,11 @@
"config": {
"allow-plugins": {
"contao-components/installer": true,
"contao-community-alliance/composer-plugin": true,
"contao/manager-plugin": true,
"php-http/discovery": true
"php-http/discovery": false
}
},
"scripts": {
"cs-fixer": "tools/ecs/vendor/bin/ecs check src/ --fix --ansi",
"unit-tests": "@php vendor/bin/phpunit --colors=always"
}
}
4 changes: 3 additions & 1 deletion contao/config/config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php

use Codefog\HasteBundle\UndoManager;

// Add the "haste_undo" operation to "undo" module
$GLOBALS['BE_MOD']['system']['undo']['haste_undo'] = [\Codefog\HasteBundle\UndoManager::class, 'onUndoCallback'];
$GLOBALS['BE_MOD']['system']['undo']['haste_undo'] = [UndoManager::class, 'onUndoCallback'];
4 changes: 3 additions & 1 deletion contao/dca/tl_undo.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

use Codefog\HasteBundle\UndoManager;

// Replace the "undo" button href
$GLOBALS['TL_DCA']['tl_undo']['list']['operations']['undo']['button_callback'] = [\Codefog\HasteBundle\UndoManager::class, 'button'];
$GLOBALS['TL_DCA']['tl_undo']['list']['operations']['undo']['button_callback'] = [UndoManager::class, 'button'];

// Add fields to tl_undo
$GLOBALS['TL_DCA']['tl_undo']['fields']['haste_data'] = [
Expand Down
46 changes: 14 additions & 32 deletions contao/languages/de/default.php
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
<?php

/**
* Contao Open Source CMS
* Copyright (C) 2005-2013 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* PHP version 5
* @copyright  terminal42 gmbh 2013
* @author     Andreas Schempp <[email protected]>
* @license http://opensource.org/licenses/lgpl-3.0.html
*/


/**
/*
* Errors
*/
$GLOBALS['TL_LANG']['ERR']['numberInputNotAllowed'] = 'Bitte geben Sie eine valide Zahl ein (e.g. 5\'000, 5.00, 5,00, 5\'000.00)';

/**
/*
* Miscellaneous
*/
$GLOBALS['TL_LANG']['HST']['advanced_filter'] = 'Erweiterte Filter:';
$GLOBALS['TL_LANG']['HST']['advanced_search'] = 'Suche in "%s":';
$GLOBALS['TL_LANG']['HST']['advanced_filter'] = 'Erweiterte Filter:';
$GLOBALS['TL_LANG']['HST']['advanced_search'] = 'Suche in "%s":';

/**
/*
* Weight Units
* http://www.metric-conversions.org/weight/weight-conversions.htm
*/
$GLOBALS['TL_LANG']['WGT']['mg'] = array('Milligramm (mg)', 'Eine Masseinheit; entspricht 1 Tausendstel Gramm.');
$GLOBALS['TL_LANG']['WGT']['g'] = array('Gramm (g)', 'Eine Masseinheit; entspricht 1 Tausendstel Kilogramm.');
$GLOBALS['TL_LANG']['WGT']['kg'] = array('Kilogramm (kg)', 'Ein Kilogramm entspricht 1\'000 Gramm oder 2.2 Pfund; Entspricht dem Gewicht von einem Liter Wasser.');
$GLOBALS['TL_LANG']['WGT']['t'] = array('Tonne (t)', 'Eine Tonne entspricht 1\'000 Kilogramm, oder 2,204.6 Pfund.');
$GLOBALS['TL_LANG']['WGT']['ct'] = array('Karat (ct)', 'Das metrische Karat ist eine Masseinheit für die Masse von Edelsteinen. 1 metrisches Karat = 0,2 g = 2 · 10−4 kg.');
$GLOBALS['TL_LANG']['WGT']['oz'] = array('Unze (oz)', 'Entspricht einem Sechzehntel eines Pfunds oder 28.35 Gramm.');
$GLOBALS['TL_LANG']['WGT']['lb'] = array('Pfund (lb)', 'Eine Masseinheit; entspricht 16 Unzen');
$GLOBALS['TL_LANG']['WGT']['st'] = array('Stone (st)', 'Ein britische Masseinheit; Entspricht 14 Pfund.');
$GLOBALS['TL_LANG']['WGT']['grain'] = array('Grain', 'Eine Masseinheit; entspricht 1/7000 Pfund bzw. einem Troy Grain oder 64.799 Milligramm.');
$GLOBALS['TL_LANG']['WGT']['mg'] = ['Milligramm (mg)', 'Eine Masseinheit; entspricht 1 Tausendstel Gramm.'];
$GLOBALS['TL_LANG']['WGT']['g'] = ['Gramm (g)', 'Eine Masseinheit; entspricht 1 Tausendstel Kilogramm.'];
$GLOBALS['TL_LANG']['WGT']['kg'] = ['Kilogramm (kg)', 'Ein Kilogramm entspricht 1\'000 Gramm oder 2.2 Pfund; Entspricht dem Gewicht von einem Liter Wasser.'];
$GLOBALS['TL_LANG']['WGT']['t'] = ['Tonne (t)', 'Eine Tonne entspricht 1\'000 Kilogramm, oder 2,204.6 Pfund.'];
$GLOBALS['TL_LANG']['WGT']['ct'] = ['Karat (ct)', 'Das metrische Karat ist eine Masseinheit für die Masse von Edelsteinen. 1 metrisches Karat = 0,2 g = 2 · 10−4 kg.'];
$GLOBALS['TL_LANG']['WGT']['oz'] = ['Unze (oz)', 'Entspricht einem Sechzehntel eines Pfunds oder 28.35 Gramm.'];
$GLOBALS['TL_LANG']['WGT']['lb'] = ['Pfund (lb)', 'Eine Masseinheit; entspricht 16 Unzen'];
$GLOBALS['TL_LANG']['WGT']['st'] = ['Stone (st)', 'Ein britische Masseinheit; Entspricht 14 Pfund.'];
$GLOBALS['TL_LANG']['WGT']['grain'] = ['Grain', 'Eine Masseinheit; entspricht 1/7000 Pfund bzw. einem Troy Grain oder 64.799 Milligramm.'];
46 changes: 14 additions & 32 deletions contao/languages/en/default.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,28 @@
<?php

/**
* Contao Open Source CMS
* Copyright (C) 2005-2013 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* PHP version 5
* @copyright  terminal42 gmbh 2013
* @author     Andreas Schempp <[email protected]>
* @license http://opensource.org/licenses/lgpl-3.0.html
*/


/**
/*
* Errors
*/
$GLOBALS['TL_LANG']['ERR']['numberInputNotAllowed'] = 'Enter a valid number (e.g. 5\'000, 5.00, 5,00, 5\'000.00)';
$GLOBALS['TL_LANG']['ERR']['minFileSize'] = 'The minimum size for file uploads is %s';
$GLOBALS['TL_LANG']['ERR']['maxFileSize'] = 'The maximum size for file uploads is %s';

/**
/*
* Miscellaneous
*/
$GLOBALS['TL_LANG']['HST']['advanced_filter'] = 'Advanced filter:';
$GLOBALS['TL_LANG']['HST']['advanced_search'] = 'Search in "%s":';
$GLOBALS['TL_LANG']['HST']['advanced_filter'] = 'Advanced filter:';
$GLOBALS['TL_LANG']['HST']['advanced_search'] = 'Search in "%s":';

/**
/*
* Weight Units
* http://www.metric-conversions.org/weight/weight-conversions.htm
*/
$GLOBALS['TL_LANG']['WGT']['mg'] = array('Milligram (mg)', 'A unit of mass equal to one-thousandth of a gram.');
$GLOBALS['TL_LANG']['WGT']['g'] = array('Gram (g)', 'A metric unit of weight equal to one thousandth of a kilogram.');
$GLOBALS['TL_LANG']['WGT']['kg'] = array('Kilogram (kg)', 'One kilogram is equivalent to 1,000 grams or 2.2 pounds; the mass of a liter of water.');
$GLOBALS['TL_LANG']['WGT']['t'] = array('Metric Ton (t)', 'A unit of weight equal to 1,000 kilograms, or 2,204.6 pounds.');
$GLOBALS['TL_LANG']['WGT']['ct'] = array('Carats (ct)', 'A measure of weight used for gemstones. One carat is equal to 1/5 of a gram (200 milligrams). Note that karat with a "K" is a measure of the purity of a gold alloy.');
$GLOBALS['TL_LANG']['WGT']['oz'] = array('Ounce (oz)', 'A unit of weight equal to one sixteenth of a pound or 28.35 grams.');
$GLOBALS['TL_LANG']['WGT']['lb'] = array('Pound (lb)', 'A unit of mass equal to 16 ounces');
$GLOBALS['TL_LANG']['WGT']['st'] = array('Stone (st)', 'A British measurement of mass that equals fourteen pounds.');
$GLOBALS['TL_LANG']['WGT']['grain'] = array('Grain', '1/7000 pound; equals a troy grain or 64.799 milligrams.');
$GLOBALS['TL_LANG']['WGT']['mg'] = ['Milligram (mg)', 'A unit of mass equal to one-thousandth of a gram.'];
$GLOBALS['TL_LANG']['WGT']['g'] = ['Gram (g)', 'A metric unit of weight equal to one thousandth of a kilogram.'];
$GLOBALS['TL_LANG']['WGT']['kg'] = ['Kilogram (kg)', 'One kilogram is equivalent to 1,000 grams or 2.2 pounds; the mass of a liter of water.'];
$GLOBALS['TL_LANG']['WGT']['t'] = ['Metric Ton (t)', 'A unit of weight equal to 1,000 kilograms, or 2,204.6 pounds.'];
$GLOBALS['TL_LANG']['WGT']['ct'] = ['Carats (ct)', 'A measure of weight used for gemstones. One carat is equal to 1/5 of a gram (200 milligrams). Note that karat with a "K" is a measure of the purity of a gold alloy.'];
$GLOBALS['TL_LANG']['WGT']['oz'] = ['Ounce (oz)', 'A unit of weight equal to one sixteenth of a pound or 28.35 grams.'];
$GLOBALS['TL_LANG']['WGT']['lb'] = ['Pound (lb)', 'A unit of mass equal to 16 ounces'];
$GLOBALS['TL_LANG']['WGT']['st'] = ['Stone (st)', 'A British measurement of mass that equals fourteen pounds.'];
$GLOBALS['TL_LANG']['WGT']['grain'] = ['Grain', '1/7000 pound; equals a troy grain or 64.799 milligrams.'];
20 changes: 1 addition & 19 deletions contao/languages/pl/default.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
<?php

/**
* Contao Open Source CMS
* Copyright (C) 2005-2013 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*
* PHP version 5
* @copyright  terminal42 gmbh 2013
* @author     Andreas Schempp <[email protected]>
* @license http://opensource.org/licenses/lgpl-3.0.html
*/


/**
/*
* Miscellaneous
*/
$GLOBALS['TL_LANG']['HST']['advanced_filter'] = 'Zaawansowany filtr:';
16 changes: 0 additions & 16 deletions ecs.php

This file was deleted.

14 changes: 8 additions & 6 deletions src/AjaxReloadManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
class AjaxReloadManager implements ResetInterface
{
public const TYPE_CONTENT = 'ce';

public const TYPE_MODULE = 'fmd';

private array $buffers = [];

private array $listeners = [];

/**
Expand Down Expand Up @@ -58,7 +60,7 @@ public function updateBuffer(string $type, int $id, string $buffer, bool $isAjax
}

if (\count($events) > 0) {
$buffer = static::addDataAttributes($buffer, $uniqid, $events, $isAjax);
$buffer = $this->addDataAttributes($buffer, $uniqid, $events, $isAjax);
}

return $buffer;
Expand All @@ -75,7 +77,7 @@ public function hasListeners(): bool
/**
* Get the response.
*/
public function getResponse(): ?Response
public function getResponse(): Response|null
{
if (0 === \count($this->buffers)) {
return null;
Expand Down Expand Up @@ -154,7 +156,7 @@ static function ($matches) use (&$events) {

return '';
},
$buffer
$buffer,
);

// Remove the HTML comments on AJAX request, so they don't appear doubled in the DOM
Expand All @@ -166,11 +168,11 @@ static function ($matches) use (&$events) {
$buffer = preg_replace(
'/<([^>!]+)>/',
sprintf('<$1 data-haste-ajax-id="%s" data-haste-ajax-listeners="%s">', $uniqid, implode(' ', array_unique($events))),
$buffer,
1
(string) $buffer,
1,
);

// Trim the buffer to avoid JS break
return trim($buffer);
return trim((string) $buffer);
}
}
2 changes: 2 additions & 0 deletions src/Attribute/DoctrineOrmUndo.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Codefog\HasteBundle\Attribute;

#[\Attribute(\Attribute::TARGET_CLASS)]
Expand Down
8 changes: 6 additions & 2 deletions src/Attribute/DoctrineOrmVersion.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?php

declare(strict_types=1);

namespace Codefog\HasteBundle\Attribute;

#[\Attribute(\Attribute::TARGET_CLASS)]
class DoctrineOrmVersion
{
public function __construct(public string $editRouteName = 'contao_backend', public array $editRouteParams = [])
{
public function __construct(
public string $editRouteName = 'contao_backend',
public array $editRouteParams = [],
) {
}
}
Loading

0 comments on commit 459775d

Please sign in to comment.