Commit 2b293902 authored by LONGMAN's avatar LONGMAN

Fixed bugs

parent 25c689b4
...@@ -20,7 +20,7 @@ class DateCommand extends Command ...@@ -20,7 +20,7 @@ class DateCommand extends Command
protected $name = 'date'; protected $name = 'date';
protected $description = 'Show date/time by location'; protected $description = 'Show date/time by location';
protected $usage = '/date <location>'; protected $usage = '/date <location>';
protected $version = '1.1.0'; protected $version = '1.2.0';
protected $enabled = true; protected $enabled = true;
private $base_url = 'https://maps.googleapis.com/maps/api'; private $base_url = 'https://maps.googleapis.com/maps/api';
...@@ -32,8 +32,10 @@ class DateCommand extends Command ...@@ -32,8 +32,10 @@ class DateCommand extends Command
$url = $this->base_url . '/geocode/json?'; $url = $this->base_url . '/geocode/json?';
$params = 'address=' . urlencode($location); $params = 'address=' . urlencode($location);
if (!empty($google_api_key = $this->getConfig('google_api_key'))) {
$params.= '&key=' . $google_api_key; $google_api_key = $this->getConfig('google_api_key');
if (!empty($google_api_key)) {
$params .= '&key=' . $google_api_key;
} }
$data = $this->request($url . $params); $data = $this->request($url . $params);
...@@ -62,13 +64,14 @@ class DateCommand extends Command ...@@ -62,13 +64,14 @@ class DateCommand extends Command
{ {
$url = $this->base_url . '/timezone/json?'; $url = $this->base_url . '/timezone/json?';
$date_utc = new \DateTime(null, new \DateTimeZone("UTC")); $date_utc = new \DateTime(null, new \DateTimeZone("UTC"));
$timestamp = $date_utc->format('U'); $timestamp = $date_utc->format('U');
$params = 'location=' . urlencode($lat) . ',' . urlencode($lng) . '&timestamp=' . urlencode($timestamp); $params = 'location=' . urlencode($lat) . ',' . urlencode($lng) . '&timestamp=' . urlencode($timestamp);
if (!empty($google_api_key = $this->getConfig('google_api_key'))) {
$google_api_key = $this->getConfig('google_api_key');
if (!empty($google_api_key)) {
$params.= '&key=' . $google_api_key; $params.= '&key=' . $google_api_key;
} }
......
...@@ -30,7 +30,7 @@ class Telegram ...@@ -30,7 +30,7 @@ class Telegram
* *
* @var string * @var string
*/ */
protected $version = '0.0.5'; protected $version = '0.0.7';
/** /**
* Telegram API key * Telegram API key
......
...@@ -25,7 +25,7 @@ $root = realpath(dirname(dirname(__FILE__))); ...@@ -25,7 +25,7 @@ $root = realpath(dirname(dirname(__FILE__)));
* Check that --dev composer installation was done * Check that --dev composer installation was done
*/ */
if (!file_exists($root . '/vendor/autoload.php')) { if (!file_exists($root . '/vendor/autoload.php')) {
throw new Exception( throw new \Exception(
'Please run "php composer.phar install --dev" in root directory ' 'Please run "php composer.phar install --dev" in root directory '
. 'to setup unit test dependencies before running the tests' . 'to setup unit test dependencies before running the tests'
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment