Function Reference: geodir_location_tab_switcher
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
Parameters
- $args
- (null) (required)
- Default: None
Return Values
- (string)
Source File
geodir_location_tab_switcher() is located in geodir_location_manager/geodir_location_template_tags.php [Line: 522]
Source Code
function geodir_location_tab_switcher($args = null)
{
$switcher = !empty($args) && isset( $args['addSearchTermOnNorecord'] ) ? true : false;
if(get_option('geodir_enable_country') !='default' || get_option('geodir_enable_region') !='default' || get_option('geodir_enable_city') !='default')
{
$defaults = array('echo' => true, 'addSearchTermOnNorecord' => 0, 'autoredirect'=> false);
$args = wp_parse_args( $args, $defaults );
global $wpdb;
// Options
$echo = $args['echo'];
$addSearchTermOnNorecord = $args['addSearchTermOnNorecord'];
$autoredirect = $args['autoredirect'];
$output = '';
$selected = '';
$location_list = '';
$country_div = '';
$region_div = '';
$city_div = '';
$onchange ='';
$what_is_current_location = geodir_what_is_current_location();
$what_is_current_location_div = ($what_is_current_location.'_div');
if($what_is_current_location!='')
$$what_is_current_location_div = 'gd-tab-active' ;
else
{
$what_is_current_location = apply_filters('geodir_location_switcher_default_tab','city');
$what_is_current_location_div = ($what_is_current_location.'_div');
$$what_is_current_location_div = 'gd-tab-active';
}
$location_value = '';
if($autoredirect==='0'){}
else{
$location_value = geodir_get_location_link('base');
$onchange = ' onchange="window.location.href=this.value" ';
$autoredirect = '1';
}
$base_location = geodir_get_location_link('base') ;
$current_location_array = array();
$selected = '' ;
$country_val = '';
$region_val = '';
$city_val = '';
$country_val=geodir_get_current_location(array('what'=>'country', 'echo'=>false)) ;
$region_val=geodir_get_current_location(array('what'=>'region', 'echo'=>false)) ;
$city_val = geodir_get_current_location(array('what'=>'city', 'echo'=>false)) ;;
$item_set_selected = false ;
$output.= '';
$output.= '
';
if(get_option('geodir_enable_country') !='default' ):
$output.= '- '. __('Country',GEODIRLOCATION_TEXTDOMAIN).'
';
endif;
if(get_option('geodir_enable_region') !='default' ):
$output.= '- '. __('Region',GEODIRLOCATION_TEXTDOMAIN).'
';
endif;
if(get_option('geodir_enable_city') !='default' ):
$output.= '- '. __('City',GEODIRLOCATION_TEXTDOMAIN).'
';
endif;
$output.= '
';
$output.= '
';
$output.= '
';
$output.= '';
$output.= "
";
$output.= '
';
if($echo)
echo $output;
else
return $output;
}
}