Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Stack input class for Form Builder
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @since 11 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
@@ -29,6 +29,8 @@ class _Stack extends FormAbstract
|
||||
protected $defaultOptions = array(
|
||||
'stackFieldType' => 'Text',
|
||||
'removeEmptyValues' => TRUE,
|
||||
'maxItems' => NULL,
|
||||
'minItems' => NULL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -84,7 +86,7 @@ class _Stack extends FormAbstract
|
||||
$class = ( new $classType( $this->name . '[' . count($fields) . ']', $v, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId . '_' . count($fields) ) );
|
||||
$html = $class->html();
|
||||
|
||||
if ( $remove !== md5( $html ) )
|
||||
if( !\IPS\Login::compareHashes( $remove, md5( $html ) ) )
|
||||
{
|
||||
$fields[] = $html;
|
||||
}
|
||||
@@ -95,7 +97,7 @@ class _Stack extends FormAbstract
|
||||
$class = ( new $classType( $this->name . '[0]', NULL, FALSE, $this->options, $this->customValidationCode, $this->prefix, $this->suffix, $this->htmlId . '_' . count($fields) ) );
|
||||
$html = $class->html();
|
||||
|
||||
if ( $remove !== md5( $html ) )
|
||||
if( !\IPS\Login::compareHashes( $remove, md5( $html ) ) )
|
||||
{
|
||||
$fields[] = $html;
|
||||
}
|
||||
@@ -109,7 +111,7 @@ class _Stack extends FormAbstract
|
||||
$fields[] = $html;
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->stack( $this->name, $fields );
|
||||
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->stack( $this->name, $fields, $this->options );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,13 +153,29 @@ class _Stack extends FormAbstract
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @return TRUE
|
||||
*/
|
||||
public function validate()
|
||||
{
|
||||
if ( empty( $this->value ) and $this->required )
|
||||
{
|
||||
throw new \InvalidArgumentException('form_required');
|
||||
}
|
||||
|
||||
if ( $this->options['maxItems'] !== NULL and count( $this->value ) > $this->options['maxItems'] )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'form_tags_max', FALSE, array( 'pluralize' => array( $this->options['maxItems'] ) ) ) );
|
||||
}
|
||||
|
||||
if ( $this->options['minItems'] !== NULL and count( $this->value ) < $this->options['minItems'] )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'form_tags_min', FALSE, array( 'pluralize' => array( $this->options['minItems'] ) ) ) );
|
||||
}
|
||||
|
||||
parent::validate();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user