Exemplo n.º 1
0
             echo '</ul>';
             echo '</div>';
             // close div="find-media-media"
         }
     } else {
         echo '<p>', WT_I18N::translate('No results found.'), '</p>';
     }
     echo '</div>';
 }
 // Output Places
 if ($type == "place") {
     echo '<div id="find-output">';
     if (!$filter || $all) {
         $places = WT_Place::allPlaces(WT_GED_ID);
     } else {
         $places = WT_Place::findPlaces($filter, WT_GED_ID);
     }
     if ($places) {
         echo '<ul>';
         foreach ($places as $place) {
             echo '<li><a href="#" onclick="pasteid(\'', WT_Filter::escapeJs($place->getGedcomName()), '\');">';
             if (!$filter || $all) {
                 echo $place->getReverseName();
                 // When displaying all names, sort/display by the country, then region, etc.
             } else {
                 echo $place->getFullName();
                 // When we’ve searched for a place, sort by this place
             }
             echo '</a></li>';
         }
         echo '</ul>
Exemplo n.º 2
0
     // Fetch all data, regardless of privacy
     $rows = get_OBJE_rows($term);
     // Filter for privacy
     foreach ($rows as $row) {
         $media = WT_Media::getInstance($row->xref, $row->gedcom_id, $row->gedcom);
         if ($media->canShowName()) {
             $data[] = array('value' => $row->xref, 'label' => '<img src="' . $media->getHtmlUrlDirect() . '" width="25"> ' . $media->getFullName());
         }
     }
     echo json_encode($data);
     exit;
 case 'PLAC':
     // Place names (with hierarchy), that include the search term
     // Do not filter by privacy.  Place names on their own do not identify individuals.
     $data = array();
     foreach (WT_Place::findPlaces($term, WT_GED_ID) as $place) {
         $data[] = $place->getGedcomName();
     }
     if (!$data && get_gedcom_setting(WT_GED_ID, 'GEONAMES_ACCOUNT')) {
         // No place found?  Use an external gazetteer
         $url = "http://api.geonames.org/searchJSON" . "?name_startsWith=" . urlencode($term) . "&lang=" . WT_LOCALE . "&fcode=CMTY&fcode=ADM4&fcode=PPL&fcode=PPLA&fcode=PPLC" . "&style=full" . "&username=" . get_gedcom_setting(WT_GED_ID, 'GEONAMES_ACCOUNT');
         // try to use curl when file_get_contents not allowed
         if (ini_get('allow_url_fopen')) {
             $json = file_get_contents($url);
         } elseif (function_exists('curl_init')) {
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $url);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             $json = curl_exec($ch);
             curl_close($ch);
         } else {