function smart_ip_views_bridge_substitute_token_value in Smart IP 6.2
Same name and namespace in other branches
- 6 modules/smart_ip_views_bridge/smart_ip_views_bridge.module \smart_ip_views_bridge_substitute_token_value()
- 7.2 modules/smart_ip_views_bridge/smart_ip_views_bridge.module \smart_ip_views_bridge_substitute_token_value()
Substitute token to Smart IP value
5 calls to smart_ip_views_bridge_substitute_token_value()
- smart_ip_views_bridge_openlayers_proximity_handler_filter_circle::exposed_form in modules/
smart_ip_views_bridge/ views/ smart_ip_views_bridge_openlayers_proximity_handler_filter_circle.inc - Render our chunk of the exposed filter form when selecting
- smart_ip_views_bridge_openlayers_proximity_handler_filter_circle::op_process in modules/
smart_ip_views_bridge/ views/ smart_ip_views_bridge_openlayers_proximity_handler_filter_circle.inc - Process operator.
- smart_ip_views_bridge_openlayers_proximity_handler_filter_square::exposed_form in modules/
smart_ip_views_bridge/ views/ smart_ip_views_bridge_openlayers_proximity_handler_filter_square.inc - Render our chunk of the exposed filter form when selecting
- smart_ip_views_bridge_openlayers_proximity_handler_filter_square::op_process in modules/
smart_ip_views_bridge/ views/ smart_ip_views_bridge_openlayers_proximity_handler_filter_square.inc - Process operator.
- smart_ip_views_bridge_views_pre_execute in modules/
smart_ip_views_bridge/ smart_ip_views_bridge.module - Implements hook_views_pre_execute(). Override the query SQL in a view
File
- modules/
smart_ip_views_bridge/ smart_ip_views_bridge.module, line 176 - Smart IP Views Bridge exposes Smart IP visitor's location details to Views field (coordinates, country, ISO 3166 2-character country code, region, region code (FIPS), city and zip) and filter (country, ISO 3166 2-character country code,…
Code
function smart_ip_views_bridge_substitute_token_value(&$view_filter_item, $token) {
$output = array();
$mutlti_smart_ip_tokens = explode(', ', $token);
foreach ($mutlti_smart_ip_tokens as $token) {
$smart_ip_index = explode('][', $token);
$smart_ip_index_count = count($smart_ip_index);
if ($smart_ip_index_count == 1) {
$smart_ip_index = explode('.', $token);
$smart_ip_index_count = count($smart_ip_index);
}
$smart_ip_session = smart_ip_session_get($smart_ip_index[0]);
if ($smart_ip_index_count == 3 && isset($smart_ip_session[$smart_ip_index[1]][$smart_ip_index[2]])) {
$output[] = $smart_ip_session[$smart_ip_index[1]][$smart_ip_index[2]];
}
}
if (!empty($output)) {
$view_filter_item = implode(', ', $output);
}
return $view_filter_item;
}