]> git.nbdom.net Git - nb.git/commitdiff
etc/dbq/pub.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 6 Jan 2018 16:55:53 +0000 (16:55 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 6 Jan 2018 16:55:53 +0000 (16:55 +0000)
etc/dbq/pub.php [new file with mode: 0644]
lib/php/maps.php [new file with mode: 0644]

diff --git a/etc/dbq/pub.php b/etc/dbq/pub.php
new file mode 100644 (file)
index 0000000..c4009ec
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+require_once(realpath(dirname(__FILE__).'/../../lib/php/maps.php'));
+$DBQ['pub'] = [
+       'tables' => [
+       ],
+];
+?>
diff --git a/lib/php/maps.php b/lib/php/maps.php
new file mode 100644 (file)
index 0000000..c555104
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+class Maps {
+
+       public static function img($lt,$lg,$o=[]) {
+               if (empty($o['width'])) $o['width'] = 72;
+               if (empty($o['height'])) $o['height'] = 36;
+               $o['sensor'] = empty($o['sensor']) ? 'false' : 'true';
+
+               return '<img src="http://maps.google.com/maps/api/staticmap?center='.$lt.','.$lg
+                       .'&zoom=10'
+                       .'&size='.$o['width'].'x'.$o['height']
+                       .'&sensor='.$o['sensor'].'" />'
+               ;
+       }
+
+       public static function link($lt,$lg,$content=null) {
+               if (!isset($content)) $content = self::img($lt,$lg);
+               return '<a target="_blank" href="http://maps.google.com/?q='.$lt.','.$lg.'">'.$content.'</a>';
+       }
+
+}
+?>