mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-10-08 07:52:59 +00:00
added composer.json and needed libs
This commit is contained in:
parent
4f1fb007c5
commit
1f74d409a2
42 changed files with 4413 additions and 0 deletions
76
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/City.php
vendored
Normal file
76
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/City.php
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/**
|
||||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
* Please see the LICENSE file distributed with this source code for further
|
||||
* information regarding copyright and licensing.
|
||||
*
|
||||
* Please visit the following links to read about the usage policies and the license of
|
||||
* OpenWeatherMap before using this class:
|
||||
*
|
||||
* @see http://www.OpenWeatherMap.org
|
||||
* @see http://www.OpenWeatherMap.org/terms
|
||||
* @see http://openweathermap.org/appid
|
||||
*/
|
||||
|
||||
namespace Cmfcmf\OpenWeatherMap\Util;
|
||||
|
||||
/**
|
||||
* The city class representing a city object.
|
||||
*/
|
||||
class City
|
||||
{
|
||||
/**
|
||||
* @var int The city id.
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string The name of the city.
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var float The longitude of the city.
|
||||
*/
|
||||
public $lon;
|
||||
|
||||
/**
|
||||
* @var float The latitude of the city.
|
||||
*/
|
||||
public $lat;
|
||||
|
||||
/**
|
||||
* @var string The abbreviation of the country the city is located in.
|
||||
*/
|
||||
public $country;
|
||||
|
||||
/**
|
||||
* @var int The city's population
|
||||
*/
|
||||
public $population;
|
||||
|
||||
/**
|
||||
* Create a new city object.
|
||||
*
|
||||
* @param int $id The city id.
|
||||
* @param string $name The name of the city.
|
||||
* @param float $lon The longitude of the city.
|
||||
* @param float $lat The latitude of the city.
|
||||
* @param string $country The abbreviation of the country the city is located in
|
||||
* @param int $population The city's population.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __construct($id, $name = null, $lon = null, $lat = null, $country = null, $population = null)
|
||||
{
|
||||
$this->id = (int)$id;
|
||||
$this->name = isset($name) ? (string)$name : null;
|
||||
$this->lon = isset($lon) ? (float)$lon : null;
|
||||
$this->lat = isset($lat) ? (float)$lat : null;
|
||||
$this->country = isset($country) ? (string)$country : null;
|
||||
$this->population = isset($population) ? (int)$population : null;
|
||||
}
|
||||
}
|
52
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Sun.php
vendored
Normal file
52
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Sun.php
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
* Please see the LICENSE file distributed with this source code for further
|
||||
* information regarding copyright and licensing.
|
||||
*
|
||||
* Please visit the following links to read about the usage policies and the license of
|
||||
* OpenWeatherMap before using this class:
|
||||
*
|
||||
* @see http://www.OpenWeatherMap.org
|
||||
* @see http://www.OpenWeatherMap.org/terms
|
||||
* @see http://openweathermap.org/appid
|
||||
*/
|
||||
|
||||
namespace Cmfcmf\OpenWeatherMap\Util;
|
||||
|
||||
/**
|
||||
* The sun class representing a sun object.
|
||||
*/
|
||||
class Sun
|
||||
{
|
||||
/**
|
||||
* @var \DateTime The time of the sun rise.
|
||||
*/
|
||||
public $rise;
|
||||
|
||||
/**
|
||||
* @var \DateTime The time of the sun set.
|
||||
*/
|
||||
public $set;
|
||||
|
||||
/**
|
||||
* Create a new sun object.
|
||||
*
|
||||
* @param \DateTime $rise The time of the sun rise
|
||||
* @param \DateTime $set The time of the sun set.
|
||||
*
|
||||
* @throws \LogicException If sunset is before sunrise.
|
||||
* @internal
|
||||
*/
|
||||
public function __construct(\DateTime $rise, \DateTime $set)
|
||||
{
|
||||
if ($set < $rise) {
|
||||
throw new \LogicException('Sunset cannot be before sunrise!');
|
||||
}
|
||||
$this->rise = $rise;
|
||||
$this->set = $set;
|
||||
}
|
||||
}
|
105
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Temperature.php
vendored
Normal file
105
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Temperature.php
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/**
|
||||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
* Please see the LICENSE file distributed with this source code for further
|
||||
* information regarding copyright and licensing.
|
||||
*
|
||||
* Please visit the following links to read about the usage policies and the license of
|
||||
* OpenWeatherMap before using this class:
|
||||
*
|
||||
* @see http://www.OpenWeatherMap.org
|
||||
* @see http://www.OpenWeatherMap.org/terms
|
||||
* @see http://openweathermap.org/appid
|
||||
*/
|
||||
|
||||
namespace Cmfcmf\OpenWeatherMap\Util;
|
||||
|
||||
/**
|
||||
* The temperature class representing a temperature object.
|
||||
*/
|
||||
class Temperature
|
||||
{
|
||||
/**
|
||||
* @var Unit The current temperature.
|
||||
*/
|
||||
public $now;
|
||||
|
||||
/**
|
||||
* @var Unit The minimal temperature.
|
||||
*/
|
||||
public $min;
|
||||
|
||||
/**
|
||||
* @var Unit The maximal temperature.
|
||||
*/
|
||||
public $max;
|
||||
|
||||
/**
|
||||
* Returns the current temperature as formatted string.
|
||||
*
|
||||
* @return string The current temperature as a formatted string.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->now->__toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current temperature's unit.
|
||||
*
|
||||
* @return string The current temperature's unit.
|
||||
*/
|
||||
public function getUnit()
|
||||
{
|
||||
return $this->now->getUnit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current temperature.
|
||||
*
|
||||
* @return string The current temperature.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->now->getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current temperature's description.
|
||||
*
|
||||
* @return string The current temperature's description.
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->now->getDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current temperature as formatted string.
|
||||
*
|
||||
* @return string The current temperature as formatted string.
|
||||
*/
|
||||
public function getFormatted()
|
||||
{
|
||||
return $this->now->getFormatted();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new temperature object.
|
||||
*
|
||||
* @param Unit $now The current temperature.
|
||||
* @param Unit $min The minimal temperature.
|
||||
* @param Unit $max The maximal temperature.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __construct(Unit $now, Unit $min, Unit $max)
|
||||
{
|
||||
$this->now = $now;
|
||||
$this->min = $min;
|
||||
$this->max = $max;
|
||||
}
|
||||
}
|
65
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Time.php
vendored
Normal file
65
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Time.php
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
* Please see the LICENSE file distributed with this source code for further
|
||||
* information regarding copyright and licensing.
|
||||
*
|
||||
* Please visit the following links to read about the usage policies and the license of
|
||||
* OpenWeatherMap before using this class:
|
||||
*
|
||||
* @see http://www.OpenWeatherMap.org
|
||||
* @see http://www.OpenWeatherMap.org/terms
|
||||
* @see http://openweathermap.org/appid
|
||||
*/
|
||||
|
||||
namespace Cmfcmf\OpenWeatherMap\Util;
|
||||
|
||||
/**
|
||||
* The time class representing a time object.
|
||||
*/
|
||||
class Time
|
||||
{
|
||||
/**
|
||||
* @var \DateTime The start time for the forecast.
|
||||
*/
|
||||
public $from;
|
||||
|
||||
/**
|
||||
* @var \DateTime The end time for the forecast.
|
||||
*/
|
||||
public $to;
|
||||
|
||||
/**
|
||||
* @var \DateTime The day of the forecast.
|
||||
*/
|
||||
public $day;
|
||||
|
||||
/**
|
||||
* Create a new time object.
|
||||
*
|
||||
* @param string|\DateTime $from The start time for the forecast.
|
||||
* @param string|\DateTime $to The end time for the forecast.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __construct($from, $to = null)
|
||||
{
|
||||
if (isset($to)) {
|
||||
$from = ($from instanceof \DateTime) ? $from : new \DateTime((string)$from);
|
||||
$to = ($to instanceof \DateTime) ? $to : new \DateTime((string)$to);
|
||||
$day = new \DateTime($from->format('Y-m-d'));
|
||||
} else {
|
||||
$from = ($from instanceof \DateTime) ? $from : new \DateTime((string)$from);
|
||||
$day = clone $from;
|
||||
$to = clone $from;
|
||||
$to = $to->add(new \DateInterval('PT23H59M59S'));
|
||||
}
|
||||
|
||||
$this->from = $from;
|
||||
$this->to = $to;
|
||||
$this->day = $day;
|
||||
}
|
||||
}
|
128
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Unit.php
vendored
Normal file
128
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Unit.php
vendored
Normal file
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
/**
|
||||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
* Please see the LICENSE file distributed with this source code for further
|
||||
* information regarding copyright and licensing.
|
||||
*
|
||||
* Please visit the following links to read about the usage policies and the license of
|
||||
* OpenWeatherMap before using this class:
|
||||
*
|
||||
* @see http://www.OpenWeatherMap.org
|
||||
* @see http://www.OpenWeatherMap.org/terms
|
||||
* @see http://openweathermap.org/appid
|
||||
*/
|
||||
|
||||
namespace Cmfcmf\OpenWeatherMap\Util;
|
||||
|
||||
/**
|
||||
* The unit class representing a unit object.
|
||||
*/
|
||||
class Unit
|
||||
{
|
||||
/**
|
||||
* @var float The value.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* @var string The value's unit.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
private $unit;
|
||||
|
||||
/**
|
||||
* @var string The value's description.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* Create a new unit object.
|
||||
*
|
||||
* @param float $value The value.
|
||||
* @param string $unit The unit of the value.
|
||||
* @param string $description The description of the value.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __construct($value = 0.0, $unit = "", $description = "")
|
||||
{
|
||||
$this->value = (float)$value;
|
||||
$this->unit = (string)$unit;
|
||||
$this->description = (string)$description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value as formatted string with unit.
|
||||
*
|
||||
* @return string The value as formatted string with unit.
|
||||
*
|
||||
* The unit is not included if it is empty.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getFormatted();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value's unit.
|
||||
*
|
||||
* @return string The value's unit.
|
||||
*
|
||||
* This also converts 'celsius' to '°C' and 'fahrenheit' to 'F'.
|
||||
*/
|
||||
public function getUnit()
|
||||
{
|
||||
// Units are inconsistent. Only celsius and fahrenheit are not abbreviated. This check fixes that.
|
||||
if ($this->unit == 'celsius') {
|
||||
return "°C";
|
||||
} else if ($this->unit == 'fahrenheit') {
|
||||
return 'F';
|
||||
} else {
|
||||
return $this->unit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value.
|
||||
*
|
||||
* @return float The value.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value's description.
|
||||
*
|
||||
* @return string The value's description.
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value as formatted string with unit.
|
||||
*
|
||||
* @return string The value as formatted string with unit.
|
||||
*
|
||||
* The unit is not included if it is empty.
|
||||
*/
|
||||
public function getFormatted()
|
||||
{
|
||||
if ($this->getUnit() != "") {
|
||||
return "{$this->getValue()} {$this->getUnit()}";
|
||||
} else {
|
||||
return "{$this->getValue()}";
|
||||
}
|
||||
}
|
||||
}
|
82
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Weather.php
vendored
Normal file
82
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Weather.php
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
/**
|
||||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
* Please see the LICENSE file distributed with this source code for further
|
||||
* information regarding copyright and licensing.
|
||||
*
|
||||
* Please visit the following links to read about the usage policies and the license of
|
||||
* OpenWeatherMap before using this class:
|
||||
*
|
||||
* @see http://www.OpenWeatherMap.org
|
||||
* @see http://www.OpenWeatherMap.org/terms
|
||||
* @see http://openweathermap.org/appid
|
||||
*/
|
||||
|
||||
namespace Cmfcmf\OpenWeatherMap\Util;
|
||||
|
||||
/**
|
||||
* The weather class representing a weather object.
|
||||
*/
|
||||
class Weather
|
||||
{
|
||||
/**
|
||||
* @var int The weather id.
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string The weather description.
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var string the icon name.
|
||||
*/
|
||||
public $icon;
|
||||
|
||||
/**
|
||||
* @var string The url for icons.
|
||||
*
|
||||
* @see self::getIconUrl() to see how it is used.
|
||||
*/
|
||||
private $iconUrl = "http://openweathermap.org/img/w/%s.png";
|
||||
|
||||
/**
|
||||
* Create a new weather object.
|
||||
*
|
||||
* @param int $id The icon id.
|
||||
* @param string $description The weather description.
|
||||
* @param string $icon The icon name.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __construct($id, $description, $icon)
|
||||
{
|
||||
$this->id = (int)$id;
|
||||
$this->description = (string)$description;
|
||||
$this->icon = (string)$icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the weather description.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon url.
|
||||
*
|
||||
* @return string The icon url.
|
||||
*/
|
||||
public function getIconUrl()
|
||||
{
|
||||
return str_replace("%s", $this->icon, $this->iconUrl);
|
||||
}
|
||||
}
|
48
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Wind.php
vendored
Normal file
48
curweather/vendor/cmfcmf/openweathermap-php-api/Cmfcmf/OpenWeatherMap/Util/Wind.php
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* OpenWeatherMap-PHP-API — A php api to parse weather data from http://www.OpenWeatherMap.org .
|
||||
*
|
||||
* @license MIT
|
||||
*
|
||||
* Please see the LICENSE file distributed with this source code for further
|
||||
* information regarding copyright and licensing.
|
||||
*
|
||||
* Please visit the following links to read about the usage policies and the license of
|
||||
* OpenWeatherMap before using this class:
|
||||
*
|
||||
* @see http://www.OpenWeatherMap.org
|
||||
* @see http://www.OpenWeatherMap.org/terms
|
||||
* @see http://openweathermap.org/appid
|
||||
*/
|
||||
|
||||
namespace Cmfcmf\OpenWeatherMap\Util;
|
||||
|
||||
/**
|
||||
* The wind class representing a wind object.
|
||||
*/
|
||||
class Wind
|
||||
{
|
||||
/**
|
||||
* @var Unit The wind speed.
|
||||
*/
|
||||
public $speed;
|
||||
|
||||
/**
|
||||
* @var Unit The wind direction.
|
||||
*/
|
||||
public $direction;
|
||||
|
||||
/**
|
||||
* Create a new wind object.
|
||||
*
|
||||
* @param Unit $speed The wind speed.
|
||||
* @param Unit $direction The wind direction.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __construct(Unit $speed, Unit $direction)
|
||||
{
|
||||
$this->speed = $speed;
|
||||
$this->direction = $direction;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue