1: <?php
2: /*
3: You may not change or alter any portion of this comment or credits
4: of supporting developers from this source code or any supporting source code
5: which is considered copyrighted (c) material of the original comment or credit authors.
6:
7: This program is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY; without even the implied warranty of
9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: */
11:
12: namespace Xoops\Core\Lists;
13:
14: use \Punic\Territory;
15: use Xoops\Form\OptionElement;
16:
17: /**
18: * Country - provide list of country names
19: *
20: * @category Xoops\Core\Lists\Country
21: * @package Xoops\Core
22: * @author Richard Griffith <richard@geekwright.com>
23: * @copyright 2015 XOOPS Project (http://xoops.org)/
24: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
25: * @link http://xoops.org
26: */
27: class Country extends ListAbstract
28: {
29: /**
30: * Get a list of localized country names
31: *
32: * @return array
33: */
34: public static function getList()
35: {
36: $countryList = Territory::getCountries();
37: \XoopsLocale::asort($countryList);
38: return $countryList;
39: }
40:
41: /**
42: * add list to a Xoops\Form\OptionElement
43: *
44: * @param OptionElement $element
45: *
46: * @return void
47: */
48: public static function setOptionsArray(OptionElement $element)
49: {
50: $element->addOptionArray(["" => "-"]);
51: parent::setOptionsArray($element);
52: }
53: }
54: