Function Reference: geodir_get_limited_location_array
Summary
Get location data as an array or object.
Package
GeoDirectory_Location_Manager
Parameters
- $which
 - (string) (required) Location type. Possible values are ‘country’, ‘region’, ‘city’. 
- Default: : ‘country’
 
 
- $format
 - (string) (required) Output format. Possible values are ‘array’, ‘object’. 
- Default: : ‘array’
 
 
Return Values
- (object|string|array)
 - Location array or object.
 
Change Log
Since: 1.0.0
Source File
geodir_get_limited_location_array() is located in geodir_location_manager/geodir_location_functions.php [Line: 559]
Source Code
function geodir_get_limited_location_array($which='country' , $format='array')
{
	$location_array = '' ;
	$locations = '' ;
	switch($which)
	{
		case 'country':
						$locations =	get_option('geodir_selected_countries');
						break;
		case 'region':
						$locations =	get_option('geodir_selected_regions');
						break;
		case 'city':
						$locations =	get_option('geodir_selected_cities');
						break;
	}
	if(!empty($locations) && is_array($locations))
	{
		foreach($locations as $location)
		$location_array[$location] = $location ;
	}
	if($format=='object')
		$location_array = (object)$location_array ;
	return $location_array ;
}