diff --git a/.gitignore b/.gitignore index 9f11b75..75b2efc 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea/ +vendor diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..2b81722 --- /dev/null +++ b/composer.json @@ -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": {} +} diff --git a/staticmap.php b/src/staticMapLite.php similarity index 92% rename from staticmap.php rename to src/staticMapLite.php index a9855e5..66e1636 100644 --- a/staticmap.php +++ b/src/staticMapLite.php @@ -1,36 +1,9 @@ - * - * 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 - * - */ +namespace StaticMapLite; -error_reporting(0); -ini_set('display_errors', 'off'); - -Class staticMapLite +class staticMapLite { - protected $maxWidth = 1024; protected $maxHeight = 1024; @@ -104,10 +77,10 @@ Class staticMapLite global $_GET; if (!empty($_GET['show'])) { - $this->parseOjwParams(); + $this->parseOjwParams(); } else { - $this->parseLiteParams(); + $this->parseLiteParams(); } } @@ -156,9 +129,9 @@ Class staticMapLite if ($this->width > $this->maxWidth) $this->width = $this->maxWidth; $this->height = intval($_GET['h']); if ($this->height > $this->maxHeight) $this->height = $this->maxHeight; - - if (!empty($_GET['mlat0'])) { + + if (!empty($_GET['mlat0'])) { $markerLat = floatval($_GET['mlat0']); if (!empty($_GET['mlon0'])) { $markerLon = floatval($_GET['mlon0']); @@ -402,8 +375,4 @@ Class staticMapLite } } - } - -$map = new staticMapLite(); -print $map->showMap(); diff --git a/index.html b/web/index.html similarity index 100% rename from index.html rename to web/index.html diff --git a/web/staticmap.php b/web/staticmap.php new file mode 100644 index 0000000..2d8146f --- /dev/null +++ b/web/staticmap.php @@ -0,0 +1,33 @@ + + * + * 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();