mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
APICHANGE: give Geoip::getCountryDropDown a $withBlank parameter (bool: default as false).
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79850 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e0fbc7ac83
commit
8b2a88e61e
@ -264,6 +264,7 @@ class Geoip extends Object {
|
|||||||
'ZW' => "Zimbabwe"
|
'ZW' => "Zimbabwe"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the country for an IP address.
|
* Find the country for an IP address.
|
||||||
*
|
*
|
||||||
@ -366,14 +367,18 @@ class Geoip extends Object {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param boolean $withBlank indicating the returned array containing blank value or not
|
||||||
* Returns an array of ISO Country Codes -> Country Names
|
* Returns an array of ISO Country Codes -> Country Names
|
||||||
*/
|
*/
|
||||||
static function getCountryDropDown() {
|
static function getCountryDropDown($withBlank = false) {
|
||||||
$dropdown = Geoip::$iso_3166_countryCodes;
|
$dropdown = Geoip::$iso_3166_countryCodes;
|
||||||
unset($dropdown['A1']);
|
unset($dropdown['A1']);
|
||||||
unset($dropdown['A2']);
|
unset($dropdown['A2']);
|
||||||
unset($dropdown['A3']);
|
unset($dropdown['A3']);
|
||||||
asort($dropdown);
|
asort($dropdown);
|
||||||
|
if($withBlank){
|
||||||
|
$dropdown = array_merge(array(""=>"Select a Country"), $dropdown);
|
||||||
|
}
|
||||||
return $dropdown;
|
return $dropdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user