-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c197aa8
commit 370df05
Showing
6 changed files
with
133 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.3.3-20240912 | ||
5.3.3-20240913 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace OB\Classes\Metadata; | ||
|
||
class Coordinates extends \OB\Classes\Base\Metadata | ||
{ | ||
public function processRow(&$row) | ||
{ | ||
$coordinates = $row['metadata_' . $this->name]; | ||
if ($coordinates) { | ||
// unpack binary if needed. note this check is very specific to this application and not a general solution | ||
// the expected binary data is 25 bytes long, and the expected non-binary data is less than that | ||
// note there is a very unlikely edge case if someone sets the default value to be a string of 25 characters (which is not possible via the UI, but could be done via the API) | ||
// TODO this should be fixed with better metadata abstraction | ||
if (strlen($coordinates) == 25) { | ||
$data = unpack('x/x/x/x/corder/Ltype/dlat/dlon', $coordinates); | ||
$coordinates = $data['lat'] . ',' . $data['lon']; | ||
} | ||
|
||
$coordinates = explode(',', $coordinates); | ||
if (count($coordinates) == 2) { | ||
$latitude = (float) $coordinates[0]; | ||
$longitude = (float) $coordinates[1]; | ||
$row['metadata_' . $this->name] = [$latitude, $longitude]; | ||
|
||
// set, early return. | ||
return; | ||
} | ||
} | ||
|
||
// not set or not valid | ||
$row['metadata_' . $this->name] = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters