| @@ -23,40 +23,40 @@ | ||
| 23 | 23 | */ | 
| 24 | 24 |  class general_plugin_geotag_test extends DokuWikiTest { | 
| 25 | 25 | |
| 26 | -    protected $pluginsEnabled = array('geotag'); | |
| 26 | +	protected $pluginsEnabled = array('geotag'); | |
| 27 | 27 | |
| 28 | - /** | |
| 29 | - * Simple test to make sure the plugin.info.txt is in correct format | |
| 30 | - */ | |
| 31 | -    public function test_plugininfo(): void { | |
| 32 | - $file = __DIR__ . '/../plugin.info.txt'; | |
| 33 | - $this->assertFileExists($file); | |
| 28 | + /** | |
| 29 | + * Simple test to make sure the plugin.info.txt is in correct format | |
| 30 | + */ | |
| 31 | +	public function test_plugininfo(): void { | |
| 32 | + $file = __DIR__ . '/../plugin.info.txt'; | |
| 33 | + $this->assertFileExists($file); | |
| 34 | 34 | |
| 35 | - $info = confToHash($file); | |
| 35 | + $info = confToHash($file); | |
| 36 | 36 | |
| 37 | -        $this->assertArrayHasKey('base', $info); | |
| 38 | -        $this->assertArrayHasKey('author', $info); | |
| 39 | -        $this->assertArrayHasKey('email', $info); | |
| 40 | -        $this->assertArrayHasKey('date', $info); | |
| 41 | -        $this->assertArrayHasKey('name', $info); | |
| 42 | -        $this->assertArrayHasKey('desc', $info); | |
| 43 | -        $this->assertArrayHasKey('url', $info); | |
| 37 | +		$this->assertArrayHasKey('base', $info); | |
| 38 | +		$this->assertArrayHasKey('author', $info); | |
| 39 | +		$this->assertArrayHasKey('email', $info); | |
| 40 | +		$this->assertArrayHasKey('date', $info); | |
| 41 | +		$this->assertArrayHasKey('name', $info); | |
| 42 | +		$this->assertArrayHasKey('desc', $info); | |
| 43 | +		$this->assertArrayHasKey('url', $info); | |
| 44 | 44 | |
| 45 | -        $this->assertEquals('geotag', $info['base']); | |
| 46 | -        $this->assertRegExp('/^https?:\/\//', $info['url']); | |
| 47 | - $this->assertTrue(mail_isvalid($info['email'])); | |
| 48 | -        $this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); | |
| 49 | - $this->assertTrue(false !== strtotime($info['date'])); | |
| 50 | - } | |
| 45 | +		$this->assertEquals('geotag', $info['base']); | |
| 46 | +		$this->assertRegExp('/^https?:\/\//', $info['url']); | |
| 47 | + $this->assertTrue(mail_isvalid($info['email'])); | |
| 48 | +		$this->assertRegExp('/^\d\d\d\d-\d\d-\d\d$/', $info['date']); | |
| 49 | + $this->assertTrue(false !== strtotime($info['date'])); | |
| 50 | + } | |
| 51 | 51 | |
| 52 | - /** | |
| 53 | - * test if plugin is loaded. | |
| 54 | - */ | |
| 55 | -    public function test_plugin_geotag_isloaded(): void { | |
| 56 | - global $plugin_controller; | |
| 57 | - $this->assertTrue( | |
| 58 | -                    in_array('geotag', $plugin_controller->getList()), | |
| 59 | - "geotag plugin is loaded" | |
| 60 | - ); | |
| 61 | - } | |
| 52 | + /** | |
| 53 | + * test if plugin is loaded. | |
| 54 | + */ | |
| 55 | +	public function test_plugin_geotag_isloaded(): void { | |
| 56 | + global $plugin_controller; | |
| 57 | + $this->assertTrue( | |
| 58 | +					in_array('geotag', $plugin_controller->getList()), | |
| 59 | + "geotag plugin is loaded" | |
| 60 | + ); | |
| 61 | + } | |
| 62 | 62 | } | 
| @@ -23,101 +23,101 @@ | ||
| 23 | 23 | */ | 
| 24 | 24 |  class syntax_plugin_geotag_test extends DokuWikiTest { | 
| 25 | 25 | |
| 26 | -    protected $pluginsEnabled = array('geotag'); | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * copy data and add pages to the index. | |
| 30 | - */ | |
| 31 | -    public static function setUpBeforeClass(): void { | |
| 32 | - parent::setUpBeforeClass(); | |
| 33 | - global $conf; | |
| 34 | - $conf['allowdebug'] = 1; | |
| 35 | - | |
| 36 | - TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/data/'); | |
| 37 | - | |
| 38 | -        dbglog("\nset up class syntax_plugin_geotag_test"); | |
| 39 | - } | |
| 40 | - | |
| 41 | -    public function setUp(): void { | |
| 42 | - parent::setUp(); | |
| 43 | - | |
| 44 | - global $conf; | |
| 45 | - $conf['allowdebug'] = 1; | |
| 46 | - $conf['cachetime'] = -1; | |
| 47 | - | |
| 48 | - $data = array(); | |
| 49 | -        search($data, $conf['datadir'], 'search_allpages', array('skipacl' => true)); | |
| 50 | - | |
| 51 | - $verbose = false; | |
| 52 | - $force = false; | |
| 53 | -        foreach ($data as $val) { | |
| 54 | - idx_addPage($val['id'], $verbose, $force); | |
| 55 | - } | |
| 56 | -        if ($conf['allowdebug']) { | |
| 57 | - touch(DOKU_TMP_DATA . 'cache/debug.log'); | |
| 58 | - } | |
| 59 | - } | |
| 60 | - | |
| 61 | -    public function tearDown(): void { | |
| 62 | - parent::tearDown(); | |
| 63 | - | |
| 64 | - global $conf; | |
| 65 | - // try to get the debug log after running the test, print and clear | |
| 66 | -        if ($conf['allowdebug']) { | |
| 67 | - print "\n"; | |
| 68 | - readfile(DOKU_TMP_DATA . 'cache/debug.log'); | |
| 69 | - unlink(DOKU_TMP_DATA . 'cache/debug.log'); | |
| 70 | - } | |
| 71 | - } | |
| 72 | - | |
| 73 | -    public function test_geotag(): void { | |
| 74 | - $request = new TestRequest(); | |
| 75 | -        $response = $request->get(array('id'=>'minimalgeotag'), '/doku.php'); | |
| 76 | - | |
| 77 | -        $this->assertEquals('minimalgeotag', | |
| 78 | -                        $response->queryHTML('meta[name="keywords"]')->attr('content')); | |
| 79 | -        $this->assertEquals('51.565696;5.324596', | |
| 80 | -                        $response->queryHTML('meta[name="geo.position"]')->attr('content')); | |
| 81 | -        $this->assertEquals('51.565696, 5.324596', | |
| 82 | -                        $response->queryHTML('meta[name="ICBM"]')->attr('content')); | |
| 83 | - | |
| 84 | - $this->assertTrue( | |
| 85 | - strpos($response->getContent(), 'Geotag (location) for:') !== false, | |
| 86 | - '"Geotag (location) for:" was not in the output' | |
| 87 | - ); | |
| 88 | - } | |
| 89 | - | |
| 90 | -    public function test_fullgeotag(): void { | |
| 91 | - $request = new TestRequest(); | |
| 92 | -        $response = $request->get(array('id'=>'fullgeotag'), '/doku.php'); | |
| 93 | - | |
| 94 | -        $this->assertEquals('fullgeotag', | |
| 95 | -                        $response->queryHTML('meta[name="keywords"]')->attr('content')); | |
| 96 | -        $this->assertEquals('52.132633;5.291266;9', | |
| 97 | -                        $response->queryHTML('meta[name="geo.position"]')->attr('content')); | |
| 98 | -        $this->assertEquals('52.132633, 5.291266', | |
| 99 | -                        $response->queryHTML('meta[name="ICBM"]')->attr('content')); | |
| 100 | - | |
| 101 | - $this->assertTrue( | |
| 102 | - strpos($response->getContent(), 'Geotag (location) for:') !== false, | |
| 103 | - '"Geotag (location) for:" was not in the output' | |
| 104 | - ); | |
| 105 | - } | |
| 106 | - | |
| 107 | -    public function test_fullgeotagnegativecoords(): void { | |
| 108 | - $request = new TestRequest(); | |
| 109 | -        $response = $request->get(array('id'=>'fullgeotagnegativecoords'), '/doku.php'); | |
| 110 | - | |
| 111 | -        $this->assertEquals('fullgeotagnegativecoords', | |
| 112 | -                        $response->queryHTML('meta[name="keywords"]')->attr('content')); | |
| 113 | -        $this->assertEquals('-52.132633;-5.291266;-9', | |
| 114 | -                        $response->queryHTML('meta[name="geo.position"]')->attr('content')); | |
| 115 | -        $this->assertEquals('-52.132633, -5.291266', | |
| 116 | -                        $response->queryHTML('meta[name="ICBM"]')->attr('content')); | |
| 117 | - | |
| 118 | - $this->assertTrue( | |
| 119 | - strpos($response->getContent(), 'Geotag (location) for:') !== false, | |
| 120 | - '"Geotag (location) for:" was not in the output' | |
| 121 | - ); | |
| 122 | - } | |
| 26 | +	protected $pluginsEnabled = array('geotag'); | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * copy data and add pages to the index. | |
| 30 | + */ | |
| 31 | +	public static function setUpBeforeClass(): void { | |
| 32 | + parent::setUpBeforeClass(); | |
| 33 | + global $conf; | |
| 34 | + $conf['allowdebug'] = 1; | |
| 35 | + | |
| 36 | + TestUtils::rcopy(TMP_DIR, dirname(__FILE__) . '/data/'); | |
| 37 | + | |
| 38 | +		dbglog("\nset up class syntax_plugin_geotag_test"); | |
| 39 | + } | |
| 40 | + | |
| 41 | +	public function setUp(): void { | |
| 42 | + parent::setUp(); | |
| 43 | + | |
| 44 | + global $conf; | |
| 45 | + $conf['allowdebug'] = 1; | |
| 46 | + $conf['cachetime'] = -1; | |
| 47 | + | |
| 48 | + $data = array(); | |
| 49 | +		search($data, $conf['datadir'], 'search_allpages', array('skipacl' => true)); | |
| 50 | + | |
| 51 | + $verbose = false; | |
| 52 | + $force = false; | |
| 53 | +		foreach ($data as $val) { | |
| 54 | + idx_addPage($val['id'], $verbose, $force); | |
| 55 | + } | |
| 56 | +		if ($conf['allowdebug']) { | |
| 57 | + touch(DOKU_TMP_DATA . 'cache/debug.log'); | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 61 | +	public function tearDown(): void { | |
| 62 | + parent::tearDown(); | |
| 63 | + | |
| 64 | + global $conf; | |
| 65 | + // try to get the debug log after running the test, print and clear | |
| 66 | +		if ($conf['allowdebug']) { | |
| 67 | + print "\n"; | |
| 68 | + readfile(DOKU_TMP_DATA . 'cache/debug.log'); | |
| 69 | + unlink(DOKU_TMP_DATA . 'cache/debug.log'); | |
| 70 | + } | |
| 71 | + } | |
| 72 | + | |
| 73 | +	public function test_geotag(): void { | |
| 74 | + $request = new TestRequest(); | |
| 75 | +		$response = $request->get(array('id'=>'minimalgeotag'), '/doku.php'); | |
| 76 | + | |
| 77 | +		$this->assertEquals('minimalgeotag', | |
| 78 | +						$response->queryHTML('meta[name="keywords"]')->attr('content')); | |
| 79 | +		$this->assertEquals('51.565696;5.324596', | |
| 80 | +						$response->queryHTML('meta[name="geo.position"]')->attr('content')); | |
| 81 | +		$this->assertEquals('51.565696, 5.324596', | |
| 82 | +						$response->queryHTML('meta[name="ICBM"]')->attr('content')); | |
| 83 | + | |
| 84 | + $this->assertTrue( | |
| 85 | + strpos($response->getContent(), 'Geotag (location) for:') !== false, | |
| 86 | + '"Geotag (location) for:" was not in the output' | |
| 87 | + ); | |
| 88 | + } | |
| 89 | + | |
| 90 | +	public function test_fullgeotag(): void { | |
| 91 | + $request = new TestRequest(); | |
| 92 | +		$response = $request->get(array('id'=>'fullgeotag'), '/doku.php'); | |
| 93 | + | |
| 94 | +		$this->assertEquals('fullgeotag', | |
| 95 | +						$response->queryHTML('meta[name="keywords"]')->attr('content')); | |
| 96 | +		$this->assertEquals('52.132633;5.291266;9', | |
| 97 | +						$response->queryHTML('meta[name="geo.position"]')->attr('content')); | |
| 98 | +		$this->assertEquals('52.132633, 5.291266', | |
| 99 | +						$response->queryHTML('meta[name="ICBM"]')->attr('content')); | |
| 100 | + | |
| 101 | + $this->assertTrue( | |
| 102 | + strpos($response->getContent(), 'Geotag (location) for:') !== false, | |
| 103 | + '"Geotag (location) for:" was not in the output' | |
| 104 | + ); | |
| 105 | + } | |
| 106 | + | |
| 107 | +	public function test_fullgeotagnegativecoords(): void { | |
| 108 | + $request = new TestRequest(); | |
| 109 | +		$response = $request->get(array('id'=>'fullgeotagnegativecoords'), '/doku.php'); | |
| 110 | + | |
| 111 | +		$this->assertEquals('fullgeotagnegativecoords', | |
| 112 | +						$response->queryHTML('meta[name="keywords"]')->attr('content')); | |
| 113 | +		$this->assertEquals('-52.132633;-5.291266;-9', | |
| 114 | +						$response->queryHTML('meta[name="geo.position"]')->attr('content')); | |
| 115 | +		$this->assertEquals('-52.132633, -5.291266', | |
| 116 | +						$response->queryHTML('meta[name="ICBM"]')->attr('content')); | |
| 117 | + | |
| 118 | + $this->assertTrue( | |
| 119 | + strpos($response->getContent(), 'Geotag (location) for:') !== false, | |
| 120 | + '"Geotag (location) for:" was not in the output' | |
| 121 | + ); | |
| 122 | + } | |
| 123 | 123 | } | 
| @@ -23,115 +23,115 @@ | ||
| 23 | 23 | */ | 
| 24 | 24 |  class action_plugin_geotag extends DokuWiki_Action_Plugin { | 
| 25 | 25 | |
| 26 | - /** | |
| 27 | - * Register for events. | |
| 28 | - * | |
| 29 | - * @param Doku_Event_Handler $controller | |
| 30 | - * DokuWiki's event controller object. Also available as global $EVENT_HANDLER | |
| 31 | - */ | |
| 32 | -    public function register(Doku_Event_Handler $controller) { | |
| 33 | -        $controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handleMetaheaderOutput'); | |
| 34 | -        if ($this->getConf('toolbar_icon')) { | |
| 35 | -            $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insertButton', array()); | |
| 36 | - } | |
| 37 | - } | |
| 26 | + /** | |
| 27 | + * Register for events. | |
| 28 | + * | |
| 29 | + * @param Doku_Event_Handler $controller | |
| 30 | + * DokuWiki's event controller object. Also available as global $EVENT_HANDLER | |
| 31 | + */ | |
| 32 | +	public function register(Doku_Event_Handler $controller) { | |
| 33 | +		$controller->register_hook('TPL_METAHEADER_OUTPUT', 'BEFORE', $this, 'handleMetaheaderOutput'); | |
| 34 | +		if ($this->getConf('toolbar_icon')) { | |
| 35 | +			$controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'insertButton', array()); | |
| 36 | + } | |
| 37 | + } | |
| 38 | 38 | |
| 39 | - /** | |
| 40 | - * Retrieve metadata and add to the head of the page using appropriate meta tags. | |
| 41 | - * | |
| 42 | - * @param Doku_Event $event | |
| 43 | - * the DokuWiki event. $event->data is a two-dimensional | |
| 44 | - * array of all meta headers. The keys are meta, link and script. | |
| 45 | - * @param unknown_type $param | |
| 46 | - * | |
| 47 | - * @see http://www.dokuwiki.org/devel:event:tpl_metaheader_output | |
| 48 | - */ | |
| 49 | -    public function handleMetaheaderOutput(Doku_Event $event, $param) { | |
| 50 | - global $ID; | |
| 51 | - $title = p_get_metadata($ID, 'title', true); | |
| 52 | - $geotags = p_get_metadata($ID, 'geo', true); | |
| 53 | - $region = $geotags ['region']; | |
| 54 | - $lat = $geotags ['lat']; | |
| 55 | - $lon = $geotags ['lon']; | |
| 56 | - $alt = $geotags ['alt']; | |
| 57 | - $country = $geotags ['country']; | |
| 58 | - $placename = $geotags ['placename']; | |
| 59 | - $geohash = $geotags ['geohash']; | |
| 39 | + /** | |
| 40 | + * Retrieve metadata and add to the head of the page using appropriate meta tags. | |
| 41 | + * | |
| 42 | + * @param Doku_Event $event | |
| 43 | + * the DokuWiki event. $event->data is a two-dimensional | |
| 44 | + * array of all meta headers. The keys are meta, link and script. | |
| 45 | + * @param unknown_type $param | |
| 46 | + * | |
| 47 | + * @see http://www.dokuwiki.org/devel:event:tpl_metaheader_output | |
| 48 | + */ | |
| 49 | +	public function handleMetaheaderOutput(Doku_Event $event, $param) { | |
| 50 | + global $ID; | |
| 51 | + $title = p_get_metadata($ID, 'title', true); | |
| 52 | + $geotags = p_get_metadata($ID, 'geo', true); | |
| 53 | + $region = $geotags ['region']; | |
| 54 | + $lat = $geotags ['lat']; | |
| 55 | + $lon = $geotags ['lon']; | |
| 56 | + $alt = $geotags ['alt']; | |
| 57 | + $country = $geotags ['country']; | |
| 58 | + $placename = $geotags ['placename']; | |
| 59 | + $geohash = $geotags ['geohash']; | |
| 60 | 60 | |
| 61 | -        if (!empty ($region)) { | |
| 62 | - $event->data ['meta'] [] = array( | |
| 63 | - 'name' => 'geo.region', | |
| 64 | - 'content' => $region | |
| 65 | - ); | |
| 66 | - } | |
| 67 | -        if (!empty ($placename)) { | |
| 68 | - $event->data ['meta'] [] = array( | |
| 69 | - 'name' => 'geo.placename', | |
| 70 | - 'content' => $placename | |
| 71 | - ); | |
| 72 | - } | |
| 73 | -        if (!(empty ($lat) && empty ($lon))) { | |
| 74 | -            if (!empty ($alt)) { | |
| 75 | - $event->data ['meta'] [] = array( | |
| 76 | - 'name' => 'geo.position', | |
| 77 | - 'content' => $lat . ';' . $lon . ';' . $alt | |
| 78 | - ); | |
| 79 | -            } else { | |
| 80 | - $event->data ['meta'] [] = array( | |
| 81 | - 'name' => 'geo.position', | |
| 82 | - 'content' => $lat . ';' . $lon | |
| 83 | - ); | |
| 84 | - } | |
| 85 | - } | |
| 86 | -        if (!empty ($country)) { | |
| 87 | - $event->data ['meta'] [] = array( | |
| 88 | - 'name' => 'geo.country', | |
| 89 | - 'content' => $country | |
| 90 | - ); | |
| 91 | - } | |
| 92 | -        if (!(empty ($lat) && empty ($lon))) { | |
| 93 | - $event->data ['meta'] [] = array( | |
| 94 | - 'name' => "ICBM", | |
| 95 | - 'content' => $lat . ', ' . $lon | |
| 96 | - ); | |
| 97 | - // icbm is generally useless without a DC.title, | |
| 98 | - // so we copy that from title unless it's empty... | |
| 99 | -            if (!(empty ($title))) { | |
| 100 | - /* | |
| 61 | +		if (!empty ($region)) { | |
| 62 | + $event->data ['meta'] [] = array( | |
| 63 | + 'name' => 'geo.region', | |
| 64 | + 'content' => $region | |
| 65 | + ); | |
| 66 | + } | |
| 67 | +		if (!empty ($placename)) { | |
| 68 | + $event->data ['meta'] [] = array( | |
| 69 | + 'name' => 'geo.placename', | |
| 70 | + 'content' => $placename | |
| 71 | + ); | |
| 72 | + } | |
| 73 | +		if (!(empty ($lat) && empty ($lon))) { | |
| 74 | +			if (!empty ($alt)) { | |
| 75 | + $event->data ['meta'] [] = array( | |
| 76 | + 'name' => 'geo.position', | |
| 77 | + 'content' => $lat . ';' . $lon . ';' . $alt | |
| 78 | + ); | |
| 79 | +			} else { | |
| 80 | + $event->data ['meta'] [] = array( | |
| 81 | + 'name' => 'geo.position', | |
| 82 | + 'content' => $lat . ';' . $lon | |
| 83 | + ); | |
| 84 | + } | |
| 85 | + } | |
| 86 | +		if (!empty ($country)) { | |
| 87 | + $event->data ['meta'] [] = array( | |
| 88 | + 'name' => 'geo.country', | |
| 89 | + 'content' => $country | |
| 90 | + ); | |
| 91 | + } | |
| 92 | +		if (!(empty ($lat) && empty ($lon))) { | |
| 93 | + $event->data ['meta'] [] = array( | |
| 94 | + 'name' => "ICBM", | |
| 95 | + 'content' => $lat . ', ' . $lon | |
| 96 | + ); | |
| 97 | + // icbm is generally useless without a DC.title, | |
| 98 | + // so we copy that from title unless it's empty... | |
| 99 | +			if (!(empty ($title))) { | |
| 100 | + /* | |
| 101 | 101 | * don't specify the DC namespace as this is incomplete; it should be done at the | 
| 102 | 102 | * template level as it also needs a 'profile' attribute on the head/container, | 
| 103 | 103 | * see: http://dublincore.org/documents/dc-html/#sect-3.1.1 | 
| 104 | 104 |                   * $event->data ['link'] [] = array ('rel' => 'schema.DC', | 
| 105 | 105 | * 'href' => 'http://purl.org/dc/elements/1.1/'); | 
| 106 | 106 | */ | 
| 107 | - $event->data ['meta'] [] = array( | |
| 108 | - 'name' => "DC.title", | |
| 109 | - 'content' => $title | |
| 110 | - ); | |
| 111 | - } | |
| 112 | - } | |
| 113 | -        if (!empty ($geohash)) { | |
| 114 | - $event->data ['meta'] [] = array( | |
| 115 | - 'name' => 'geo.geohash', | |
| 116 | - 'content' => $geohash | |
| 117 | - ); | |
| 118 | - } | |
| 119 | - } | |
| 107 | + $event->data ['meta'] [] = array( | |
| 108 | + 'name' => "DC.title", | |
| 109 | + 'content' => $title | |
| 110 | + ); | |
| 111 | + } | |
| 112 | + } | |
| 113 | +		if (!empty ($geohash)) { | |
| 114 | + $event->data ['meta'] [] = array( | |
| 115 | + 'name' => 'geo.geohash', | |
| 116 | + 'content' => $geohash | |
| 117 | + ); | |
| 118 | + } | |
| 119 | + } | |
| 120 | 120 | |
| 121 | - /** | |
| 122 | - * Inserts the toolbar button. | |
| 123 | - * | |
| 124 | - * @param Doku_Event $event | |
| 125 | - * the DokuWiki event | |
| 126 | - */ | |
| 127 | -    public function insertButton(Doku_Event $event, $param) { | |
| 128 | - $event->data [] = array( | |
| 129 | - 'type' => 'format', | |
| 130 | -                'title' => $this->getLang('toolbar_desc'), | |
| 131 | - 'icon' => '../../plugins/geotag/images/geotag.png', | |
| 132 | -                'open' => '{{geotag>lat:', | |
| 133 | - 'sample' => '52.2345', | |
| 134 | - 'close' => ', lon:7.521, alt: , placename: , country: , region: }}' | |
| 135 | - ); | |
| 136 | - } | |
| 121 | + /** | |
| 122 | + * Inserts the toolbar button. | |
| 123 | + * | |
| 124 | + * @param Doku_Event $event | |
| 125 | + * the DokuWiki event | |
| 126 | + */ | |
| 127 | +	public function insertButton(Doku_Event $event, $param) { | |
| 128 | + $event->data [] = array( | |
| 129 | + 'type' => 'format', | |
| 130 | +				'title' => $this->getLang('toolbar_desc'), | |
| 131 | + 'icon' => '../../plugins/geotag/images/geotag.png', | |
| 132 | +				'open' => '{{geotag>lat:', | |
| 133 | + 'sample' => '52.2345', | |
| 134 | + 'close' => ', lon:7.521, alt: , placename: , country: , region: }}' | |
| 135 | + ); | |
| 136 | + } | |
| 137 | 137 | } | 
| @@ -24,230 +24,230 @@ | ||
| 24 | 24 | * @author Mark C. Prins <[email protected]> | 
| 25 | 25 | */ | 
| 26 | 26 |  class syntax_plugin_geotag_geotag extends DokuWiki_Syntax_Plugin { | 
| 27 | - /** | |
| 28 | - * | |
| 29 | - * @see DokuWiki_Syntax_Plugin::getType() | |
| 30 | - */ | |
| 31 | -    public function getType() { | |
| 32 | - return 'substition'; | |
| 33 | - } | |
| 27 | + /** | |
| 28 | + * | |
| 29 | + * @see DokuWiki_Syntax_Plugin::getType() | |
| 30 | + */ | |
| 31 | +	public function getType() { | |
| 32 | + return 'substition'; | |
| 33 | + } | |
| 34 | 34 | |
| 35 | - /** | |
| 36 | - * | |
| 37 | - * @see DokuWiki_Syntax_Plugin::getPType() | |
| 38 | - */ | |
| 39 | -    public function getPType() { | |
| 40 | - return 'block'; | |
| 41 | - } | |
| 35 | + /** | |
| 36 | + * | |
| 37 | + * @see DokuWiki_Syntax_Plugin::getPType() | |
| 38 | + */ | |
| 39 | +	public function getPType() { | |
| 40 | + return 'block'; | |
| 41 | + } | |
| 42 | 42 | |
| 43 | - /** | |
| 44 | - * | |
| 45 | - * @see Doku_Parser_Mode::getSort() | |
| 46 | - */ | |
| 47 | -    public function getSort() { | |
| 48 | - return 305; | |
| 49 | - } | |
| 43 | + /** | |
| 44 | + * | |
| 45 | + * @see Doku_Parser_Mode::getSort() | |
| 46 | + */ | |
| 47 | +	public function getSort() { | |
| 48 | + return 305; | |
| 49 | + } | |
| 50 | 50 | |
| 51 | - /** | |
| 52 | - * | |
| 53 | - * @see Doku_Parser_Mode::connectTo() | |
| 54 | - */ | |
| 55 | -    public function connectTo($mode) { | |
| 56 | -        $this->Lexer->addSpecialPattern('\{\{geotag>.*?\}\}', $mode, 'plugin_geotag_geotag'); | |
| 57 | - } | |
| 51 | + /** | |
| 52 | + * | |
| 53 | + * @see Doku_Parser_Mode::connectTo() | |
| 54 | + */ | |
| 55 | +	public function connectTo($mode) { | |
| 56 | +		$this->Lexer->addSpecialPattern('\{\{geotag>.*?\}\}', $mode, 'plugin_geotag_geotag'); | |
| 57 | + } | |
| 58 | 58 | |
| 59 | - /** | |
| 60 | - * | |
| 61 | - * @see DokuWiki_Syntax_Plugin::handle() | |
| 62 | - */ | |
| 63 | -    public function handle($match, $state, $pos, Doku_Handler $handler) { | |
| 64 | - $tags = trim(substr($match, 9, - 2)); | |
| 65 | - // parse geotag content | |
| 66 | -        preg_match("(lat[:|=]-?\d*\.\d*)", $tags, $lat); | |
| 67 | -        preg_match("(lon[:|=]-?\d*\.\d*)", $tags, $lon); | |
| 68 | -        preg_match("(alt[:|=]-?\d*\.?\d*)", $tags, $alt); | |
| 69 | -        preg_match("/(region[:|=][\p{L}\s\w'-]*)/u", $tags, $region); | |
| 70 | -        preg_match("/(placename[:|=][\p{L}\s\w'-]*)/u", $tags, $placename); | |
| 71 | -        preg_match("/(country[:|=][\p{L}\s\w'-]*)/u", $tags, $country); | |
| 72 | -        preg_match("(hide|unhide)", $tags, $hide); | |
| 59 | + /** | |
| 60 | + * | |
| 61 | + * @see DokuWiki_Syntax_Plugin::handle() | |
| 62 | + */ | |
| 63 | +	public function handle($match, $state, $pos, Doku_Handler $handler) { | |
| 64 | + $tags = trim(substr($match, 9, - 2)); | |
| 65 | + // parse geotag content | |
| 66 | +		preg_match("(lat[:|=]-?\d*\.\d*)", $tags, $lat); | |
| 67 | +		preg_match("(lon[:|=]-?\d*\.\d*)", $tags, $lon); | |
| 68 | +		preg_match("(alt[:|=]-?\d*\.?\d*)", $tags, $alt); | |
| 69 | +		preg_match("/(region[:|=][\p{L}\s\w'-]*)/u", $tags, $region); | |
| 70 | +		preg_match("/(placename[:|=][\p{L}\s\w'-]*)/u", $tags, $placename); | |
| 71 | +		preg_match("/(country[:|=][\p{L}\s\w'-]*)/u", $tags, $country); | |
| 72 | +		preg_match("(hide|unhide)", $tags, $hide); | |
| 73 | 73 | |
| 74 | -        $showlocation = $this->getConf('geotag_location_prefix'); | |
| 75 | -        if ($this->getConf('geotag_showlocation')) { | |
| 76 | - $showlocation = trim(substr($placename [0], 10)); | |
| 77 | -            if (strlen($showlocation) < 1) { | |
| 78 | -                $showlocation = $this->getConf('geotag_location_prefix'); | |
| 79 | - } | |
| 80 | - } | |
| 81 | - // read config for system setting | |
| 82 | - $style = ''; | |
| 83 | -        if ($this->getConf('geotag_hide')) { | |
| 84 | - $style = ' style="display: none;"'; | |
| 85 | - } | |
| 86 | - // override config for the current tag | |
| 87 | -        if (is_array($hide) && trim($hide [0]) == 'hide') { | |
| 88 | - $style = ' style="display: none;"'; | |
| 89 | -        } elseif (is_array($hide) && trim($hide [0]) == 'unhide') { | |
| 90 | - $style = ''; | |
| 91 | - } | |
| 74 | +		$showlocation = $this->getConf('geotag_location_prefix'); | |
| 75 | +		if ($this->getConf('geotag_showlocation')) { | |
| 76 | + $showlocation = trim(substr($placename [0], 10)); | |
| 77 | +			if (strlen($showlocation) < 1) { | |
| 78 | +				$showlocation = $this->getConf('geotag_location_prefix'); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + // read config for system setting | |
| 82 | + $style = ''; | |
| 83 | +		if ($this->getConf('geotag_hide')) { | |
| 84 | + $style = ' style="display: none;"'; | |
| 85 | + } | |
| 86 | + // override config for the current tag | |
| 87 | +		if (is_array($hide) && trim($hide [0]) == 'hide') { | |
| 88 | + $style = ' style="display: none;"'; | |
| 89 | +		} elseif (is_array($hide) && trim($hide [0]) == 'unhide') { | |
| 90 | + $style = ''; | |
| 91 | + } | |
| 92 | 92 | |
| 93 | - $data = array( | |
| 94 | - hsc(trim(substr($lat [0], 4))), | |
| 95 | - hsc(trim(substr($lon [0], 4))), | |
| 96 | - hsc(trim(substr($alt [0], 4))), | |
| 97 | - $this->geohash(substr($lat [0], 4), substr($lon [0], 4)), | |
| 98 | - hsc(trim(substr($region [0], 7))), | |
| 99 | - hsc(trim(substr($placename [0], 10))), | |
| 100 | - hsc(trim(substr($country [0], 8))), | |
| 101 | - hsc($showlocation), | |
| 102 | - $style | |
| 103 | - ); | |
| 104 | - return $data; | |
| 105 | - } | |
| 93 | + $data = array( | |
| 94 | + hsc(trim(substr($lat [0], 4))), | |
| 95 | + hsc(trim(substr($lon [0], 4))), | |
| 96 | + hsc(trim(substr($alt [0], 4))), | |
| 97 | + $this->geohash(substr($lat [0], 4), substr($lon [0], 4)), | |
| 98 | + hsc(trim(substr($region [0], 7))), | |
| 99 | + hsc(trim(substr($placename [0], 10))), | |
| 100 | + hsc(trim(substr($country [0], 8))), | |
| 101 | + hsc($showlocation), | |
| 102 | + $style | |
| 103 | + ); | |
| 104 | + return $data; | |
| 105 | + } | |
| 106 | 106 | |
| 107 | - /** | |
| 108 | - * | |
| 109 | - * @see DokuWiki_Syntax_Plugin::render() | |
| 110 | - */ | |
| 111 | -    public function render($mode, Doku_Renderer $renderer, $data) { | |
| 112 | -        if ($data === false) { | |
| 113 | - return false; | |
| 114 | - } | |
| 115 | - list ($lat, $lon, $alt, $geohash, $region, $placename, $country, $showlocation, $style) = $data; | |
| 116 | - $ddlat = $lat; | |
| 117 | - $ddlon = $lon; | |
| 118 | -        if ($this->getConf('displayformat') === 'DMS') { | |
| 119 | - $lat = $this->convertLat($lat); | |
| 120 | - $lon = $this->convertLon($lon); | |
| 121 | -        } else { | |
| 122 | - $lat .= 'º'; | |
| 123 | - $lon .= 'º'; | |
| 124 | - } | |
| 107 | + /** | |
| 108 | + * | |
| 109 | + * @see DokuWiki_Syntax_Plugin::render() | |
| 110 | + */ | |
| 111 | +	public function render($mode, Doku_Renderer $renderer, $data) { | |
| 112 | +		if ($data === false) { | |
| 113 | + return false; | |
| 114 | + } | |
| 115 | + list ($lat, $lon, $alt, $geohash, $region, $placename, $country, $showlocation, $style) = $data; | |
| 116 | + $ddlat = $lat; | |
| 117 | + $ddlon = $lon; | |
| 118 | +		if ($this->getConf('displayformat') === 'DMS') { | |
| 119 | + $lat = $this->convertLat($lat); | |
| 120 | + $lon = $this->convertLon($lon); | |
| 121 | +		} else { | |
| 122 | + $lat .= 'º'; | |
| 123 | + $lon .= 'º'; | |
| 124 | + } | |
| 125 | 125 | |
| 126 | -        if ($mode == 'xhtml') { | |
| 127 | -            if ($this->getConf('geotag_prevent_microformat_render')) { | |
| 128 | - return true; | |
| 129 | - } | |
| 130 | - $searchPre = ''; | |
| 131 | - $searchPost = ''; | |
| 132 | -            if ($this->getConf('geotag_showsearch')) { | |
| 133 | -                if ($spHelper = &plugin_load('helper', 'spatialhelper_search')) { | |
| 134 | -                    $title = $this->getLang('findnearby') . ' ' . $placename; | |
| 135 | - $url = wl(getID(), array( | |
| 136 | - 'do' => 'findnearby', | |
| 137 | - 'lat' => $ddlat, | |
| 138 | - 'lon' => $ddlon | |
| 139 | - )); | |
| 140 | - $searchPre = '<a href="' . $url . '" title="' . $title . '">'; | |
| 141 | - $searchPost = '<span class="a11y">' . $title . '</span></a>'; | |
| 142 | - } | |
| 143 | - } | |
| 126 | +		if ($mode == 'xhtml') { | |
| 127 | +			if ($this->getConf('geotag_prevent_microformat_render')) { | |
| 128 | + return true; | |
| 129 | + } | |
| 130 | + $searchPre = ''; | |
| 131 | + $searchPost = ''; | |
| 132 | +			if ($this->getConf('geotag_showsearch')) { | |
| 133 | +				if ($spHelper = &plugin_load('helper', 'spatialhelper_search')) { | |
| 134 | +					$title = $this->getLang('findnearby') . ' ' . $placename; | |
| 135 | + $url = wl(getID(), array( | |
| 136 | + 'do' => 'findnearby', | |
| 137 | + 'lat' => $ddlat, | |
| 138 | + 'lon' => $ddlon | |
| 139 | + )); | |
| 140 | + $searchPre = '<a href="' . $url . '" title="' . $title . '">'; | |
| 141 | + $searchPost = '<span class="a11y">' . $title . '</span></a>'; | |
| 142 | + } | |
| 143 | + } | |
| 144 | 144 | |
| 145 | - // render geotag microformat/schema.org microdata | |
| 146 | -            $renderer->doc .= '<span class="geotagPrint">' . $this->getLang('geotag_desc') . '</span>'; | |
| 147 | -            $renderer->doc .= '<div class="h-geo geo"' . $style . ' title="' . $this->getLang('geotag_desc') | |
| 148 | - . $placename . '" itemscope itemtype="http://schema.org/Place">'; | |
| 149 | - $renderer->doc .= '<span itemprop="name">' . $showlocation . '</span>: ' . $searchPre; | |
| 150 | - $renderer->doc .= '<span itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">'; | |
| 151 | - $renderer->doc .= '<span class="p-latitude latitude" itemprop="latitude" data-latitude="' . $ddlat . '">' | |
| 152 | - . $lat . '</span>;'; | |
| 153 | - $renderer->doc .= '<span class="p-longitude longitude" itemprop="longitude" data-longitude="' . $ddlon | |
| 154 | - . '">' . $lon . '</span>'; | |
| 155 | -            if (!empty ($alt)) { | |
| 156 | - $renderer->doc .= ', <span class="p-altitude altitude" itemprop="elevation" data-altitude="' . $alt | |
| 157 | - . '">' . $alt . 'm</span>'; | |
| 158 | - } | |
| 159 | - $renderer->doc .= '</span>' . $searchPost . '</div>' . DOKU_LF; | |
| 160 | - return true; | |
| 161 | -        } elseif ($mode == 'metadata') { | |
| 162 | - // render metadata (our action plugin will put it in the page head) | |
| 163 | - $renderer->meta ['geo'] ['lat'] = $ddlat; | |
| 164 | - $renderer->meta ['geo'] ['lon'] = $ddlon; | |
| 165 | - $renderer->meta ['geo'] ['placename'] = $placename; | |
| 166 | - $renderer->meta ['geo'] ['region'] = $region; | |
| 167 | - $renderer->meta ['geo'] ['country'] = $country; | |
| 168 | - $renderer->meta ['geo'] ['geohash'] = $geohash; | |
| 169 | - $renderer->meta ['geo'] ['alt'] = $alt; | |
| 170 | - return true; | |
| 171 | -        } elseif ($mode == 'odt') { | |
| 172 | -            if (!empty ($alt)) { | |
| 173 | - $alt = ', ' . $alt . 'm'; | |
| 174 | - } | |
| 175 | - $renderer->p_open(); | |
| 176 | - $renderer->_odtAddImage(DOKU_PLUGIN . 'geotag/images/geotag.png', null, null, 'left', ''); | |
| 177 | -            $renderer->cdata($this->getLang('geotag_desc') . ' ' . $placename); | |
| 178 | - $renderer->monospace_open(); | |
| 179 | - $renderer->cdata($lat . ';' . $lon . $alt); | |
| 180 | - $renderer->monospace_close(); | |
| 181 | - $renderer->p_close(); | |
| 182 | - return true; | |
| 183 | - } | |
| 184 | - return false; | |
| 185 | - } | |
| 145 | + // render geotag microformat/schema.org microdata | |
| 146 | +			$renderer->doc .= '<span class="geotagPrint">' . $this->getLang('geotag_desc') . '</span>'; | |
| 147 | +			$renderer->doc .= '<div class="h-geo geo"' . $style . ' title="' . $this->getLang('geotag_desc') | |
| 148 | + . $placename . '" itemscope itemtype="http://schema.org/Place">'; | |
| 149 | + $renderer->doc .= '<span itemprop="name">' . $showlocation . '</span>: ' . $searchPre; | |
| 150 | + $renderer->doc .= '<span itemprop="geo" itemscope itemtype="http://schema.org/GeoCoordinates">'; | |
| 151 | + $renderer->doc .= '<span class="p-latitude latitude" itemprop="latitude" data-latitude="' . $ddlat . '">' | |
| 152 | + . $lat . '</span>;'; | |
| 153 | + $renderer->doc .= '<span class="p-longitude longitude" itemprop="longitude" data-longitude="' . $ddlon | |
| 154 | + . '">' . $lon . '</span>'; | |
| 155 | +			if (!empty ($alt)) { | |
| 156 | + $renderer->doc .= ', <span class="p-altitude altitude" itemprop="elevation" data-altitude="' . $alt | |
| 157 | + . '">' . $alt . 'm</span>'; | |
| 158 | + } | |
| 159 | + $renderer->doc .= '</span>' . $searchPost . '</div>' . DOKU_LF; | |
| 160 | + return true; | |
| 161 | +		} elseif ($mode == 'metadata') { | |
| 162 | + // render metadata (our action plugin will put it in the page head) | |
| 163 | + $renderer->meta ['geo'] ['lat'] = $ddlat; | |
| 164 | + $renderer->meta ['geo'] ['lon'] = $ddlon; | |
| 165 | + $renderer->meta ['geo'] ['placename'] = $placename; | |
| 166 | + $renderer->meta ['geo'] ['region'] = $region; | |
| 167 | + $renderer->meta ['geo'] ['country'] = $country; | |
| 168 | + $renderer->meta ['geo'] ['geohash'] = $geohash; | |
| 169 | + $renderer->meta ['geo'] ['alt'] = $alt; | |
| 170 | + return true; | |
| 171 | +		} elseif ($mode == 'odt') { | |
| 172 | +			if (!empty ($alt)) { | |
| 173 | + $alt = ', ' . $alt . 'm'; | |
| 174 | + } | |
| 175 | + $renderer->p_open(); | |
| 176 | + $renderer->_odtAddImage(DOKU_PLUGIN . 'geotag/images/geotag.png', null, null, 'left', ''); | |
| 177 | +			$renderer->cdata($this->getLang('geotag_desc') . ' ' . $placename); | |
| 178 | + $renderer->monospace_open(); | |
| 179 | + $renderer->cdata($lat . ';' . $lon . $alt); | |
| 180 | + $renderer->monospace_close(); | |
| 181 | + $renderer->p_close(); | |
| 182 | + return true; | |
| 183 | + } | |
| 184 | + return false; | |
| 185 | + } | |
| 186 | 186 | |
| 187 | - /** | |
| 188 | - * Calculate the geohash for this lat/lon pair. | |
| 189 | - * | |
| 190 | - * @param float $lat | |
| 191 | - * @param float $lon | |
| 192 | - */ | |
| 193 | -    private function geohash($lat, $lon) { | |
| 194 | -        if (!$geophp = plugin_load('helper', 'geophp')) { | |
| 195 | - dbglog($geophp, 'syntax_plugin_geotag_geotag::geohash: geophp plugin is not available.'); | |
| 196 | - return ""; | |
| 197 | - } | |
| 198 | - $_lat = floatval($lat); | |
| 199 | - $_lon = floatval($lon); | |
| 200 | - $geometry = new Point($_lon, $_lat); | |
| 201 | -        return $geometry->out('geohash'); | |
| 202 | - } | |
| 187 | + /** | |
| 188 | + * Calculate the geohash for this lat/lon pair. | |
| 189 | + * | |
| 190 | + * @param float $lat | |
| 191 | + * @param float $lon | |
| 192 | + */ | |
| 193 | +	private function geohash($lat, $lon) { | |
| 194 | +		if (!$geophp = plugin_load('helper', 'geophp')) { | |
| 195 | + dbglog($geophp, 'syntax_plugin_geotag_geotag::geohash: geophp plugin is not available.'); | |
| 196 | + return ""; | |
| 197 | + } | |
| 198 | + $_lat = floatval($lat); | |
| 199 | + $_lon = floatval($lon); | |
| 200 | + $geometry = new Point($_lon, $_lat); | |
| 201 | +		return $geometry->out('geohash'); | |
| 202 | + } | |
| 203 | 203 | |
| 204 | - /** | |
| 205 | - * Convert decimal degrees to degrees, minutes, seconds format | |
| 206 | - * | |
| 207 | - * @todo move this into a shared library | |
| 208 | - * @param float $decimaldegrees | |
| 209 | - * @return string dms | |
| 210 | - */ | |
| 211 | -    private function convertDDtoDMS($decimaldegrees) { | |
| 212 | - $dms = floor($decimaldegrees); | |
| 213 | - $secs = ($decimaldegrees - $dms) * 3600; | |
| 214 | - $min = floor($secs / 60); | |
| 215 | - $sec = round($secs - ($min * 60), 3); | |
| 216 | - $dms .= 'º' . $min . '\'' . $sec . '"'; | |
| 217 | - return $dms; | |
| 218 | - } | |
| 204 | + /** | |
| 205 | + * Convert decimal degrees to degrees, minutes, seconds format | |
| 206 | + * | |
| 207 | + * @todo move this into a shared library | |
| 208 | + * @param float $decimaldegrees | |
| 209 | + * @return string dms | |
| 210 | + */ | |
| 211 | +	private function convertDDtoDMS($decimaldegrees) { | |
| 212 | + $dms = floor($decimaldegrees); | |
| 213 | + $secs = ($decimaldegrees - $dms) * 3600; | |
| 214 | + $min = floor($secs / 60); | |
| 215 | + $sec = round($secs - ($min * 60), 3); | |
| 216 | + $dms .= 'º' . $min . '\'' . $sec . '"'; | |
| 217 | + return $dms; | |
| 218 | + } | |
| 219 | 219 | |
| 220 | - /** | |
| 221 | - * convert latitude in decimal degrees to DMS+hemisphere. | |
| 222 | - * | |
| 223 | - * @todo move this into a shared library | |
| 224 | - * @param float $decimaldegrees | |
| 225 | - * @return string | |
| 226 | - */ | |
| 227 | -    private function convertLat($decimaldegrees) { | |
| 228 | -        if (strpos($decimaldegrees, '-') !== false) { | |
| 229 | - $latPos = "S"; | |
| 230 | -        } else { | |
| 231 | - $latPos = "N"; | |
| 232 | - } | |
| 233 | - $dms = $this->convertDDtoDMS(abs(floatval($decimaldegrees))); | |
| 234 | - return hsc($dms . $latPos); | |
| 235 | - } | |
| 220 | + /** | |
| 221 | + * convert latitude in decimal degrees to DMS+hemisphere. | |
| 222 | + * | |
| 223 | + * @todo move this into a shared library | |
| 224 | + * @param float $decimaldegrees | |
| 225 | + * @return string | |
| 226 | + */ | |
| 227 | +	private function convertLat($decimaldegrees) { | |
| 228 | +		if (strpos($decimaldegrees, '-') !== false) { | |
| 229 | + $latPos = "S"; | |
| 230 | +		} else { | |
| 231 | + $latPos = "N"; | |
| 232 | + } | |
| 233 | + $dms = $this->convertDDtoDMS(abs(floatval($decimaldegrees))); | |
| 234 | + return hsc($dms . $latPos); | |
| 235 | + } | |
| 236 | 236 | |
| 237 | - /** | |
| 238 | - * convert longitude in decimal degrees to DMS+hemisphere. | |
| 239 | - * | |
| 240 | - * @todo move this into a shared library | |
| 241 | - * @param float $decimaldegrees | |
| 242 | - * @return string | |
| 243 | - */ | |
| 244 | -    private function convertLon($decimaldegrees) { | |
| 245 | -        if (strpos($decimaldegrees, '-') !== false) { | |
| 246 | - $lonPos = "W"; | |
| 247 | -        } else { | |
| 248 | - $lonPos = "E"; | |
| 249 | - } | |
| 250 | - $dms = $this->convertDDtoDMS(abs(floatval($decimaldegrees))); | |
| 251 | - return hsc($dms . $lonPos); | |
| 252 | - } | |
| 237 | + /** | |
| 238 | + * convert longitude in decimal degrees to DMS+hemisphere. | |
| 239 | + * | |
| 240 | + * @todo move this into a shared library | |
| 241 | + * @param float $decimaldegrees | |
| 242 | + * @return string | |
| 243 | + */ | |
| 244 | +	private function convertLon($decimaldegrees) { | |
| 245 | +		if (strpos($decimaldegrees, '-') !== false) { | |
| 246 | + $lonPos = "W"; | |
| 247 | +		} else { | |
| 248 | + $lonPos = "E"; | |
| 249 | + } | |
| 250 | + $dms = $this->convertDDtoDMS(abs(floatval($decimaldegrees))); | |
| 251 | + return hsc($dms . $lonPos); | |
| 252 | + } | |
| 253 | 253 | } |