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

+34 -23
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;
@@ -23,28 +23,12 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
class _Sort extends FormAbstract
{
/**
* Constructor
*
* @see \IPS\Helpers\Form\FormAbstract::__construct
* @param string $name Name
* @param mixed $defaultValue Default value
* @param bool $required Required?
* @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
* @brief Default Options
*/
public function __construct( $name, $defaultValue=NULL, $required=FALSE, $options=array(), $customValidationCode=NULL, $prefix=NULL, $suffix=NULL, $id=NULL )
{
call_user_func_array( 'parent::__construct', func_get_args() );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jquery/jquery-ui.js', 'core', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jquery/jquery-touchpunch.js', 'core', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jquery/jquery.menuaim.js', 'core', 'interface' ) );
}
protected $defaultOptions = array(
'checkboxes' => NULL
);
/**
* Get HTML
*
@@ -52,7 +36,11 @@ class _Sort extends FormAbstract
*/
public function html()
{
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->sort( $this->name, $this->value );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jquery/jquery-ui.js', 'core', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jquery/jquery-touchpunch.js', 'core', 'interface' ) );
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jquery/jquery.menuaim.js', 'core', 'interface' ) );
return \IPS\Theme::i()->getTemplate( 'forms', 'core', 'global' )->sort( $this->name, $this->value, $this->options );
}
/**
@@ -70,4 +58,27 @@ class _Sort extends FormAbstract
parent::validate();
}
/**
* Get Value
*
* @return mixed
*/
public function getValue()
{
$value = parent::getValue();
$checkboxName = preg_replace( '/^(.+?\[?.+?)(\])?$/', '$1_checkboxes$2', $this->name );
if ( $this->options['checkboxes'] and \IPS\Request::i()->$checkboxName )
{
foreach ( $value as $k => $v )
{
$value[ $k ] = isset( \IPS\Request::i()->$checkboxName[ $k ] );
}
return $value;
}
else
{
return $value;
}
}
}