From: Evan Prodromou Date: Wed, 16 Sep 2009 00:27:11 +0000 (-0400) Subject: start of a location class X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b6b245dc0be75a3358fee560a40a54e280e4f2a7;p=quix0rs-gnu-social.git start of a location class --- diff --git a/lib/location.php b/lib/location.php new file mode 100644 index 0000000000..cbd03f33a4 --- /dev/null +++ b/lib/location.php @@ -0,0 +1,77 @@ +. + * + * @category Location + * @package StatusNet + * @author Evan Prodromou + * @copyright 2009 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +if (!defined('STATUSNET') && !defined('LACONICA')) { + exit(1); +} + +/** + * class for locations + * + * @category Location + * @package StatusNet + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +class Location +{ + public $lat; + public $lon; + public $location_id; + public $location_ns; + + var $names; + + static function fromName($name, $language=null) + { + if (is_null($language)) { + $language = common_language(); + } + } + + static function fromId($location_id, $location_ns = null) + { + if (is_null($location_ns)) { + $location_ns = common_config('location', 'namespace'); + } + } + + function getName($language=null) + { + if (is_null($language)) { + $language = common_language(); + } + + if (array_key_exists($this->names, $language)) { + return $this->names[$language]; + } + } +}