mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2026-01-16 20:35:19 +01:00
Convert array syntax and other minor code style adjustments.
This commit is contained in:
@@ -48,10 +48,10 @@ class About
|
||||
return array_map(
|
||||
function ($library) {
|
||||
$library = array_merge(
|
||||
array(
|
||||
[
|
||||
'homepage' => null,
|
||||
'version' => null,
|
||||
),
|
||||
],
|
||||
$library
|
||||
);
|
||||
|
||||
@@ -86,30 +86,30 @@ class About
|
||||
$lockFile = TL_ROOT . '/composer.lock';
|
||||
|
||||
if (!file_exists($extFile) || !file_exists($lockFile)) {
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
$extension = json_decode(file_get_contents($extFile), true);
|
||||
$installed = json_decode(file_get_contents($lockFile), true);
|
||||
$deps = array();
|
||||
$deps = [];
|
||||
$version = null;
|
||||
|
||||
foreach ($installed['packages'] as $package) {
|
||||
if ($package['name'] === 'netzmacht/contao-leaflet-maps') {
|
||||
$version = $package['version'];
|
||||
} elseif (isset($extension['require'][$package['name']])) {
|
||||
$deps[] = array(
|
||||
$deps[] = [
|
||||
'name' => $package['name'],
|
||||
'version' => $package['version'],
|
||||
'license' => !empty($package['license']) ? implode(', ', $package['license']) : '',
|
||||
'homepage' => sprintf(
|
||||
'<a href="https://packagist.org/packages/%s" target="_blank">Visit packagist</a>',
|
||||
$package['name']
|
||||
)
|
||||
);
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return array($version, $deps);
|
||||
return [$version, $deps];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class Plugin implements BundlePluginInterface
|
||||
return [
|
||||
BundleConfig::create(NetzmachtContaoLeafletBundle::class)
|
||||
->setLoadAfter([ContaoCoreBundle::class, NetzmachtContaoToolkitBundle::class])
|
||||
->setReplace(['leaflet'])
|
||||
->setReplace(['leaflet']),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,42 +17,36 @@
|
||||
array_insert(
|
||||
$GLOBALS['BE_MOD'],
|
||||
1,
|
||||
array(
|
||||
'leaflet' => array
|
||||
(
|
||||
'leaflet_map' => array
|
||||
(
|
||||
'tables' => array
|
||||
(
|
||||
[
|
||||
'leaflet' => [
|
||||
'leaflet_map' => [
|
||||
'tables' => [
|
||||
'tl_leaflet_map',
|
||||
'tl_leaflet_control',
|
||||
),
|
||||
],
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/map.png',
|
||||
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/backend.css',
|
||||
),
|
||||
'leaflet_layer' => array
|
||||
(
|
||||
'tables' => array
|
||||
(
|
||||
],
|
||||
'leaflet_layer' => [
|
||||
'tables' => [
|
||||
'tl_leaflet_layer',
|
||||
'tl_leaflet_marker',
|
||||
'tl_leaflet_vector',
|
||||
'tl_leaflet_icon',
|
||||
'tl_leaflet_style',
|
||||
'tl_leaflet_popup',
|
||||
),
|
||||
],
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/layers.png',
|
||||
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/backend.css',
|
||||
'javascript' => 'bundles/netzmachtcontaoleaflet/js/backend.js'
|
||||
),
|
||||
'leaflet_about' => array
|
||||
(
|
||||
'javascript' => 'bundles/netzmachtcontaoleaflet/js/backend.js',
|
||||
],
|
||||
'leaflet_about' => [
|
||||
'callback' => Netzmacht\Contao\Leaflet\Backend\About::class,
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/about.png',
|
||||
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/about.css',
|
||||
)
|
||||
)
|
||||
)
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -74,5 +68,5 @@ $GLOBALS['TL_MODELS']['tl_leaflet_vector'] = \Netzmacht\Contao\Leaflet\Model\Ve
|
||||
|
||||
$GLOBALS['TL_HOOKS']['initializeSystem'][] = [
|
||||
'netzmacht.contao_leaflet.listeners.register_libraries',
|
||||
'onInitializeSystem'
|
||||
'onInitializeSystem',
|
||||
];
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<div class="netzmacht-leaflet-credits">
|
||||
<div class="header">
|
||||
<h1 class="sub_headline"><?php echo $this->headline; ?> <small><?php echo $this->version; ?></small></h1>
|
||||
<h1 class="sub_headline"><?php echo $this->headline; ?>
|
||||
<small><?php echo $this->version; ?></small>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="tl_box block row">
|
||||
@@ -11,9 +13,11 @@
|
||||
This extension is only exists because of great other Open Source Software which it heavenly depends on.
|
||||
</p>
|
||||
<p>
|
||||
This software ships with an visible attribution to <em>netzmacht creative</em> in the map attribution control.
|
||||
This software ships with an visible attribution to <em>netzmacht creative</em> in the map attribution
|
||||
control.
|
||||
If you want to remove this attribution, you have to purchase a commercial license.
|
||||
For more details visit the <a href="https://netzmacht.de/contao-leaflet" target="_blank">project website</a>.
|
||||
For more details visit the <a href="https://netzmacht.de/contao-leaflet" target="_blank">project
|
||||
website</a>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="right">
|
||||
@@ -31,7 +35,8 @@
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||
<input type="hidden" name="cmd" value="_s-xclick">
|
||||
<input type="hidden" name="hosted_button_id" value="YWMA95YS3FT6U">
|
||||
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
|
||||
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0"
|
||||
name="submit" alt="PayPal – The safer, easier way to pay online.">
|
||||
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
|
||||
</form>
|
||||
</div>
|
||||
@@ -44,19 +49,23 @@
|
||||
<div class="col">
|
||||
<h3>Report issues</h3>
|
||||
<p>If you found a bug, got some troubles or have a feature request - feel free to open an issue.</p>
|
||||
<p><a href="http://github.com/netzmacht/contao-leaflet-maps/issues" class="btn" target="_blank">Issue tracker</a> </p>
|
||||
<p><a href="http://github.com/netzmacht/contao-leaflet-maps/issues" class="btn" target="_blank">Issue
|
||||
tracker</a></p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h3>Contribute</h3>
|
||||
<p>There are many ways you can con­tribute. Translations,
|
||||
docu­mentation or code contributions are welcome.
|
||||
</p>
|
||||
<p><a href="https://netzmacht/contao-leaflet/contribute.html" class="btn" target="_blank">Contribute</a> </p>
|
||||
<p><a href="https://netzmacht/contao-leaflet/contribute.html" class="btn" target="_blank">Contribute</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h3>Fund a feature</h3>
|
||||
<p>Contao Leaflet is not feature complete. Have a look at the list of planned feature and support them.</p>
|
||||
<p><a href="https://netzmacht/contao-leaflet/planned-features.html" class="btn" target="_blank">Planned features</a> </p>
|
||||
<p>Contao Leaflet is not feature complete. Have a look at the list of planned feature and support
|
||||
them.</p>
|
||||
<p><a href="https://netzmacht/contao-leaflet/planned-features.html" class="btn" target="_blank">Planned
|
||||
features</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -68,8 +77,10 @@
|
||||
</div>
|
||||
<div class="col">
|
||||
<h3>Commercial license</h3>
|
||||
<p>If you want to remove the attribution in the attribution control, you can purchase a commercial license.</p>
|
||||
<p><a href="https://netzmacht/contao-leaflet/commercial-license.html" class="btn" target="_blank">Purchase license</a> </p>
|
||||
<p>If you want to remove the attribution in the attribution control, you can purchase a commercial
|
||||
license.</p>
|
||||
<p><a href="https://netzmacht/contao-leaflet/commercial-license.html" class="btn" target="_blank">Purchase
|
||||
license</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -84,7 +95,9 @@
|
||||
<th>Homepage</th>
|
||||
</tr>
|
||||
<?php if ($this->libraries): ?>
|
||||
<tr><th colspan="4" class="subtitle">Libraries</th> </tr>
|
||||
<tr>
|
||||
<th colspan="4" class="subtitle">Libraries</th>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($this->libraries as $library): ?>
|
||||
<tr>
|
||||
@@ -110,7 +123,9 @@
|
||||
<td><a href="http://semlabs.co.uk/" target="_blank">semlabs.co.uk</a></td>
|
||||
</tr>
|
||||
<?php if ($this->dependencies): ?>
|
||||
<tr><th colspan="4" class="subtitle">Dependencies</th> </tr>
|
||||
<tr>
|
||||
<th colspan="4" class="subtitle">Dependencies</th>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($this->dependencies as $dep): ?>
|
||||
<tr>
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
|
||||
.netzmacht-leaflet-credits a {
|
||||
color: #669A00;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class ContaoAssets implements Assets
|
||||
private $cache = [
|
||||
'stylesheets' => [],
|
||||
'javascripts' => [],
|
||||
'map' => []
|
||||
'map' => [],
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ class BboxFilter implements Filter
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return array('bounds' => $this->bounds);
|
||||
return ['bounds' => $this->bounds];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -88,9 +88,9 @@ class DistanceFilter implements Filter
|
||||
*/
|
||||
public function getValues()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
'radius' => $this->radius,
|
||||
'center' => $this->center
|
||||
);
|
||||
'center' => $this->center,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@ class DataController
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $input = array(
|
||||
private $input = [
|
||||
'format' => 'geojson',
|
||||
'type' => 'layer',
|
||||
'id' => null,
|
||||
'filter' => null,
|
||||
'values' => null
|
||||
);
|
||||
'values' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* Debug mode.
|
||||
@@ -140,9 +140,9 @@ class DataController
|
||||
default:
|
||||
$error = true;
|
||||
|
||||
return array($data, $error);
|
||||
return [$data, $error];
|
||||
}
|
||||
|
||||
return array($data, $error);
|
||||
return [$data, $error];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,12 +57,12 @@ class RequestUrl implements \JsonSerializable
|
||||
*/
|
||||
public static function create($dataId, $type = null, $format = null, Request $request = null)
|
||||
{
|
||||
$params = array(
|
||||
$params = [
|
||||
'for' => $request ? $request->getMapIdentifier() : null,
|
||||
'type' => $type != 'layer' ? $type : null,
|
||||
'id' => $dataId,
|
||||
'format' => $format != 'geojson' ? $format : null
|
||||
);
|
||||
'format' => $format != 'geojson' ? $format : null,
|
||||
];
|
||||
|
||||
$hash = base64_encode(implode(',', $params));
|
||||
$query = 'leaflet=' . $hash;
|
||||
|
||||
@@ -110,7 +110,7 @@ class ControlDcaListener extends AbstractListener
|
||||
*/
|
||||
public function getZoomControls()
|
||||
{
|
||||
$collection = ControlModel::findBy('type', 'zoom', array('order' => 'title'));
|
||||
$collection = ControlModel::findBy('type', 'zoom', ['order' => 'title']);
|
||||
|
||||
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
||||
}
|
||||
@@ -166,7 +166,7 @@ class ControlDcaListener extends AbstractListener
|
||||
'lid' => $layer['layer'],
|
||||
'cid' => $dataContainer->id,
|
||||
'mode' => $layer['mode'],
|
||||
'sorting' => $sorting
|
||||
'sorting' => $sorting,
|
||||
];
|
||||
|
||||
$this->connection->insert('tl_leaflet_control_layer', $data);
|
||||
@@ -177,10 +177,10 @@ class ControlDcaListener extends AbstractListener
|
||||
[
|
||||
'tstamp' => time(),
|
||||
'sorting' => $sorting,
|
||||
'mode' => $layer['mode']
|
||||
'mode' => $layer['mode'],
|
||||
],
|
||||
[
|
||||
'id' => $values[$layer['layer']]['id']
|
||||
'id' => $values[$layer['layer']]['id'],
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ class LayerDcaListener extends AbstractListener
|
||||
return $this->tileProviders[$dataContainer->activeRecord->tile_provider]['variants'];
|
||||
}
|
||||
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,7 +365,7 @@ class LayerDcaListener extends AbstractListener
|
||||
*/
|
||||
public function getBoundsModes($dataContainer)
|
||||
{
|
||||
$options = array();
|
||||
$options = [];
|
||||
|
||||
if ($dataContainer->activeRecord && !empty($this->layers[$dataContainer->activeRecord->type]['boundsMode'])) {
|
||||
foreach ($this->layers[$dataContainer->activeRecord->type]['boundsMode'] as $mode => $enabled) {
|
||||
@@ -413,7 +413,7 @@ class LayerDcaListener extends AbstractListener
|
||||
*/
|
||||
public function getIcons()
|
||||
{
|
||||
$collection = IconModel::findAll(array('order' => 'title'));
|
||||
$collection = IconModel::findAll(['order' => 'title']);
|
||||
$builder = OptionsBuilder::fromCollection(
|
||||
$collection,
|
||||
function ($model) {
|
||||
|
||||
@@ -100,8 +100,8 @@ class LeafletDcaListener
|
||||
*/
|
||||
public function getLayers()
|
||||
{
|
||||
$options = array();
|
||||
$collection = LayerModel::findBy('pid', '0', array('order' => 'title'));
|
||||
$options = [];
|
||||
$collection = LayerModel::findBy('pid', '0', ['order' => 'title']);
|
||||
|
||||
if ($collection) {
|
||||
foreach ($collection as $model) {
|
||||
|
||||
@@ -90,7 +90,7 @@ class MapDcaListener extends AbstractListener
|
||||
public function saveLayerRelations($layerId, $dataContainer)
|
||||
{
|
||||
$new = array_filter(StringUtil::deserialize($layerId, true));
|
||||
$values = array();
|
||||
$values = [];
|
||||
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
|
||||
|
||||
$statement->bindValue('mid', $dataContainer->id);
|
||||
@@ -108,7 +108,7 @@ class MapDcaListener extends AbstractListener
|
||||
'tstamp' => time(),
|
||||
'lid' => $layerId,
|
||||
'mid' => $dataContainer->id,
|
||||
'sorting' => $sorting
|
||||
'sorting' => $sorting,
|
||||
];
|
||||
|
||||
$this->connection->insert('tl_leaflet_map_layer', $data);
|
||||
|
||||
@@ -71,7 +71,7 @@ class MarkerDcaListener
|
||||
*/
|
||||
public function getIcons()
|
||||
{
|
||||
$collection = IconModel::findAll(array('order' => 'title'));
|
||||
$collection = IconModel::findAll(['order' => 'title']);
|
||||
$builder = OptionsBuilder::fromCollection(
|
||||
$collection,
|
||||
function ($model) {
|
||||
@@ -89,7 +89,7 @@ class MarkerDcaListener
|
||||
*/
|
||||
public function getPopups()
|
||||
{
|
||||
$collection = PopupModel::findAll(array('order' => 'title'));
|
||||
$collection = PopupModel::findAll(['order' => 'title']);
|
||||
$builder = OptionsBuilder::fromCollection($collection, 'title');
|
||||
|
||||
return $builder->getOptions();
|
||||
@@ -105,11 +105,11 @@ class MarkerDcaListener
|
||||
*/
|
||||
public function saveCoordinates($value, $dataContainer)
|
||||
{
|
||||
$combined = array(
|
||||
$combined = [
|
||||
'latitude' => null,
|
||||
'longitude' => null,
|
||||
'altitude' => null
|
||||
);
|
||||
'altitude' => null,
|
||||
];
|
||||
|
||||
$values = trimsplit(',', $value);
|
||||
$keys = array_keys($combined);
|
||||
|
||||
@@ -86,7 +86,7 @@ class VectorDcaListener extends AbstractListener
|
||||
*/
|
||||
public function getStyles()
|
||||
{
|
||||
$collection = StyleModel::findAll(array('order' => 'title'));
|
||||
$collection = StyleModel::findAll(['order' => 'title']);
|
||||
|
||||
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
|
||||
}
|
||||
@@ -98,7 +98,7 @@ class VectorDcaListener extends AbstractListener
|
||||
*/
|
||||
public function getIcons()
|
||||
{
|
||||
$collection = IconModel::findAll(array('order' => 'title'));
|
||||
$collection = IconModel::findAll(['order' => 'title']);
|
||||
$builder = OptionsBuilder::fromCollection(
|
||||
$collection,
|
||||
function ($model) {
|
||||
@@ -116,7 +116,7 @@ class VectorDcaListener extends AbstractListener
|
||||
*/
|
||||
public function getPopups()
|
||||
{
|
||||
$collection = PopupModel::findAll(array('order' => 'title'));
|
||||
$collection = PopupModel::findAll(['order' => 'title']);
|
||||
$builder = OptionsBuilder::fromCollection($collection, 'title');
|
||||
|
||||
return $builder->getOptions();
|
||||
|
||||
@@ -123,7 +123,7 @@ final class GeoJsonListener
|
||||
public function enrichCircle(GeoJsonObject $feature, LeafletDefinition $definition)
|
||||
{
|
||||
if ($definition instanceof Circle && !$definition instanceof CircleMarker && $feature instanceof Feature) {
|
||||
$feature->setProperty('arguments', array($definition->getLatLng(), $definition->getRadius()));
|
||||
$feature->setProperty('arguments', [$definition->getLatLng(), $definition->getRadius()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ final class GeoJsonListener
|
||||
if ($collection) {
|
||||
$value = $collection->fetchEach('path');
|
||||
} else {
|
||||
$value = array();
|
||||
$value = [];
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -27,12 +27,12 @@ class HashSubscriber implements EventSubscriberInterface
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
GetHashEvent::NAME => array(
|
||||
array('getModelHash'),
|
||||
array('getFallback', -100)
|
||||
)
|
||||
);
|
||||
return [
|
||||
GetHashEvent::NAME => [
|
||||
['getModelHash'],
|
||||
['getFallback', -100],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -202,7 +202,7 @@ class MapProvider
|
||||
$cacheKey,
|
||||
[
|
||||
'assets' => $this->assets->toArray(),
|
||||
'javascript' => $buffer
|
||||
'javascript' => $buffer,
|
||||
],
|
||||
(int) $model->cacheLifeTime
|
||||
);
|
||||
@@ -279,7 +279,7 @@ class MapProvider
|
||||
throw new \RuntimeException('Bad request. Could not resolve query params');
|
||||
}
|
||||
|
||||
$data = array_combine(array('for', 'type', 'id', 'format', 'filter', 'values'), $data);
|
||||
$data = array_combine(['for', 'type', 'id', 'format', 'filter', 'values'], $data);
|
||||
$data = array_filter($data);
|
||||
|
||||
if (empty($data['for']) || $data['for'] != $identifier) {
|
||||
|
||||
@@ -156,9 +156,9 @@ abstract class AbstractMapper implements Mapper
|
||||
Request $request = null,
|
||||
$elementId = null
|
||||
) {
|
||||
return array(
|
||||
$this->getElementId($model, $elementId)
|
||||
);
|
||||
return [
|
||||
$this->getElementId($model, $elementId),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,8 +49,8 @@ class LayersControlMapper extends AbstractControlMapper
|
||||
$elementId = null
|
||||
) {
|
||||
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||
$arguments[1] = array();
|
||||
$arguments[2] = array();
|
||||
$arguments[1] = [];
|
||||
$arguments[2] = [];
|
||||
|
||||
/** @var ControlModel $model */
|
||||
$collection = $model->findActiveLayers();
|
||||
|
||||
@@ -80,8 +80,8 @@ class LoadingControlMapper extends AbstractControlMapper
|
||||
if ($definition instanceof LoadingControl && !$definition->isSeparate() && $model->zoomControl) {
|
||||
// Only assign if zoom control is activated and part of the map.
|
||||
$control = ControlModel::findOneBy(
|
||||
array('active=1', 'type=?', 'pid=?', 'id=?'),
|
||||
array('zoom', $model->pid, $model->zoomControl)
|
||||
['active=1', 'type=?', 'pid=?', 'id=?'],
|
||||
['zoom', $model->pid, $model->zoomControl]
|
||||
);
|
||||
|
||||
if ($control) {
|
||||
|
||||
@@ -34,7 +34,7 @@ class DefinitionMapper
|
||||
*
|
||||
* @var Mapper[][]
|
||||
*/
|
||||
private $mappers = array();
|
||||
private $mappers = [];
|
||||
|
||||
/**
|
||||
* The event dispatcher.
|
||||
@@ -48,7 +48,7 @@ class DefinitionMapper
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $mapped = array();
|
||||
private $mapped = [];
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
@@ -84,7 +84,7 @@ class DefinitionMapper
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->mapped = array();
|
||||
$this->mapped = [];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ class GroupLayerMapper extends AbstractLayerMapper
|
||||
}
|
||||
|
||||
$collection = LayerModel::findBy(
|
||||
array('pid=?', 'active=1'),
|
||||
array($model->id),
|
||||
array('order' => 'sorting')
|
||||
['pid=?', 'active=1'],
|
||||
[$model->id],
|
||||
['order' => 'sorting']
|
||||
);
|
||||
|
||||
if ($collection) {
|
||||
|
||||
@@ -108,9 +108,9 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
|
||||
}
|
||||
|
||||
$collection = LayerModel::findBy(
|
||||
array('pid=?', 'active=1'),
|
||||
array($model->id),
|
||||
array('order' => 'sorting')
|
||||
['pid=?', 'active=1'],
|
||||
[$model->id],
|
||||
['order' => 'sorting']
|
||||
);
|
||||
|
||||
if ($collection) {
|
||||
|
||||
@@ -71,18 +71,18 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
||||
$layer->setOption('boundsMode', $model->boundsMode);
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
$this->getElementId($model, $elementId),
|
||||
RequestUrl::create($model->id, null, null, $request),
|
||||
array(),
|
||||
$layer
|
||||
);
|
||||
[],
|
||||
$layer,
|
||||
];
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
$this->getElementId($model, $elementId),
|
||||
RequestUrl::create($model->id, null, null, $request)
|
||||
);
|
||||
RequestUrl::create($model->id, null, null, $request),
|
||||
];
|
||||
}
|
||||
|
||||
return parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||
|
||||
@@ -92,10 +92,10 @@ class ProviderLayerMapper extends AbstractLayerMapper
|
||||
Request $request = null,
|
||||
$elementId = null
|
||||
) {
|
||||
return array(
|
||||
return [
|
||||
$model->alias ?: ('layer_' . $model->id),
|
||||
$model->tile_provider,
|
||||
$model->tile_provider_variant ?: null
|
||||
);
|
||||
$model->tile_provider_variant ?: null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
||||
$elementId = null
|
||||
) {
|
||||
if ($model->deferred) {
|
||||
$options = array();
|
||||
$options = [];
|
||||
|
||||
if ($model->pointToLayer) {
|
||||
$options['pointToLayer'] = new Expression($model->pointToLayer);
|
||||
@@ -79,18 +79,18 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
||||
$layer = new GeoJson($this->getElementId($model, $elementId));
|
||||
$layer->setOptions($options);
|
||||
|
||||
return array(
|
||||
return [
|
||||
$this->getElementId($model, $elementId),
|
||||
RequestUrl::create($model->id, null, null, $request),
|
||||
array(),
|
||||
$layer
|
||||
);
|
||||
[],
|
||||
$layer,
|
||||
];
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
$this->getElementId($model, $elementId),
|
||||
RequestUrl::create($model->id, null, null, $request)
|
||||
);
|
||||
RequestUrl::create($model->id, null, null, $request),
|
||||
];
|
||||
}
|
||||
|
||||
return parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||
|
||||
@@ -50,8 +50,8 @@ class MapMapper extends AbstractMapper
|
||||
->addOptions('center', 'zoom', 'zoomControl')
|
||||
->addOptions('dragging', 'touchZoom', 'scrollWheelZoom', 'doubleClickZoom', 'boxZoom', 'tap', 'keyboard')
|
||||
->addOptions('trackResize', 'closeOnClick', 'bounceAtZoomLimits')
|
||||
->addConditionalOptions('adjustZoomExtra', array('minZoom', 'maxZoom', 'zoomSnap', 'zoomDelta'))
|
||||
->addConditionalOptions('keyboard', array('keyboardPanOffset', 'keyboardZoomOffset'));
|
||||
->addConditionalOptions('adjustZoomExtra', ['minZoom', 'maxZoom', 'zoomSnap', 'zoomDelta'])
|
||||
->addConditionalOptions('keyboard', ['keyboardPanOffset', 'keyboardZoomOffset']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,10 +82,10 @@ class MapMapper extends AbstractMapper
|
||||
Request $request = null,
|
||||
$elementId = null
|
||||
) {
|
||||
return array(
|
||||
return [
|
||||
$this->getElementId($model, $elementId),
|
||||
$this->getElementId($model, $elementId)
|
||||
);
|
||||
$this->getElementId($model, $elementId),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ class MapMapper extends AbstractMapper
|
||||
*/
|
||||
private function buildControls(Map $map, MapModel $model, DefinitionMapper $mapper, Request $request = null)
|
||||
{
|
||||
$collection = ControlModel::findActiveBy('pid', $model->id, array('order' => 'sorting'));
|
||||
$collection = ControlModel::findActiveBy('pid', $model->id, ['order' => 'sorting']);
|
||||
|
||||
if (!$collection) {
|
||||
return;
|
||||
@@ -207,13 +207,13 @@ class MapMapper extends AbstractMapper
|
||||
private function buildLocate(Map $map, MapModel $model)
|
||||
{
|
||||
if ($model->locate) {
|
||||
$options = array();
|
||||
$options = [];
|
||||
|
||||
$mapping = array(
|
||||
$mapping = [
|
||||
'setView' => 'locateSetView',
|
||||
'watch' => 'locateWatch',
|
||||
'enableHighAccuracy' => 'enableHighAccuracy',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($mapping as $option => $property) {
|
||||
if ($model->$property) {
|
||||
@@ -221,11 +221,11 @@ class MapMapper extends AbstractMapper
|
||||
}
|
||||
}
|
||||
|
||||
$mapping = array(
|
||||
$mapping = [
|
||||
'maxZoom' => 'locateMaxZoom',
|
||||
'timeout' => 'locateTimeout',
|
||||
'maximumAge' => 'locateMaximumAge',
|
||||
);
|
||||
];
|
||||
|
||||
foreach ($mapping as $option => $property) {
|
||||
if ($model->$property) {
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper;
|
||||
|
||||
use Contao\Model;
|
||||
@@ -30,14 +31,14 @@ class OptionsBuilder
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $options = array();
|
||||
private $options = [];
|
||||
|
||||
/**
|
||||
* Conditional option mapping.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $conditional = array();
|
||||
private $conditional = [];
|
||||
|
||||
/**
|
||||
* Add a option mapping.
|
||||
@@ -253,7 +254,7 @@ class OptionsBuilder
|
||||
*/
|
||||
private static function getDefaultOption($option, $definition)
|
||||
{
|
||||
$keys = array('has', 'is', 'get');
|
||||
$keys = ['has', 'is', 'get'];
|
||||
$suffix = ucfirst($option);
|
||||
|
||||
foreach ($keys as $key) {
|
||||
|
||||
@@ -48,7 +48,7 @@ class FixedStyleMapper extends AbstractStyleMapper
|
||||
->addConditionalOption('lineCap')
|
||||
->addConditionalOption('lineJoin')
|
||||
->addConditionalOption('dashArray')
|
||||
->addConditionalOptions('fill', array('fillColor', 'fillOpacity'))
|
||||
->addConditionalOptions('fill', ['fillColor', 'fillOpacity'])
|
||||
->addOption('fill');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,14 +95,14 @@ class ImageIconMapper extends AbstractIconMapper
|
||||
$definition->setIconUrl($file->path);
|
||||
|
||||
$file = new \File($file->path);
|
||||
$definition->setIconSize(array($file->width, $file->height));
|
||||
$definition->setIconSize([$file->width, $file->height]);
|
||||
|
||||
if (!$model->iconAnchor) {
|
||||
$definition->setIconAnchor(array($file->width / 2, $file->height));
|
||||
$definition->setIconAnchor([($file->width / 2), $file->height]);
|
||||
}
|
||||
|
||||
if (!$model->popupAnchor) {
|
||||
$definition->setPopupAnchor(array(0, 8 - $file->height));
|
||||
$definition->setPopupAnchor([0, (8 - $file->height)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,10 +137,10 @@ class ImageIconMapper extends AbstractIconMapper
|
||||
$definition->setShadowUrl($file->path);
|
||||
|
||||
$file = new \File($file->path);
|
||||
$definition->setShadowSize(array($file->width, $file->height));
|
||||
$definition->setShadowSize([$file->width, $file->height]);
|
||||
|
||||
if (!$model->shadowAnchor) {
|
||||
$definition->setShadowAnchor(array($file->width / 2, $file->height));
|
||||
$definition->setShadowAnchor([($file->width / 2), $file->height]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class MarkerMapper extends AbstractMapper
|
||||
$elementId = null
|
||||
) {
|
||||
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||
$arguments[] = array($model->latitude, $model->longitude, $model->altitude ?: null) ?: null;
|
||||
$arguments[] = [$model->latitude, $model->longitude, $model->altitude ?: null] ?: null;
|
||||
|
||||
return $arguments;
|
||||
}
|
||||
@@ -124,9 +124,9 @@ class MarkerMapper extends AbstractMapper
|
||||
|
||||
if ($model->customIcon) {
|
||||
$iconModel = IconModel::findBy(
|
||||
array('id=?', 'active=1'),
|
||||
array($model->icon),
|
||||
array('return' => 'Model')
|
||||
['id=?', 'active=1'],
|
||||
[$model->icon],
|
||||
['return' => 'Model']
|
||||
);
|
||||
|
||||
if ($iconModel) {
|
||||
|
||||
@@ -29,7 +29,7 @@ abstract class AbstractActiveModel extends \Model
|
||||
*
|
||||
* @return \Model|null
|
||||
*/
|
||||
public static function findActiveByPK($modelId, $options = array())
|
||||
public static function findActiveByPK($modelId, $options = [])
|
||||
{
|
||||
return static::findOneBy('active=1 AND id', $modelId, $options);
|
||||
}
|
||||
@@ -43,7 +43,7 @@ abstract class AbstractActiveModel extends \Model
|
||||
*
|
||||
* @return Collection|null
|
||||
*/
|
||||
public static function findActiveBy($column, $value, $options = array())
|
||||
public static function findActiveBy($column, $value, $options = [])
|
||||
{
|
||||
if (is_array($column)) {
|
||||
$column[] = 'active=1';
|
||||
@@ -61,7 +61,7 @@ abstract class AbstractActiveModel extends \Model
|
||||
*
|
||||
* @return Collection|null
|
||||
*/
|
||||
public static function findActives($options = array())
|
||||
public static function findActives($options = [])
|
||||
{
|
||||
return static::findBy('active', '1', $options);
|
||||
}
|
||||
|
||||
@@ -42,18 +42,18 @@ class LayerModel extends AbstractActiveModel
|
||||
*
|
||||
* @return Collection|null
|
||||
*/
|
||||
public static function findMultipleByTypes(array $types, $options = array())
|
||||
public static function findMultipleByTypes(array $types, $options = [])
|
||||
{
|
||||
if (empty($types)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$options['column'] = array(
|
||||
$options['column'] = [
|
||||
sprintf(
|
||||
'type IN (%s)',
|
||||
substr(str_repeat('?,', count($types)), 0, -1)
|
||||
)
|
||||
);
|
||||
),
|
||||
];
|
||||
|
||||
$options['value'] = $types;
|
||||
$options['return'] = 'Collection';
|
||||
|
||||
@@ -41,7 +41,7 @@ class MarkerModel extends AbstractActiveModel
|
||||
public static function findByFilter($pid, Filter $filter = null)
|
||||
{
|
||||
if (!$filter) {
|
||||
return static::findActiveBy('pid', $pid, array('order' => 'sorting'));
|
||||
return static::findActiveBy('pid', $pid, ['order' => 'sorting']);
|
||||
}
|
||||
|
||||
switch ($filter->getName()) {
|
||||
@@ -63,23 +63,23 @@ class MarkerModel extends AbstractActiveModel
|
||||
*/
|
||||
public static function findByBBoxFilter($pid, BboxFilter $filter)
|
||||
{
|
||||
$columns = array(
|
||||
$columns = [
|
||||
'active=1',
|
||||
'pid=?',
|
||||
'latitude > ? AND latitude < ?',
|
||||
'longitude > ? AND longitude < ?'
|
||||
);
|
||||
'longitude > ? AND longitude < ?',
|
||||
];
|
||||
|
||||
/** @var LatLngBounds $bounds */
|
||||
$bounds = $filter->getValues()['bounds'];
|
||||
$values = array(
|
||||
$values = [
|
||||
$pid,
|
||||
$bounds->getSouthWest()->getLatitude(),
|
||||
$bounds->getNorthEast()->getLatitude(),
|
||||
$bounds->getSouthWest()->getLongitude(),
|
||||
$bounds->getNorthEast()->getLongitude()
|
||||
);
|
||||
$bounds->getNorthEast()->getLongitude(),
|
||||
];
|
||||
|
||||
return static::findBy($columns, $values, array('order' => 'sorting'));
|
||||
return static::findBy($columns, $values, ['order' => 'sorting']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user