Update git config files and apply coding standard.

This commit is contained in:
David Molineus
2017-10-04 11:05:44 +02:00
parent 1964dab9e8
commit f4fc8c9fe5
13 changed files with 123 additions and 42 deletions

10
.gitattributes vendored Normal file
View File

@@ -0,0 +1,10 @@
.check-author.yml export-ignore
.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore
.travis.yml export-ignore
build.default.properties export-ignore
build.xml export-ignore
phpunit.xml.dist export-ignore
/tests export-ignore
/specs export-ignore

30
.gitignore vendored
View File

@@ -1,10 +1,24 @@
/vendor/ # OS
/bin/ .DS_Store
/demo/ Thumbs.db
/assets/js/*.js .directory
/node_modules/
/.tx/
coverage.xml # IDEs
.buildpath
.project
.settings/
.build/
.external*/
.idea/
nbproject/
# composer related
vendor/
composer.lock composer.lock
npm-debug.log
# build
build/
build.properties
# Translations
.tx

28
.travis.yml Normal file
View File

@@ -0,0 +1,28 @@
language: php
php:
- "5.6"
- "7.0"
- "7.1"
env:
- CONTAO_VERSION=contao/core-bundle ^4.4.2
matrix:
exclude:
sudo: false
install:
- travis_retry composer self-update && composer --version
- travis_retry composer require $CONTAO_VERSION --no-update
- travis_retry composer update --prefer-dist --no-interaction
script: ant -keep-going
git:
depth: 2147483647
cache:
directories:
- vendor

4
build.default.properties Normal file
View File

@@ -0,0 +1,4 @@
phpcs.standard=${basedir}/vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/ruleset.xml
phpmd.ruleset=${basedir}/vendor/phpcq/coding-standard/phpmd/ruleset.xml
phpcs.excluded = src/Resources/contao/languages
phpcpd.excluded = contao

5
build.xml Normal file
View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="contao-bootstrap/grid" default="build">
<!-- import the main build system -->
<import file="vendor/phpcq/phpcq/phpcq.main.xml" />
</project>

View File

@@ -24,17 +24,13 @@
"source": "https://github.com/contao-bootstrap/core" "source": "https://github.com/contao-bootstrap/core"
}, },
"require": { "require": {
"php": ">=5.5.0", "php": ">=5.6.0",
"contao/core-bundle": "^4.4.2", "contao/core-bundle": "~4.4.0",
"contao-community-alliance/composer-plugin": "~2.4 || ~3.0",
"netzmacht/contao-leaflet-libraries": "~1.0" "netzmacht/contao-leaflet-libraries": "~1.0"
}, },
"require-dev": { "require-dev": {
"netzmacht/contao-build-tools": "~1.1", "contao/manager-plugin": "^2.0",
"contao/manager-plugin": "^2.0" "phpcq/all-tasks": "^1.2"
},
"conflict": {
"contao/manager-plugin": "<2.0 || >=3.0"
}, },
"suggest": { "suggest": {
"netzmacht/contao-leaflet-maps": "Leaflet Maps for Contao" "netzmacht/contao-leaflet-maps": "Leaflet Maps for Contao"
@@ -50,7 +46,5 @@
"dev-develop": "1.1.x-dev" "dev-develop": "1.1.x-dev"
}, },
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\GeocodeWidget\\ContaoManager\\Plugin" "contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\GeocodeWidget\\ContaoManager\\Plugin"
}, }
"minimum-stability": "dev",
"prefer-stable": true
} }

View File

@@ -1,11 +1,13 @@
<?php <?php
/** /**
* Geocode backend widget based on Leaflet.
*
* @package netzmacht * @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2017 netzmacht David Molineus. All rights reserved. * @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
* @filesource * @filesource
*
*/ */
namespace Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager; namespace Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager;
@@ -17,7 +19,7 @@ use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Netzmacht\Contao\Leaflet\GeocodeWidget\LeafletGeocodeWidgetBundle; use Netzmacht\Contao\Leaflet\GeocodeWidget\LeafletGeocodeWidgetBundle;
/** /**
* Class Plugin * Contao Manager plugin.
* *
* @package Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager * @package Netzmacht\Contao\Leaflet\GeocodeWidget\ContaoManager
*/ */

View File

@@ -1,11 +1,13 @@
<?php <?php
/** /**
* Geocode backend widget based on Leaflet.
*
* @package netzmacht * @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2017 netzmacht David Molineus. All rights reserved. * @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
* @filesource * @filesource
*
*/ */
namespace Netzmacht\Contao\Leaflet\GeocodeWidget; namespace Netzmacht\Contao\Leaflet\GeocodeWidget;
@@ -51,6 +53,8 @@ class GeocodeWidget extends \Widget
* @param mixed $value Given value. * @param mixed $value Given value.
* *
* @return mixed * @return mixed
*
* @SuppressWarnings(PHPMD.Superglobals)
*/ */
protected function validator($value) protected function validator($value)
{ {
@@ -60,13 +64,11 @@ class GeocodeWidget extends \Widget
return $value; return $value;
} }
if ( // See: http://stackoverflow.com/a/18690202
// See: http://stackoverflow.com/a/18690202 if (!preg_match(
!preg_match( '#^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,[-+]?\d+)?$#',
'#^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)(,[-+]?\d+)?$#', $value
$value )) {
)
) {
$this->addError( $this->addError(
sprintf( sprintf(
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'], $GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'],

View File

@@ -1,11 +1,13 @@
<?php <?php
/** /**
* Geocode backend widget based on Leaflet.
*
* @package netzmacht * @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2017 netzmacht David Molineus. All rights reserved. * @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
* @filesource * @filesource
*
*/ */
namespace Netzmacht\Contao\Leaflet\GeocodeWidget; namespace Netzmacht\Contao\Leaflet\GeocodeWidget;

View File

@@ -1,11 +1,13 @@
<?php <?php
/** /**
* Geocode backend widget based on Leaflet.
*
* @package netzmacht * @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2017 netzmacht David Molineus. All rights reserved. * @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
* @filesource * @filesource
*
*/ */
$GLOBALS['BE_FFL']['leaflet_geocode'] = 'Netzmacht\Contao\Leaflet\GeocodeWidget\GeocodeWidget'; $GLOBALS['BE_FFL']['leaflet_geocode'] = 'Netzmacht\Contao\Leaflet\GeocodeWidget\GeocodeWidget';

View File

@@ -1,11 +1,13 @@
<?php <?php
/** /**
* Geocode backend widget based on Leaflet.
*
* @package netzmacht * @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2017 netzmacht David Molineus. All rights reserved. * @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
* @filesource * @filesource
*
*/ */
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Die angegebenen Koordinaten sind ungültig.'; $GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Die angegebenen Koordinaten sind ungültig.';

View File

@@ -1,11 +1,13 @@
<?php <?php
/** /**
* Geocode backend widget based on Leaflet.
*
* @package netzmacht * @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2017 netzmacht David Molineus. All rights reserved. * @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
* @filesource * @filesource
*
*/ */
$GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Invalid coordinates given.'; $GLOBALS['TL_LANG']['ERR']['leafletInvalidCoordinate'] = 'Invalid coordinates given.';

View File

@@ -1,3 +1,13 @@
/**
* Geocode backend widget based on Leaflet.
*
* @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2016-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-geocode-widget/blob/master/LICENSE
* @filesource
*/
var LeafletGeocodeWidget = L.Class.extend({ var LeafletGeocodeWidget = L.Class.extend({
options: { options: {
mapTemplate: '<div id="leaflet_geocode_widget_map_{id}" class="" style="width 100%; height: 50vh; min-height: 400px"></div>', mapTemplate: '<div id="leaflet_geocode_widget_map_{id}" class="" style="width 100%; height: 50vh; min-height: 400px"></div>',
@@ -31,8 +41,12 @@ var LeafletGeocodeWidget = L.Class.extend({
'hideFooter': true, 'hideFooter': true,
'draggable': false, 'draggable': false,
'overlayOpacity': .5, 'overlayOpacity': .5,
'onShow': function() { document.body.setStyle('overflow', 'hidden'); }, 'onShow': function () {
'onHide': function() { document.body.setStyle('overflow', 'auto'); } document.body.setStyle('overflow', 'hidden');
},
'onHide': function () {
document.body.setStyle('overflow', 'auto');
}
}); });
}, },
_createMap: function (modal) { _createMap: function (modal) {
@@ -69,7 +83,7 @@ var LeafletGeocodeWidget = L.Class.extend({
link.set('style', 'margin-left: 10px;'); link.set('style', 'margin-left: 10px;');
link.appendText(this.options.applyPositionLabel); link.appendText(this.options.applyPositionLabel);
link.addEvent('click', function(e) { link.addEvent('click', function (e) {
e.stop(); e.stop();
this.element.set('value', result.center.lat + ',' + result.center.lng); this.element.set('value', result.center.lat + ',' + result.center.lng);