Browse Source

use p3k\timezone libary

main
Aaron Parecki 8 years ago
parent
commit
22b6fcc93b
No known key found for this signature in database GPG Key ID: 276C2817346D6056
5 changed files with 64 additions and 22699 deletions
  1. +3
    -1
      composer.json
  2. +51
    -8
      composer.lock
  3. +5
    -1
      controllers/geocode.php
  4. +5
    -1
      controllers/timezone.php
  5. +0
    -22688
      p3k/Timezone.php

+ 3
- 1
composer.json View File

@ -6,7 +6,9 @@
"type": "project",
"require": {
"saltybeagle/savant3": "dev-master",
"p3k/slim-savant": ">=0.1.0"
"p3k/slim-savant": ">=0.1.0",
"slim/slim": "^2.6",
"p3k/timezone": "*"
},
"require-dev": {
},

+ 51
- 8
composer.lock View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "67cc4cf59f1b61424cfb0b5d47668c2f",
"content-hash": "89fae6b20014c572693b23303e9a22ee",
"packages": [
{
"name": "p3k/slim-savant",
@ -43,7 +43,49 @@
}
],
"description": "Savant renderer for Slim",
"time": "2015-07-21 01:40:52"
"time": "2015-07-21T01:40:52+00:00"
},
{
"name": "p3k/timezone",
"version": "0.1.0",
"source": {
"type": "git",
"url": "https://github.com/aaronpk/p3k-timezone.git",
"reference": "68d3490d896f98cf0727dc937f0bb6b045050c83"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aaronpk/p3k-timezone/zipball/68d3490d896f98cf0727dc937f0bb6b045050c83",
"reference": "68d3490d896f98cf0727dc937f0bb6b045050c83",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"type": "library",
"autoload": {
"files": [
"src/p3k/Timezone.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Aaron Parecki",
"homepage": "https://aaronparecki.com"
}
],
"description": "Find the timezone of a given location",
"homepage": "https://github.com/aaronpk/p3k-timezone",
"keywords": [
"date",
"p3k",
"timezone"
],
"time": "2017-01-12T17:30:08+00:00"
},
{
"name": "saltybeagle/savant3",
@ -82,23 +124,24 @@
},
{
"name": "slim/slim",
"version": "2.6.2",
"version": "2.6.3",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim.git",
"reference": "20a02782f76830b67ae56a5c08eb1f563c351a37"
"reference": "9224ed81ac1c412881e8d762755e3d76ebf580c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/20a02782f76830b67ae56a5c08eb1f563c351a37",
"reference": "20a02782f76830b67ae56a5c08eb1f563c351a37",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/9224ed81ac1c412881e8d762755e3d76ebf580c0",
"reference": "9224ed81ac1c412881e8d762755e3d76ebf580c0",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"suggest": {
"ext-mcrypt": "Required for HTTP cookie encryption"
"ext-mcrypt": "Required for HTTP cookie encryption",
"phpseclib/mcrypt_compat": "Polyfil for mcrypt extension"
},
"type": "library",
"autoload": {
@ -124,7 +167,7 @@
"rest",
"router"
],
"time": "2015-03-08 18:41:17"
"time": "2017-01-07T12:21:41+00:00"
}
],
"packages-dev": [],

+ 5
- 1
controllers/geocode.php View File

@ -42,7 +42,11 @@ $app->get('/api/geocode', function() use($app) {
$response['full_name'] = $adr->fullName;
}
$timezone = p3k\Timezone::timezone_for_location($response['latitude'], $response['longitude'], k($params,'date'));
$tz = p3k\Timezone::timezone_for_location($response['latitude'], $response['longitude'], k($params,'date'));
$timezone = false;
if($tz) {
$timezone = new p3k\timezone\Result($tz, k($params, 'date'));
}
if($timezone) {
$response['timezone'] = $timezone->name;

+ 5
- 1
controllers/timezone.php View File

@ -8,7 +8,11 @@ $app->get('/api/timezone', function() use($app) {
$lat = (float)$params['latitude'];
$lng = (float)$params['longitude'];
$timezone = \p3k\Timezone::timezone_for_location($lat, $lng);
$tz = \p3k\Timezone::timezone_for_location($lat, $lng);
$timezone = false;
if($tz) {
$timezone = new p3k\timezone\Result($tz);
}
if($timezone) {
json_response($app, [

+ 0
- 22688
p3k/Timezone.php
File diff suppressed because it is too large
View File


Loading…
Cancel
Save