diff --git a/serendipity_event_geo_json/ChangeLog b/serendipity_event_geo_json/ChangeLog
index b5dede32..a7260762 100644
--- a/serendipity_event_geo_json/ChangeLog
+++ b/serendipity_event_geo_json/ChangeLog
@@ -1,9 +1,14 @@
+0.3.0:
+---
+ * Added Spanish translations
+ * Improved translations
+ * More generic JSON data
+ * Changed my name
+
0.2.2:
---
-
-* Added missing include
+ * Added missing include
0.2.1:
---
-
-* Convert date, size and catergory ids to int, 3% smaller output
+ * Convert date, size and catergory ids to int, 3% smaller output
diff --git a/serendipity_event_geo_json/UTF-8/lang_de.inc.php b/serendipity_event_geo_json/UTF-8/lang_de.inc.php
index 9504d212..37880f33 100644
--- a/serendipity_event_geo_json/UTF-8/lang_de.inc.php
+++ b/serendipity_event_geo_json/UTF-8/lang_de.inc.php
@@ -1,4 +1,4 @@
diff --git a/serendipity_event_geo_json/UTF-8/lang_es.inc.php b/serendipity_event_geo_json/UTF-8/lang_es.inc.php
new file mode 100644
index 00000000..dc104930
--- /dev/null
+++ b/serendipity_event_geo_json/UTF-8/lang_es.inc.php
@@ -0,0 +1,4 @@
+
diff --git a/serendipity_event_geo_json/lang_de.inc.php b/serendipity_event_geo_json/lang_de.inc.php
index 9504d212..31d10118 100644
--- a/serendipity_event_geo_json/lang_de.inc.php
+++ b/serendipity_event_geo_json/lang_de.inc.php
@@ -1,4 +1,4 @@
diff --git a/serendipity_event_geo_json/lang_en.inc.php b/serendipity_event_geo_json/lang_en.inc.php
index c9431ecd..a43c962a 100644
--- a/serendipity_event_geo_json/lang_en.inc.php
+++ b/serendipity_event_geo_json/lang_en.inc.php
@@ -1,4 +1,4 @@
diff --git a/serendipity_event_geo_json/lang_es.inc.php b/serendipity_event_geo_json/lang_es.inc.php
new file mode 100644
index 00000000..02cf23c1
--- /dev/null
+++ b/serendipity_event_geo_json/lang_es.inc.php
@@ -0,0 +1,4 @@
+
diff --git a/serendipity_event_geo_json/plugin_version.inc.php b/serendipity_event_geo_json/plugin_version.inc.php
index b962fa3c..2b5b6c2c 100644
--- a/serendipity_event_geo_json/plugin_version.inc.php
+++ b/serendipity_event_geo_json/plugin_version.inc.php
@@ -1,4 +1,4 @@
diff --git a/serendipity_event_geo_json/serendipity_event_geo_json.php b/serendipity_event_geo_json/serendipity_event_geo_json.php
index ab969934..e1b008f4 100644
--- a/serendipity_event_geo_json/serendipity_event_geo_json.php
+++ b/serendipity_event_geo_json/serendipity_event_geo_json.php
@@ -16,7 +16,7 @@
$propbag->add('event_hooks', array('frontend_header' => true));
$propbag->add('author', PLUGIN_EVENT_GEO_JSON_AUTHOR);
$propbag->add('version', PLUGIN_EVENT_GEO_JSON_VERSION);
- $propbag->add('requirements', array('serendipity' => '2.3'));
+ $propbag->add('requirements', ['serendipity' => '2.3']);
$propbag->add('stackable', false);
$propbag->add('groups', array('FRONTEND_FEATURES'));
}
@@ -31,9 +31,11 @@
return is_array($rows) ? $rows : [];
}
- function get_entries() {
+ function get_articles() {
global $serendipity;
- $entries = [];
+ $timestamp = serendipity_db_time();
+ $showFutureEntries = serendipity_db_bool($serendipity['showFutureEntries']);
+ $articles = [];
foreach ($this->simple_query(
"SELECT e.id, e.title, p.permalink, e.timestamp, LENGTH(e.body) AS size, a.realname, eplat.value AS lat, eplng.value AS lng
FROM {$serendipity['dbPrefix']}entries e
@@ -44,16 +46,16 @@
WHERE e.isdraft = 'false'
ORDER BY e.timestamp",
false, 'assoc'
- ) as $row) {
- $entries[$row['id']] = [
- 'title' => $row['title'],
- 'url' => serendipity_db_bool($serendipity['showFutureEntries']) || $row['timestamp'] <= serendipity_db_time()
- ? $serendipity['serendipityHTTPPath'].$row['permalink']
+ ) as $article) {
+ $articles[$article['id']] = [
+ 'title' => $article['title'],
+ 'url' => $article['timestamp'] <= $timestamp || $showFutureEntries
+ ? $serendipity['serendipityHTTPPath'] . $article['permalink']
: null,
- 'date' => intval($row['timestamp']),
- 'size' => intval($row['size']),
- 'author' => $row['realname'],
- 'pos' => [floatval($row['lat']), floatval($row['lng'])],
+ 'date' => intval($article['timestamp']),
+ 'size' => intval($article['size']),
+ 'author' => $article['realname'],
+ 'location' => [floatval($article['lat']), floatval($article['lng'])],
'categories' => []
];
}
@@ -64,21 +66,21 @@
JOIN {$serendipity['dbPrefix']}entryproperties eplat ON (eplat.entryid = ec.entryid AND eplat.property = 'geo_lat')
JOIN {$serendipity['dbPrefix']}entryproperties eplng ON (eplng.entryid = ec.entryid AND eplng.property = 'geo_long')
WHERE e.isdraft = 'false'"
- ) as $row) {
- $entries[$row['entryid']]['categories'][] = intval($row['categoryid']);
+ ) as $articleCategory) {
+ $articles[$articleCategory['entryid']]['categories'][] = intval($articleCategory['categoryid']);
}
- return array_values($entries);
+ return array_values($articles);
}
- function get_uploads() {
+ function get_tracks() {
global $serendipity;
- return array_map(function($row) {
+ return array_map(function($track) {
global $serendipity;
return [
- 'title' => $row['realname'],
- 'url' => $serendipity['serendipityHTTPPath'].$serendipity['uploadPath'].$row['path'].$row['realname'],
- 'date' => intval($row['date']),
- 'size' => intval($row['size'])
+ 'title' => $track['realname'],
+ 'url' => $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] . $track['path'] . $track['realname'],
+ 'date' => intval($track['date']),
+ 'size' => intval($track['size'])
];
}, $this->simple_query(
"SELECT i.realname, i.path, IFNULL(m.value, i.date) AS date, i.size
@@ -87,23 +89,22 @@
m.mediaid = i.id AND m.property='DATE' AND m.property_group = 'base_property' AND property_subgroup = ''
)
WHERE i.extension = 'gpx'
- ORDER BY i.path, i.realname",
+ ORDER BY i.path",
false, 'assoc'
));
}
- function get_geo_json()
- {
+ function get_geo_json() {
return json_encode([
- 'entries' => $this->get_entries(),
- 'uploads' => $this->get_uploads()
+ 'articles' => $this->get_articles(),
+ 'tracks' => $this->get_tracks()
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
function event_hook($event, &$bag, &$eventData, $addData = null)
{
if ($event == 'frontend_header') {
- echo ' '.PHP_EOL;
+ echo ' ' . PHP_EOL;
}
}