diff --git a/lib/output.php b/lib/output.php index 823a6631..8de81576 100644 --- a/lib/output.php +++ b/lib/output.php @@ -16,58 +16,3 @@ function formatOSMType($sType, $bIncludeExternal = true) return ''; } - -function osmLink($aFeature, $sRefText = false) -{ - $sOSMType = formatOSMType($aFeature['osm_type'], false); - if ($sOSMType) { - return ''.$sOSMType.' '.($sRefText?$sRefText:$aFeature['osm_id']).''; - } - return ''; -} - -function wikipediaLink($aFeature) -{ - if ($aFeature['wikipedia']) { - list($sLanguage, $sArticle) = explode(':', $aFeature['wikipedia']); - return ''.$aFeature['wikipedia'].''; - } - return ''; -} - -function detailsLink($aFeature, $sTitle = false, $sExtraProperties = false) -{ - if (!$aFeature['place_id']) return ''; - - $sHtml = ''.($sTitle?$sTitle:$aFeature['place_id']).''; - - return $sHtml; -} - -function detailsPermaLink($aFeature, $sRefText = false, $sExtraProperties = false) -{ - $sOSMType = formatOSMType($aFeature['osm_type'], false); - - if ($sOSMType) { - $sHtml = ''; - - if ($sRefText) { - $sHtml .= $sRefText.''; - } else { - $sHtml .= $sOSMType.' '.$aFeature['osm_id'].''; - } - - return $sHtml; - } - return detailsLink($aFeature, $sRefText, $sExtraProperties); -} diff --git a/test/php/Nominatim/OutputTest.php b/test/php/Nominatim/OutputTest.php deleted file mode 100644 index cbfebb7d..00000000 --- a/test/php/Nominatim/OutputTest.php +++ /dev/null @@ -1,71 +0,0 @@ - 'N', 'osm_id'=> 38274, 'class' => 'place'); - $this->assertSame( - detailsPermaLink($aFeature), - 'node 38274' - ); - } - - public function testDetailsPermaLinkWay() - { - $aFeature = array('osm_type' => 'W', 'osm_id'=> 65, 'class' => 'highway'); - $this->assertSame( - detailsPermaLink($aFeature), - 'way 65' - ); - } - - public function testDetailsPermaLinkRelation() - { - $aFeature = array('osm_type' => 'R', 'osm_id'=> 9908, 'class' => 'waterway'); - $this->assertSame( - detailsPermaLink($aFeature), - 'relation 9908' - ); - } - - public function testDetailsPermaLinkTiger() - { - $aFeature = array('osm_type' => 'T', 'osm_id'=> 2, 'place_id' => 334); - $this->assertSame( - detailsPermaLink($aFeature, 'foo'), - 'foo' - ); - } - - public function testDetailsPermaLinkInterpolation() - { - $aFeature = array('osm_type' => 'I', 'osm_id'=> 400, 'place_id' => 3); - $this->assertSame( - detailsPermaLink($aFeature, 'foo'), - 'foo' - ); - } - - public function testDetailsPermaLinkWithExtraPropertiesNode() - { - $aFeature = array('osm_type' => 'N', 'osm_id'=> 2, 'class' => 'amenity'); - $this->assertSame( - detailsPermaLink($aFeature, 'something', 'class="xtype"'), - 'something' - ); - } - - public function testDetailsPermaLinkWithExtraPropertiesTiger() - { - $aFeature = array('osm_type' => 'T', 'osm_id'=> 5, 'place_id' => 46); - $this->assertSame( - detailsPermaLink($aFeature, 'something', 'class="xtype"'), - 'something' - ); - } -}