Merge pull request #1 from calderacc/composer

Composer
This commit is contained in:
Malte Hübner 2017-05-26 14:16:26 +02:00 committed by GitHub
commit 7a6c32b5d1
5 changed files with 62 additions and 37 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.idea/ .idea/
vendor

22
composer.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "calderacc/staticmaplite",
"type": "library",
"license": "Apache",
"authors": [
{
"name": "Gerhard Koch",
"email": "gerhard.koch@ymail.com"
},
{
"name": "Malte Hübner",
"email": "maltehuebner@gmx.org"
}
],
"autoload": {
"psr-4": {
"StaticMapLite\\": "src"
}
},
"minimum-stability": "stable",
"require": {}
}

View File

@ -1,36 +1,9 @@
<?php <?php
/** namespace StaticMapLite;
* staticMapLite 0.3.1
*
* Copyright 2009 Gerhard Koch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author Gerhard Koch <gerhard.koch AT ymail.com>
*
* USAGE:
*
* staticmap.php?center=40.714728,-73.998672&zoom=14&size=512x512&maptype=mapnik&markers=40.702147,-74.015794,blues|40.711614,-74.012318,greeng|40.718217,-73.998284,redc
*
*/
error_reporting(0); class staticMapLite
ini_set('display_errors', 'off');
Class staticMapLite
{ {
protected $maxWidth = 1024; protected $maxWidth = 1024;
protected $maxHeight = 1024; protected $maxHeight = 1024;
@ -104,10 +77,10 @@ Class staticMapLite
global $_GET; global $_GET;
if (!empty($_GET['show'])) { if (!empty($_GET['show'])) {
$this->parseOjwParams(); $this->parseOjwParams();
} }
else { else {
$this->parseLiteParams(); $this->parseLiteParams();
} }
} }
@ -156,9 +129,9 @@ Class staticMapLite
if ($this->width > $this->maxWidth) $this->width = $this->maxWidth; if ($this->width > $this->maxWidth) $this->width = $this->maxWidth;
$this->height = intval($_GET['h']); $this->height = intval($_GET['h']);
if ($this->height > $this->maxHeight) $this->height = $this->maxHeight; if ($this->height > $this->maxHeight) $this->height = $this->maxHeight;
if (!empty($_GET['mlat0'])) {
if (!empty($_GET['mlat0'])) {
$markerLat = floatval($_GET['mlat0']); $markerLat = floatval($_GET['mlat0']);
if (!empty($_GET['mlon0'])) { if (!empty($_GET['mlon0'])) {
$markerLon = floatval($_GET['mlon0']); $markerLon = floatval($_GET['mlon0']);
@ -402,8 +375,4 @@ Class staticMapLite
} }
} }
} }
$map = new staticMapLite();
print $map->showMap();

33
web/staticmap.php Normal file
View File

@ -0,0 +1,33 @@
<?php
/**
* staticMapLite 0.3.1
*
* Copyright 2009 Gerhard Koch
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @author Gerhard Koch <gerhard.koch AT ymail.com>
*
* USAGE:
*
* staticmap.php?center=40.714728,-73.998672&zoom=14&size=512x512&maptype=mapnik&markers=40.702147,-74.015794,blues|40.711614,-74.012318,greeng|40.718217,-73.998284,redc
*
*/
require_once '../vendor/autoload.php';
use StaticMapLite\staticMapLite;
$map = new staticMapLite();
print $map->showMap();