Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+20 -4
View File
@@ -11,7 +11,7 @@
namespace IPS\GeoLocation\Maps;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -53,12 +53,28 @@ class _Mapbox
return "";
}
return \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->staticMap( NULL, $this->mapUrl( $width, $height, $zoom ), $this->geolocation->lat, $this->geolocation->long, $width, $height );
}
/**
* Return the map image URL
*
* @param int $width Width
* @param int $height Height
* @param float|NULL $zoom The zoom amount (a value between 0 being totally zoomed out view of the world, and 1 being as fully zoomed in as possible) or NULL to zoom automatically based on how much data is available
* @return \IPS\Http\Url|NULL
*/
public function mapUrl( $width, $height, $zoom=NULL )
{
if( !($this->geolocation->long and $this->geolocation->lat ) )
{
return NULL;
}
$location = str_replace( ',', '.', $this->geolocation->long ) . ',' . str_replace( ',', '.', $this->geolocation->lat );
$imageUrl = \IPS\Http\Url::external( "https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/pin-l-marker+f00({$location})/{$location},14,0,60/{$width}x{$height}@2x" )->setQueryString( array(
return \IPS\Http\Url::external( "https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/pin-l-marker+f00({$location})/{$location},14,0,60/{$width}x{$height}@2x" )->setQueryString( array(
'access_token' => \IPS\Settings::i()->mapbox_api_key,
) );
return \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->staticMap( NULL, $imageUrl, $this->geolocation->lat, $this->geolocation->long );
}
}