Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Address input class for Form Builder
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 11 Jul 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\Helpers\Form;
|
||||
@@ -48,14 +47,14 @@ class _Address extends FormAbstract
|
||||
if ( !$this->value OR ( $this->value instanceof \IPS\GeoLocation AND !$this->value->country ) )
|
||||
{
|
||||
$this->value = ( $this->value instanceof \IPS\GeoLocation ) ? $this->value : new \IPS\GeoLocation;
|
||||
if ( $defaultCountry = $this->_calculateDefaultCountry() )
|
||||
if ( $this->options['requireFullAddress'] and $defaultCountry = static::calculateDefaultCountry() )
|
||||
{
|
||||
$this->value->country = $defaultCountry;
|
||||
}
|
||||
}
|
||||
|
||||
/* Display */
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->address( $this->name, $this->value, \IPS\Settings::i()->googleplacesautocomplete ? \IPS\Settings::i()->google_maps_api_key : NULL, $this->options['minimize'] );
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->address( $this->name, $this->value, \IPS\Settings::i()->googleplacesautocomplete ? \IPS\Settings::i()->google_maps_api_key : NULL, $this->options['minimize'], $this->options['requireFullAddress'] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +62,7 @@ class _Address extends FormAbstract
|
||||
*
|
||||
* @return string|NULL
|
||||
*/
|
||||
protected function _calculateDefaultCountry()
|
||||
public static function calculateDefaultCountry()
|
||||
{
|
||||
if ( isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) )
|
||||
{
|
||||
@@ -90,6 +89,17 @@ class _Address extends FormAbstract
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate default country
|
||||
*
|
||||
* @return string|NULL
|
||||
* @deprecated
|
||||
*/
|
||||
protected function _calculateDefaultCountry()
|
||||
{
|
||||
return static::calculateDefaultCountry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Value
|
||||
*
|
||||
@@ -156,7 +166,7 @@ class _Address extends FormAbstract
|
||||
}
|
||||
if ( $value->country )
|
||||
{
|
||||
if ( $value->country != $this->_calculateDefaultCountry() )
|
||||
if ( $value->country != static::calculateDefaultCountry() )
|
||||
{
|
||||
$partiallyCompleted = TRUE;
|
||||
}
|
||||
@@ -212,14 +222,11 @@ class _Address extends FormAbstract
|
||||
}
|
||||
|
||||
/* Add in latitude and longitude if we can */
|
||||
if ( $fullyCompleted )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
$value->getLatLong();
|
||||
}
|
||||
catch( \BadFunctionCallException $e ){}
|
||||
$value->getLatLong();
|
||||
}
|
||||
catch( \BadFunctionCallException $e ){}
|
||||
|
||||
/* Return */
|
||||
return $value;
|
||||
|
||||
Reference in new issue
Block a user