Skip to content

Commit ea4e5fa

Browse files
authored
Merge pull request #2 from 7tonin/7tonin-patch-4
new function to better feed get_image_ids_for_tags
2 parents f6542d6 + 3b5b224 commit ea4e5fa

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

include/functions_map.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function osm_get_gps($page)
6666
}
6767
if ($page['section'] === 'tags' and isset($page['tags']) and isset($page['tags'][0]['id']) )
6868
{
69-
$items = get_image_ids_for_tags( array($page['tags'][0]['id']) );
69+
$items = get_image_ids_for_tags( array_reduce( $page['tags'], 'osm_get_page_tag_id' ) );
7070
if ( !empty($items) )
7171
{
7272
$LIMIT_SEARCH = "ic.image_id IN (".implode(',', $items).") AND ";
@@ -111,7 +111,7 @@ function osm_get_items($page)
111111
}
112112
if ($page['section'] === 'tags' and isset($page['tags']) and isset($page['tags'][0]['id']) )
113113
{
114-
$items = get_image_ids_for_tags( array($page['tags'][0]['id']) );
114+
$items = get_image_ids_for_tags( array_reduce( $page['tags'], 'osm_get_page_tag_id' ) );
115115
if ( !empty($items) )
116116
{
117117
$LIMIT_SEARCH = "ic.image_id IN (".implode(',', $items).") AND ";
@@ -607,4 +607,18 @@ function osm_bounds_from_url($str)
607607
return $b;
608608
}
609609

610+
/**
611+
* What is the id of this page tag ?
612+
*
613+
* Note : this function is called to grab every tags in a page
614+
*
615+
* @param array basket to collect id
616+
* @param array page tag
617+
* @return basket
618+
*/
619+
function osm_get_page_tag_id($basket, $page_tag) {
620+
$basket[] = $page_tag['id'];
621+
return $basket;
622+
}
623+
610624
?>

0 commit comments

Comments
 (0)