Skip to content

Commit 1400119

Browse files
committed
Merge tag '2.0.4'
Maintenance release Code and build cosmetics
2 parents e59a640 + 2556317 commit 1400119

15 files changed

Lines changed: 197 additions & 148 deletions

.check-author.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ignore:
2-
# Mini Model <minimodel@metamodel.me>
2+
- 'Mini Model <minimodel@metamodel.me>'
33

44
exclude:
5-
languages
5+
- /^contao\/languages/
66

77
mapping:
8-
"Andreas Isaak <info@andreas-isaak.de>": "Andreas Isaak <andy.jared@googlemail.com>"
8+
'Andreas Isaak <info@andreas-isaak.de>': 'Andreas Isaak <andy.jared@googlemail.com>'

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
build.default.properties export-ignore
66
build.xml export-ignore
77
phpunit.xml.dist export-ignore
8+
/.github export-ignore
89
/tests export-ignore
10+
ctb.json export-ignore

.travis.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
dist: xenial
2+
3+
addons:
4+
apt:
5+
packages:
6+
- ant-optional
7+
18
language: php
29

310
php:
11+
- "7.3"
412
- "7.2"
513
- "7.1"
614
- "7.0"
@@ -9,14 +17,19 @@ php:
917
env:
1018
- CONTAO_VERSION=~3.5.5
1119

12-
sudo: false
13-
14-
before_install:
15-
- echo "memory_limit = -1" > travis.php.ini && phpenv config-add travis.php.ini
16-
17-
install:
20+
before_script:
21+
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
1822
- travis_retry composer self-update && composer --version
1923
- travis_retry composer require contao/core $CONTAO_VERSION --no-update
24+
- >
25+
if [ "x${TRAVIS_TAG}" != "x" ]; then
26+
export COMPOSER_ROOT_VERSION=${TRAVIS_TAG}
27+
else
28+
export COMPOSER_ROOT_VERSION=$([[ ${TRAVIS_BRANCH} =~ hotfix/([0-9.]*(-(alpha|beta|rc)[0-9]+)?) ]] \
29+
&& echo ${BASH_REMATCH[1]} \
30+
|| echo dev-${TRAVIS_BRANCH})
31+
fi
32+
- echo "Using root version ${COMPOSER_ROOT_VERSION}"
2033
- travis_retry composer update --prefer-dist --no-interaction
2134

2235
script: ant -keep-going
@@ -25,6 +38,10 @@ script: ant -keep-going
2538
git:
2639
depth: 2147483647
2740

41+
branches:
42+
except:
43+
- /.*-translation/
44+
2845
cache:
2946
directories:
3047
- vendor

composer.json

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,13 @@
3232
},
3333
"require": {
3434
"php": "^5.6 || ^7.0",
35+
"contao-community-alliance/composer-plugin": "^2.4",
36+
"contao-community-alliance/dc-general": "^2.0.0",
3537
"contao/core": "^3.5.5",
36-
"contao-community-alliance/composer-plugin": "~2.0",
37-
"contao-community-alliance/dc-general": "~2.0@beta",
38-
"metamodels/core": "~2.0@alpha"
38+
"metamodels/core": "^2.0"
3939
},
4040
"require-dev": {
41-
"cyberspectrum/contao-toolbox": "~0.6",
42-
"phpcq/all-tasks": "~1.1"
41+
"phpcq/all-tasks": "^1.2"
4342
},
4443
"autoload": {
4544
"psr-0": {
@@ -50,17 +49,14 @@
5049
"contao": {
5150
"symlinks": {
5251
"contao": "system/modules/metamodelsfilter_range"
53-
},
54-
"transifex": {
55-
"project": "metamodels",
56-
"prefix": "filter_range-",
57-
"languages_cto": "contao/languages",
58-
"languages_tx": ".tx"
5952
}
6053
},
6154
"branch-alias": {
6255
"dev-master": "2.0.x-dev",
6356
"dev-develop": "2.1.x-dev"
6457
}
58+
},
59+
"config": {
60+
"sort-packages": true
6561
}
6662
}

contao/config/event_listeners.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<?php
22
/**
3-
* The MetaModels extension allows the creation of multiple collections of custom items,
4-
* each with its own unique set of selectable attributes, with attribute extendability.
5-
* The Front-End modules allow you to build powerful listing and filtering of the
6-
* data in each collection.
3+
* This file is part of MetaModels/filter_range.
74
*
8-
* @package MetaModels
9-
* @subpackage FilterRange
5+
* (c) 2012-2019 The MetaModels team.
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*
10+
* This project is provided in good faith and hope to be usable by anyone.
11+
*
12+
* @package MetaModels/filter_range
1013
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1114
* @author Stefan Heimes <stefan_heimes@hotmail.com>
12-
* @copyright 2015 The MetaModels team.
13-
* @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0
15+
* @copyright 2012-2019 The MetaModels team.
16+
* @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0-or-later
1417
* @filesource
1518
*/
1619

contao/dca/tl_metamodel_filtersetting.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,20 @@
33
/**
44
* This file is part of MetaModels/filter_range.
55
*
6-
* (c) 2012-2018 The MetaModels team.
6+
* (c) 2012-2019 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*
1111
* This project is provided in good faith and hope to be usable by anyone.
1212
*
13-
* @package MetaModels
14-
* @subpackage FilterRange
13+
* @package MetaModels/filter_range
1514
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1615
* @author Stefan Heimes <stefan_heimes@hotmail.com>
1716
* @author Andreas Isaak <info@andreas-isaak.de>
1817
* @author Christian de la Haye <service@delahaye.de>
1918
* @author Ingolf Steinhardt <info@e-spin.de>
20-
* @copyright 2012-2018 The MetaModels team.
19+
* @copyright 2012-2019 The MetaModels team.
2120
* @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0-or-later
2221
* @filesource
2322
*/

ctb.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"transifex": {
3+
"project": "metamodels",
4+
"prefix": "filter_range-",
5+
"languages_cto": "contao/languages",
6+
"languages_tx": ".tx",
7+
"php-file-header": [
8+
"This file is part of MetaModels/filter_range.",
9+
"",
10+
"(c) 2012-$$year$$ The MetaModels team.",
11+
"",
12+
"For the full copyright and license information, please view the LICENSE",
13+
"file that was distributed with this source code.",
14+
"",
15+
"This project is provided in good faith and hope to be usable by anyone.",
16+
"",
17+
"Translations are managed automatically using Transifex. To create a new translation",
18+
"or to help to maintain an existing one, please register at transifex.com.",
19+
"",
20+
"Last-updated: $$lastchanged$$",
21+
"",
22+
"@copyright 2012-$$year$$ The MetaModels team.",
23+
"@license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0-or-later",
24+
"@link https://www.transifex.com/metamodels/public/",
25+
"@link https://www.transifex.com/signup/?join_project=metamodels"
26+
]
27+
}
28+
}

phpunit.xml.dist

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
syntaxCheck="false"
12-
bootstrap="tests/bootstrap.php"
13-
>
14-
<testsuites>
15-
<testsuite name="MetaModels filter range tests">
16-
<directory>./tests/MetaModels/</directory>
17-
</testsuite>
18-
</testsuites>
19-
20-
<groups>
21-
<exclude>
22-
<group>slow</group>
23-
</exclude>
24-
</groups>
25-
26-
<filter>
27-
<whitelist>
28-
<directory>./src/MetaModels/</directory>
29-
</whitelist>
30-
</filter>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
5+
colors="true"
6+
forceCoversAnnotation="true"
7+
failOnRisky="true"
8+
failOnWarning="true"
9+
beStrictAboutChangesToGlobalState="true"
10+
beStrictAboutOutputDuringTests="true"
11+
beStrictAboutResourceUsageDuringSmallTests="true"
12+
beStrictAboutTodoAnnotatedTests="true"
13+
bootstrap="vendor/autoload.php"
14+
>
15+
<testsuites>
16+
<testsuite name="MetaModels filter for range tests">
17+
<directory>./tests</directory>
18+
</testsuite>
19+
</testsuites>
20+
<filter>
21+
<whitelist>
22+
<directory>./src</directory>
23+
</whitelist>
24+
</filter>
3125
</phpunit>

src/MetaModels/DcGeneral/Events/Filter/Setting/Range/Subscriber.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
<?php
22
/**
3-
* The MetaModels extension allows the creation of multiple collections of custom items,
4-
* each with its own unique set of selectable attributes, with attribute extendability.
5-
* The Front-End modules allow you to build powerful listing and filtering of the
6-
* data in each collection.
3+
* This file is part of MetaModels/filter_range.
74
*
8-
* @package MetaModels
9-
* @subpackage FilterRange
5+
* (c) 2012-2019 The MetaModels team.
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*
10+
* This project is provided in good faith and hope to be usable by anyone.
11+
*
12+
* @package MetaModels/filter_range
1013
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1114
* @author Stefan Heimes <stefan_heimes@hotmail.com>
1215
* @author David Molineus <david.molineus@netzmacht.de>
13-
* @copyright 2015 The MetaModels team.
14-
* @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0
16+
* @copyright 2012-2019 The MetaModels team.
17+
* @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0-or-later
1518
* @filesource
1619
*/
1720

@@ -27,8 +30,6 @@
2730

2831
/**
2932
* Central event subscriber implementation.
30-
*
31-
* @package MetaModels\DcGeneral\Events\Filter\Setting\Range
3233
*/
3334
class Subscriber extends BaseSubscriber
3435
{

src/MetaModels/Filter/Setting/AbstractRange.php

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
<?php
22

33
/**
4-
* The MetaModels extension allows the creation of multiple collections of custom items,
5-
* each with its own unique set of selectable attributes, with attribute extendability.
6-
* The Front-End modules allow you to build powerful listing and filtering of the
7-
* data in each collection.
4+
* This file is part of MetaModels/filter_range.
85
*
9-
* @package MetaModels
10-
* @subpackage FilterRange
6+
* (c) 2012-2019 The MetaModels team.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* This project is provided in good faith and hope to be usable by anyone.
12+
*
13+
* @package MetaModels/filter_range
1114
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
1215
* @author Stefan Heimes <stefan_heimes@hotmail.com>
13-
* @copyright 2015 The MetaModels team.
14-
* @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0
16+
* @copyright 2012-2019 The MetaModels team.
17+
* @license https://github.com/MetaModels/filter_range/blob/master/LICENSE LGPL-3.0-or-later
1518
* @filesource
1619
*/
1720

@@ -160,14 +163,19 @@ protected function prepareWidgetLabel($objAttribute)
160163
'GET: ' . $this->getParamName()
161164
);
162165

163-
if ($this->get('fromfield') && $this->get('tofield')) {
166+
$fromField = $this->get('fromfield');
167+
$toField = $this->get('tofield');
168+
if ($fromField && $toField) {
164169
$arrLabel[0] .= ' ' . $GLOBALS['TL_LANG']['metamodels_frontendfilter']['fromto'];
165-
} elseif ($this->get('fromfield') && !$this->get('tofield')) {
170+
return $arrLabel;
171+
}
172+
if ($fromField && !$toField) {
166173
$arrLabel[0] .= ' ' . $GLOBALS['TL_LANG']['metamodels_frontendfilter']['from'];
167-
} else {
168-
$arrLabel[0] .= ' ' . $GLOBALS['TL_LANG']['metamodels_frontendfilter']['to'];
174+
return $arrLabel;
169175
}
170176

177+
$arrLabel[0] .= ' ' . $GLOBALS['TL_LANG']['metamodels_frontendfilter']['to'];
178+
171179
return $arrLabel;
172180
}
173181

@@ -192,7 +200,7 @@ protected function prepareWidgetOptions($arrIds, $objAttribute)
192200
$mixOption = strip_tags($mixOption);
193201
$mixOption = trim($mixOption);
194202

195-
if ($mixOption === '' || $mixOption === null) {
203+
if ('' === $mixOption || null === $mixOption) {
196204
unset($arrOptions[$mixKeyOption]);
197205
}
198206
}
@@ -226,13 +234,13 @@ protected function prepareWidgetParamAndFilterUrl($arrFilterUrl)
226234
if ($parameterValue && ($parameterValue[0] || $parameterValue[1])) {
227235
$privateFilterUrl[$parameterName] = $parameterValue;
228236

229-
return array($privateFilterUrl, $parameterValue);
230-
} else {
231-
// No values given, clear the array.
232-
$parameterValue = null;
233-
234237
return array($privateFilterUrl, $parameterValue);
235238
}
239+
240+
// No values given, clear the array.
241+
$parameterValue = null;
242+
243+
return array($privateFilterUrl, $parameterValue);
236244
}
237245

238246
return array($privateFilterUrl, $parameterValue);
@@ -262,7 +270,7 @@ protected function getFilterWidgetParameters(IAttribute $attribute, $currentValu
262270
'size' => ($this->get('fromfield') && $this->get('tofield') ? 2 : 1),
263271
'urlparam' => $this->getParamName(),
264272
'template' => $this->get('template'),
265-
'colname' => $attribute->getColname(),
273+
'colname' => $attribute->getColName(),
266274
),
267275
// We need to implode to have it transported correctly in the frontend filter.
268276
'urlvalue' => !empty($currentValue) ? implode('__', $currentValue) : ''
@@ -271,9 +279,6 @@ protected function getFilterWidgetParameters(IAttribute $attribute, $currentValu
271279

272280
/**
273281
* {@inheritdoc}
274-
*
275-
* @SuppressWarnings(PHPMD.Superglobals)
276-
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
277282
*/
278283
public function getParameterFilterWidgets(
279284
$arrIds,

0 commit comments

Comments
 (0)