Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,16 +12,25 @@
|
||||
namespace IPS\nexus\Form;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\GeoLocation;
|
||||
use IPS\Helpers\Form\FormAbstract;
|
||||
use IPS\Request;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
use function in_array;
|
||||
use function is_array;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Country/State input class for Form Builder
|
||||
*/
|
||||
class _StateSelect extends \IPS\Helpers\Form\FormAbstract
|
||||
class StateSelect extends FormAbstract
|
||||
{
|
||||
/**
|
||||
* @brief Default Options
|
||||
@@ -31,7 +40,7 @@ class _StateSelect extends \IPS\Helpers\Form\FormAbstract
|
||||
);
|
||||
* @endcode
|
||||
*/
|
||||
protected $defaultOptions = array(
|
||||
protected array $defaultOptions = array(
|
||||
'unlimitedLang' => NULL
|
||||
);
|
||||
|
||||
@@ -40,9 +49,9 @@ class _StateSelect extends \IPS\Helpers\Form\FormAbstract
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function html()
|
||||
public function html(): string
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'nexus', 'global' )->stateSelect( $this->name, $this->value, $this->options['unlimitedLang'] );
|
||||
return Theme::i()->getTemplate( 'forms', 'nexus', 'global' )->stateSelect( $this->name, $this->value, $this->options['unlimitedLang'] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,12 +59,12 @@ class _StateSelect extends \IPS\Helpers\Form\FormAbstract
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue()
|
||||
public function getValue(): mixed
|
||||
{
|
||||
if ( $this->options['unlimitedLang'] )
|
||||
{
|
||||
$unlimitedName = "{$this->name}_unlimited";
|
||||
if ( isset( \IPS\Request::i()->$unlimitedName ) )
|
||||
if ( isset( Request::i()->$unlimitedName ) )
|
||||
{
|
||||
return '*';
|
||||
}
|
||||
@@ -69,14 +78,14 @@ class _StateSelect extends \IPS\Helpers\Form\FormAbstract
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function formatValue()
|
||||
public function formatValue(): mixed
|
||||
{
|
||||
if ( \is_array( $this->value ) )
|
||||
if ( is_array( $this->value ) )
|
||||
{
|
||||
$value = array();
|
||||
foreach ( $this->value as $k => $v )
|
||||
{
|
||||
if ( \in_array( (string) $k, \IPS\GeoLocation::$countries ) )
|
||||
if ( in_array( (string) $k, GeoLocation::$countries ) )
|
||||
{
|
||||
$value[ $k ] = $v;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user