<?php// {{{ class LongLat/** * Longitude-Latitude utilities * * This function will include the static functions (collection of methods) * that are going to be used to help with the longitude and latitude coords. * * @version 0.1.0 * @license LGPL-CC * @copyright 1line * */class Util_LongLat{ // {{{ public static function getCoord /** * Get Coords * * This function retrieves the coords of a givent url. * * @param string $type The type, either longitude or latitude * @param string $content The content of the page to parse. * @return string The value of the parsed content. */ function getCoord($type = 'latitude', $content) { switch (strtolower($type)) { case 'longitude': case 'latitude': $type = (string)$type; } preg_match("/<dd class=\"$type\">(.*[^>])<\/dd>/", $content, $values, PREG_OFFSET_CAPTURE); if (is_array($values) && isset($values[1][0])) { preg_match("/\((.*[^\)])\)/", $values[1][0], $lastvalues, PREG_OFFSET_CAPTURE); if (is_array($lastvalues) && isset($lastvalues[1][0])) { return (string)$lastvalues[1][0]; } } return 'none'; } // }}}}// }}}