From b6b245dc0be75a3358fee560a40a54e280e4f2a7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 15 Sep 2009 20:27:11 -0400 Subject: start of a location class --- lib/location.php | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 lib/location.php (limited to 'lib/location.php') diff --git a/lib/location.php b/lib/location.php new file mode 100644 index 000000000..cbd03f33a --- /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]; + } + } +} -- cgit v1.2.3-54-g00ecf