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

+16 -9
View File
@@ -11,7 +11,7 @@
namespace IPS\Helpers\Form;
/* 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;
@@ -25,14 +25,21 @@ class _CheckboxSet extends Select
/**
* Constructor
*
* @param string $name Name
* @param mixed $defaultValue Default value
* @param bool|NULL $required Required? (NULL for not required, but appears to be so)
* @param array $options Type-specific options
* @param callback $customValidationCode Custom validation code
* @param string $prefix HTML to show before input field
* @param string $suffix HTML to show after input field
* @param string $id The ID to add to the row
* @return void
*/
public function __construct()
public function __construct( $name, $defaultValue=NULL, $required=FALSE, $options=array(), $customValidationCode=NULL, $prefix=NULL, $suffix=NULL, $id=NULL )
{
$args = func_get_args();
$args[3]['multiple'] = TRUE;
$options['multiple'] = TRUE;
call_user_func_array( 'parent::__construct', $args );
parent::__construct( $name, $defaultValue, $required, $options, $customValidationCode, $prefix, $suffix, $id );
if ( !isset( $this->options['descriptions'] ) )
{
@@ -65,7 +72,7 @@ class _CheckboxSet extends Select
if ( $this->options['returnLabels'] )
{
$value = array();
if ( !is_array( $this->value ) )
if ( !\is_array( $this->value ) )
{
$this->value = explode( ',', $this->value );
}
@@ -81,7 +88,7 @@ class _CheckboxSet extends Select
/* If the value is NULL or an empty string, i.e. from a custom field, then we should not convert it into an array because the
value will evaluate to 0 with an == check and the first option in the checkbox set will always be selected erroneously */
if ( $this->options['unlimited'] === NULL and !is_array( $value ) AND $value !== NULL AND $value !== '' )
if ( $this->options['unlimited'] === NULL and !\is_array( $value ) AND $value !== NULL AND $value !== '' )
{
$value = array( $value );
}
@@ -105,10 +112,10 @@ class _CheckboxSet extends Select
/* We need the array keys. For custom fields we will have 0 => 1, 1 => 1 if checkboxes 0 and 1 are checked, while for Content we will have
customKey => 1, customOtherKey => 1 - we always need the array keys */
$value = is_array( $value ) ? array_keys( $value ) : array();
$value = \is_array( $value ) ? array_keys( $value ) : array();
if ( $this->options['returnLabels'] )
{
if ( is_array( $value ) )
if ( \is_array( $value ) )
{
$return = array();
foreach ( $value as $k => $v )