diff --git a/src/FamilyEditor.php b/src/FamilyEditor.php index 443740eb6f..55ba725269 100644 --- a/src/FamilyEditor.php +++ b/src/FamilyEditor.php @@ -269,14 +269,16 @@ ->setLongitude($nLongitude); // Update Lat/Long if address changes - if (($family->isColumnModified(FamilyTableMap::COL_FAM_ADDRESS1) + if ( + ($family->isColumnModified(FamilyTableMap::COL_FAM_ADDRESS1) || $family->isColumnModified(FamilyTableMap::COL_FAM_ADDRESS2) || $family->isColumnModified(FamilyTableMap::COL_FAM_CITY) || $family->isColumnModified(FamilyTableMap::COL_FAM_STATE) || $family->isColumnModified(FamilyTableMap::COL_FAM_ZIP) || $family->isColumnModified(FamilyTableMap::COL_FAM_COUNTRY)) && (!$family->isColumnModified(FamilyTableMap::COL_FAM_LATITUDE) - && !$family->isColumnModified(FamilyTableMap::COL_FAM_LONGITUDE))) { + && !$family->isColumnModified(FamilyTableMap::COL_FAM_LONGITUDE)) + ) { $family->setLatitude(null); $family->setLongitude(null); } diff --git a/src/bin/google-map/GoogleMap.php b/src/bin/google-map/GoogleMap.php deleted file mode 100644 index 4323968602..0000000000 --- a/src/bin/google-map/GoogleMap.php +++ /dev/null @@ -1,2966 +0,0 @@ - - * package GoogleMapAPI - * version 2.5 - * - * REVISION NOTIFICATION - * NOTE: This is a modified version of the original listed above. This version - * maintains all original GNU software licenses. - */ - -/** - * @link http://code.google.com/p/php-google-map-api/ - * - * @copyright 2010-2012 Brad wedell - * @author Brad Wedell - * - * @version 3.0beta - */ -/* - * To view the full CHANGELOG, visit - * http://code.google.com/p/php-google-map-api/wiki/ChangeLog3 -/* -For database caching, you will want to use this schema: - -CREATE TABLE GEOCODES ( - address varchar(255) NOT NULL default '', - lon float default NULL, - lat float default NULL, - PRIMARY KEY (address) -); - -*/ - -/** - * PHP Google Maps API class. - * - * @version 3.0beta - */ -class GoogleMapAPI -{ - /** - * contains any map styles in a json string. - * - * @var string json - */ - public $map_styles = true; - - /** - * PEAR::DB DSN for geocode caching. example: - * $dsn = 'mysql://user:pass@localhost/dbname';. - * - * @var string - */ - public $dsn = null; - - /** - * current map id, set when you instantiate - * the GoogleMapAPI object. - * - * @var string - */ - public $map_id = null; - - /** - * determines whether or not to display the map and associated JS on the page - * this is used if you just want to display a streetview with no map. - */ - public $display_map = true; - - /** - * sidebar
used along with this map. - * - * @var string - */ - public $sidebar_id = null; - - /** - * With this, you can append lang= and region= to the script url for localization. If Google adds more features in the future, they will be supported by default. - * - * See http://code.google.com/apis/maps/documentation/javascript/basics.html#Localization - * for more info on Localization - * - * @var array - **/ - public $api_options = null; - - /** - * Whether to use new V3 mobile functionality. - * - * @var bool - */ - public $mobile = false; - - /** - * The viewport meta tag allows more values than these defaults; you can get more info here: http://www.html-5.com/metatags/index.html#viewport-meta-tag. - * - * @var string - */ - public $meta_viewport = 'initial-scale=1.0, user-scalable=no'; - - /** - * DEPRECATED: Google now has geocoding service. - * NOTE: Note even sure if this still works - * GoogleMapAPI used to use the Yahoo geocode lookup API. - * This is the application ID for YOUR application. - * This is set upon instantiating the GoogleMapAPI object. - * (http://developer.yahoo.net/faq/index.html#appid). - * - * @var string - */ - public $app_id = null; - - /** - * use onLoad() to load the map javascript. - * if enabled, be sure to include on your webpage: - * printOnLoad?> or manually create an onload function - * that calls the map's onload function using $this->printOnLoadFunction. - * - * @var bool - * - * @default true - */ - public $onload = true; - - /** - * map center latitude (horizontal) - * calculated automatically as markers - * are added to the map. - * - * @var float - */ - public $center_lat = null; - - /** - * map center longitude (vertical) - * calculated automatically as markers - * are added to the map. - * - * @var float - */ - public $center_lon = null; - - /** - * enables map controls (zoom/move/center). - * - * @var bool - */ - public $map_controls = true; - - /** - * determines the map control type - * small -> show move/center controls - * large -> show move/center/zoom controls. - * - * @var string - */ - public $control_size = 'large'; - - /** - * enables map type controls (map/satellite/hybrid/terrain). - * - * @var bool - */ - public $type_controls = true; - - /** - * determines unit system to use for directions, blank = default. - * - * @var string (METRIC, IMPERIAL) - */ - public $directions_unit_system = ''; - - /** - * sets default option for type controls(DEFAULT, HORIZONTAL_BAR, DROPDOWN_MENU). - * - * @var string - */ - public $type_controls_style = 'DEFAULT'; - - /** - * default map type google.maps.MapTypeId.(ROADMAP, SATELLITE, HYBRID, TERRAIN). - * - * @var string - */ - public $map_type = 'HYBRID'; - - /** - * enables scale map control. - * - * @var bool - */ - public $scale_control = true; - /** - * class variable to control scrollwheel. - * - * @var bool - */ - public $scrollwheel = true; - - /** - * enables overview map control. - * - * @var bool - */ - public $overview_control = false; - - /** - * enables Google Adsense Adsmanager on page, not currently supported in beta. - * - * @var bool - */ - public $ads_manager = false; - - /** - * Google Adsense Publisher ID. - * - * @var string - */ - public $ads_pub_id = ''; - - /** - * Google Adsense Channel ID. - * - * @var string - */ - public $ads_channel = ''; - - /** - * The Max number of Adsmanager ads to show on a map. - * - * @var int - */ - public $ads_max = 10; - - /** - * enables/disables local search on page. - * - * @var bool - */ - public $local_search = false; - - /** - * enables local search ads on page NOTE: will only display ads if local_search == true, otherwise just use ad_manager and settings. - * - * @var bool - */ - public $local_search_ads = false; - - /** - * enables/disables walking directions option. - * - * @var bool - */ - public $walking_directions = false; - - /** - * enables/disables biking directions on directions. - * - * @var bool - */ - public $biking_directions = false; - - /** - * enables/disables avoid highways on directions. - * - * @var bool - */ - public $avoid_highways = false; - - /** - * determines if avoid tollways is used in directions. - * - * @var bool - */ - public $avoid_tollways = false; - - /** - * determines the default zoom level. - * - * @var int - */ - public $zoom = 16; - - /** - * determines the map width. - * - * @var string - */ - public $width = '500px'; - - /** - * determines the map height. - * - * @var string - */ - public $height = '500px'; - - /** - * message that pops up when the browser is incompatible with Google Maps. - * set to empty string to disable. - * - * @var string - */ - public $browser_alert = 'Sorry, the Google Maps API is not compatible with this browser.'; - - /** - * message that appears when javascript is disabled. - * set to empty string to disable. - * - * @var string - */ - public $js_alert = 'Javascript must be enabled in order to use Google Maps.'; - - /** - * determines if sidebar is enabled. - * - * @var bool - */ - public $sidebar = true; - - /** - * determines if to/from directions are included inside info window. - * - * @var bool - * - * @deprecated - */ - public $directions = true; - - /* waypoints */ - protected $_waypoints_string = ''; - - /** - * determines if map markers bring up an info window. - * - * @var bool - */ - public $info_window = true; - - /** - * determines if info window appears with a click or mouseover. - * - * @var string click/mouseover - */ - public $window_trigger = 'click'; - - /** - * determines whether or not to use the MarkerClusterer plugin. - */ - public $marker_clusterer = false; - - /** - * set default marker clusterer *webserver* file location. - */ - public $marker_clusterer_location = '/MarkerClusterer-1.0/markerclusterer_compiled.js'; - - /** - * set default marker clusterer options. - */ - public $marker_clusterer_options = [ - 'maxZoom' => 'null', - 'gridSize' => 'null', - 'styles' => 'null', - ]; - - /** - * determines if traffic overlay is displayed on map. - * - * @var bool - */ - public $traffic_overlay = false; - - /** - * determines if biking overlay is displayed on map. - * - * @var bool - */ - public $biking_overlay = false; - - /** - * determines whether or not to display street view controls. - */ - public $street_view_controls = false; - - /** - * ID of the container that will hold a street view if streetview controls = true. - */ - public $street_view_dom_id = ''; - - /** - * what server geocode lookups come from. - * - * available: YAHOO Yahoo! API. US geocode lookups only. - * GOOGLE Google Maps. This can do international lookups, - * but not an official API service so no guarantees. - * Note: GOOGLE is the default lookup service, please read - * the Yahoo! terms of service before using their API. - * - * @var string service name - */ - public $lookup_service = 'GOOGLE'; - public $lookup_server = ['GOOGLE' => 'maps.google.com', 'YAHOO' => 'api.local.yahoo.com']; - - /** - * @var array - * - * @deprecated - */ - public $driving_dir_text = [ - 'dir_to' => 'Start address: (include addr, city st/region)', - 'to_button_value' => 'Get Directions', - 'to_button_type' => 'submit', - 'dir_from' => 'End address: (include addr, city st/region)', - 'from_button_value' => 'Get Directions', - 'from_button_type' => 'submit', - 'dir_text' => 'Directions: ', - 'dir_tohere' => 'To here', - 'dir_fromhere' => 'From here', - ]; - - /** - * version number. - * - * @var string - */ - public $_version = '3.0beta'; - - /** - * list of added markers. - * - * @var array - */ - public $_markers = []; - - /** - * maximum longitude of all markers. - * - * @var float - */ - public $_max_lon = -1000000; - - /** - * minimum longitude of all markers. - * - * @var float - */ - public $_min_lon = 1000000; - - /** - * max latitude. - * - * @var float - */ - public $_max_lat = -1000000; - - /** - * min latitude. - * - * @var float - */ - public $_min_lat = 1000000; - - /** - * determines if we should zoom to minimum level (above this->zoom value) that will encompass all markers. - * - * @var bool - */ - public $zoom_encompass = true; - - /** - * factor by which to fudge the boundaries so that when we zoom encompass, the markers aren't too close to the edge. - * - * @var float - */ - public $bounds_fudge = 0.01; - - /** - * use the first suggestion by a google lookup if exact match not found. - * - * @var float - */ - public $use_suggest = false; - - /** #)MS - * list of added polygon. - * - * @var array - */ - public $_polygons = []; - - /** - * list of added polylines. - * - * @var array - */ - public $_polylines = []; - - /** - * list of polylines that should have an elevation profile rendered. - */ - public $_elevation_polylines = []; - - /** - * determines whether or not to display a marker on the "line" when - * mousing over the elevation chart. - */ - public $elevation_markers = true; - - /** - * determines whether or not to display an elevation chart - * for directions that are added to the map. - */ - public $elevation_directions = false; - - /** - * icon info array. - * - * @var array - * - * @deprecated - * - * @version 2.5 - */ - public $_icons = []; - - /** - * marker icon info array. - * - * @var array - * - * @version 3.0 - */ - public $_marker_icons = []; - - /** - * Default icon image location. - * - * @var string - */ - public $default_icon = ''; - - /** - * Default icon shadow image location. - * - * @var string - */ - public $default_icon_shadow = ''; - - /** - * list of added overlays. - * - * @var array - */ - public $_overlays = []; - - /** - * list of added kml overlays. - */ - public $_kml_overlays = []; - - /** - * database cache table name. - * - * @var string - */ - public $_db_cache_table = 'GEOCODES'; - - /** - * Class variable that will store generated header code for JS to display directions. - * - * @var string - */ - public $_directions_header = ''; - - /** - * Class variable that will store information to render directions. - */ - public $_directions = []; - - /** - * Class variable to store whether or not to display JS functions in the header. - */ - public $_display_js_functions = true; - - /** - * Class variable that will store flag to minify js - this can be overwritten after object is instantiated. Include JSMin.php if - * you want to use JS Minification. - * - * @var bool - */ - public $_minify_js = true; - - /** - * class constructor. - * - * @param string $map_id the DOM element ID for the map - * @param string $app_id YOUR Yahoo App ID - */ - public function GoogleMapAPI($map_id = 'map', $app_id = 'MyMapApp') - { - $this->map_id = $map_id; - $this->sidebar_id = 'sidebar_' . $map_id; - $this->app_id = $app_id; - } - - /** - * function to enable map display. - */ - public function enableMapDisplay() - { - $this->display_map = true; - } - - /** - * function to disable map display (used to display street view only). - */ - public function disableMapDisplay() - { - $this->display_map = false; - } - - /** - * sets the PEAR::DB dsn. - * - * @param string $dsn Takes the form of "mysql://user:pass@localhost/db_name" - */ - public function setDSN($dsn) - { - $this->dsn = $dsn; - } - - /** - * sets the width of the map. - * - * @param string $width - * - * @return string|false Width or false if not a valid value - */ - public function setWidth($width) - { - if (!preg_match('!^(\d+)(.*)$!', $width, $_match)) { - return false; - } - - $_width = $_match[1]; - $_type = $_match[2]; - if ($_type == '%') { - $this->width = $_width . '%'; - } else { - $this->width = $_width . 'px'; - } - - return true; - } - - /** - * sets the height of the map. - * - * @param string $height - * - * @return string|false Height or false if not a valid value - */ - public function setHeight($height) - { - if (!preg_match('!^(\d+)(.*)$!', $height, $_match)) { - return false; - } - - $_height = $_match[1]; - $_type = $_match[2]; - if ($_type == '%') { - $this->height = $_height . '%'; - } else { - $this->height = $_height . 'px'; - } - - return true; - } - - /** - * sets the default map zoom level. - * - * @param string $level Initial zoom level value - */ - public function setZoomLevel($level) - { - $this->zoom = (int) $level; - } - - /** - * sets any map styles ( style wizard: http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html ). - * - * @param string $styles json string of the map styles to be applied - */ - public function setMapStyles($styles) - { - $this->map_styles = (string) $styles; - } - - /** - * enables the map controls (zoom/move). - */ - public function enableMapControls() - { - $this->map_controls = true; - } - - /** - * disables the map controls (zoom/move). - */ - public function disableMapControls() - { - $this->map_controls = false; - } - - /** - * sets the map control size (large/small). - * - * @param string $size Large/Small - */ - public function setControlSize($size) - { - if (in_array($size, ['large', 'small'])) { - $this->control_size = $size; - } - } - - /** - * disable mouse scrollwheel on Map. - */ - public function disableScrollWheel() - { - $this->scrollwheel = false; - } - - /** - * enables the type controls (map/satellite/hybrid). - */ - public function enableLocalSearch() - { - $this->local_search = true; - } - - /** - * disables the type controls (map/satellite/hybrid). - */ - public function disableLocalSearch() - { - $this->local_search = false; - } - - /** - * enables the type controls (map/satellite/hybrid). - */ - public function enableLocalSearchAds() - { - $this->local_search_ads = true; - } - - /** - * disables the type controls (map/satellite/hybrid). - */ - public function disableLocalSearchAds() - { - $this->local_search_ads = false; - } - - /** - * enables walking directions. - */ - public function enableWalkingDirections() - { - $this->walking_directions = true; - } - - /** - * disables walking directions. - */ - public function disableWalkingDirections() - { - $this->walking_directions = false; - } - - /** - * enables biking directions. - */ - public function enableBikingDirections() - { - $this->biking_directions = true; - } - - /** - * disables biking directions. - */ - public function disableBikingDirections() - { - $this->biking_directions = false; - } - - /** - * enables avoid highways in directions. - */ - public function enableAvoidHighways() - { - $this->avoid_highways = true; - } - - /** - * disables avoid highways in directions. - */ - public function disableAvoidHighways() - { - $this->avoid_highways = false; - } - - /** - * enables avoid tolls in directions. - */ - public function enableAvoidTolls() - { - $this->avoid_tolls = true; - } - - /** - * disables avoid tolls in directions. - */ - public function disableAvoidTolls() - { - $this->avoid_tolls = false; - } - - /** - * Add directions route to the map and adds text directions container with id=$dom_id. - * - * @param string $start_address - * @param string $dest_address - * @param string $dom_id DOM Element ID for directions container. - * @param bool $add_markers Add a marker at start and dest locations. - */ - public function addDirections($start_address = '', $dest_address = '', $dom_id = '', $add_markers = true, $elevation_samples = 256, $elevation_width = '', $elevation_height = '', $elevation_dom_id = '') - { - if ($elevation_dom_id == '') { - $elevation_dom_id = 'elevation' . $dom_id; - } - - if ($start_address !== '' && $dest_address !== '' && $dom_id !== '') { - $this->_directions[$dom_id] = [ - 'dom_id' => $dom_id, - 'start' => $start_address, - 'dest' => $dest_address, - 'markers' => true, - 'elevation_samples' => $elevation_samples, - 'width' => ($elevation_width != '' ? $elevation_width : str_replace('px', '', $this->width)), - 'height' => ($elevation_height != '' ? $elevation_height : str_replace('px', '', $this->height) / 2), - 'elevation_dom_id' => $elevation_dom_id, - ]; - if ($add_markers == true) { - $this->addMarkerByAddress($start_address, $start_address, $start_address); - $this->addMarkerByAddress($dest_address, $dest_address, $dest_address); - } - } - } - - public function addWaypoints($lat, $lon, $stopover = true) - { - if (!empty($this->_waypoints_string)) { - $this->_waypoints_string .= ','; - } - $tmp_stopover = $stopover ? 'true' : 'false'; - $this->_waypoints_string .= "{location: new google.maps.LatLng({$lat},{$lon}), stopover: {$tmp_stopover}}"; - } - - public function addWaypointByAddress($address, $stopover = true) - { - if ($tmp_geocode = $this->getGeocode($address)) { - $this->addWaypoints($tmp_geocode['lat'], $tmp_geocode['lon'], $stopover); - } - } - - /** - * enables the type controls (map/satellite/hybrid). - */ - public function enableTypeControls() - { - $this->type_controls = true; - } - - /** - * disables the type controls (map/satellite/hybrid). - */ - public function disableTypeControls() - { - $this->type_controls = false; - } - - /** - * sets map control style. - */ - public function setTypeControlsStyle($type) - { - switch ($type) { - case 'dropdown': - $this->type_controls_style = 'DROPDOWN_MENU'; - break; - case 'horizontal': - $this->type_controls_style = 'HORIZONTAL_BAR'; - break; - default: - $this->type_controls_style = 'DEFAULT'; - break; - } - } - - /** - * set default map type (map/satellite/hybrid). - * - * @param string $type New V3 Map Types, only include ending word (HYBRID,SATELLITE,TERRAIN,ROADMAP) - */ - public function setMapType($type) - { - switch ($type) { - case 'hybrid': - $this->map_type = 'HYBRID'; - break; - case 'satellite': - $this->map_type = 'SATELLITE'; - break; - case 'terrain': - $this->map_type = 'TERRAIN'; - break; - case 'map': - default: - $this->map_type = 'ROADMAP'; - break; - } - } - - /** - * enables onload. - */ - public function enableOnLoad() - { - $this->onload = true; - } - - /** - * disables onload. - */ - public function disableOnLoad() - { - $this->onload = false; - } - - /** - * enables sidebar. - */ - public function enableSidebar() - { - $this->sidebar = true; - } - - /** - * disables sidebar. - */ - public function disableSidebar() - { - $this->sidebar = false; - } - - /** - * enables map directions inside info window. - */ - public function enableDirections() - { - $this->directions = true; - } - - /** - * disables map directions inside info window. - */ - public function disableDirections() - { - $this->directions = false; - } - - /** - * set browser alert message for incompatible browsers. - * - * @param string $message - */ - public function setBrowserAlert($message) - { - $this->browser_alert = $message; - } - - /** - * set