function getWaypoints($cacheid) { global $waypointline; global $waypointlines; global $nowaypoints; $wphandler = new ChildWp_Handler(); $waypoints = $wphandler->getChildWps($cacheid); $ret = ''; if (!empty($waypoints)) { $formatter = new Coordinate_Formatter(); foreach ($waypoints as $waypoint) { $tmpline = $waypointline; $tmpline = mb_ereg_replace('{wp_image}', htmlspecialchars($waypoint['image'], ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{wp_type}', htmlspecialchars($waypoint['name'], ENT_COMPAT, 'UTF-8'), $tmpline); $htmlcoordinate = $formatter->formatHtml($waypoint['coordinate'], '</td></tr><tr><td style="white-space:nowrap">'); $tmpline = mb_ereg_replace('{wp_coordinate}', $htmlcoordinate, $tmpline); $tmpline = mb_ereg_replace('{wp_description}', htmlspecialchars(trim($waypoint['description']), ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{wp_show_description}', mb_ereg_replace('\\r\\n', '<br />', htmlspecialchars($waypoint['description'], ENT_COMPAT, 'UTF-8')), $tmpline); $tmpline = mb_ereg_replace('{cacheid}', htmlspecialchars($cacheid, ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{childid}', htmlspecialchars($waypoint['childid'], ENT_COMPAT, 'UTF-8'), $tmpline); $ret .= $tmpline; } $ret = mb_ereg_replace('{lines}', $ret, $waypointlines); return $ret; } return $nowaypoints; }
function getChildWaypoints($cacheid) { $wphandler = new ChildWp_Handler(); $waypoints = $wphandler->getChildWps($cacheid); $count = count($waypoints); if ($count > 0) { $formatter = new Coordinate_Formatter(); for ($i = 0; $i < $count; $i++) { $waypoints[$i]['coordinateHtml'] = $formatter->formatHtml($waypoints[$i]['coordinate'], '<br />'); } } return $waypoints; }
function getChildWaypoints($cacheid) { $wphandler = new ChildWp_Handler(); $waypoints = $wphandler->getChildWps($cacheid); $count = count($waypoints); if ($count > 0) { $formatter = new Coordinate_Formatter(); for ($i = 0; $i < $count; $i++) { $waypoints[$i]['coord']['lat'] = $waypoints[$i]['coordinate']->latitude(); $waypoints[$i]['coord']['lon'] = $waypoints[$i]['coordinate']->longitude(); $waypoints[$i]['coordinateHtml'] = $formatter->formatHtml($waypoints[$i]['coordinate'], '<br />'); $waypoints[$i]['description'] = trim($waypoints[$i]['description']); $waypoints[$i]['position'] = $i + 1; } } return $waypoints; }
function testFormatHtmlSeparator() { $formatter = new Coordinate_Formatter(); $this->assertIdentical('N 10° 20.000\' E 030° 40.000\'', $formatter->formatHtml(Coordinate_Coordinate::fromHemDegMin(true, 10, 20, true, 30, 40), ' ')); $this->assertIdentical('S 15° 25.000\'<br/>W 035° 45.000\'', $formatter->formatHtml(Coordinate_Coordinate::fromHemDegMin(false, 15, 25, false, 35, 45), '<br/>')); }