Version 5.0.14
This commit is contained in:
1 parent
5efe744c5f
commit
dbd774b30c
364 files changed
+7048
-1377
No files matched your search
@@ -10,6 +10,8 @@
|
||||
|
||||
namespace IPS\Helpers\Form\Captcha;
|
||||
|
||||
use ErrorException;
|
||||
use InvalidArgumentException;
|
||||
use IPS\Http\Request\Exception;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Log;
|
||||
@@ -50,7 +52,15 @@ class Turnstile implements CaptchaInterface
|
||||
*/
|
||||
public function getHtml(): string
|
||||
{
|
||||
return Theme::i()->getTemplate( 'forms', 'core', 'global' )->captchaTurnstile( Bridge::i()->getTurnstileCredentials()['site_key'], preg_replace( '/^(.+?)\..*$/', '$1', Member::loggedIn()->language()->short ) );
|
||||
try
|
||||
{
|
||||
return Theme::i()->getTemplate( 'forms', 'core', 'global' )->captchaTurnstile( Bridge::i()->getTurnstileCredentials()['site_key'], preg_replace( '/^(.+?)\..*$/', '$1', Member::loggedIn()->language()->short ) );
|
||||
}
|
||||
catch( ErrorException $e )
|
||||
{
|
||||
Log::log( $e->getMessage(), 'turnstile' );
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -680,9 +680,10 @@ class Form
|
||||
{
|
||||
foreach ( $elements as $_name => $element )
|
||||
{
|
||||
/* @var FormAbstract $element */
|
||||
if ( isset( $element->options['togglesOn'] ) )
|
||||
{
|
||||
if ( !$element->value )
|
||||
if ( !$element->value or in_array( $element->htmlId, $htmlIdsToIgnoreBecauseTheyAreHiddenByToggles ) )
|
||||
{
|
||||
$htmlIdsToIgnoreBecauseTheyAreHiddenByToggles = array_merge( $htmlIdsToIgnoreBecauseTheyAreHiddenByToggles, $element->options['togglesOn'] );
|
||||
}
|
||||
@@ -726,7 +727,7 @@ class Form
|
||||
$match = is_array( $element->value ) ? in_array( $toggleValue, $element->value ) : $toggleValue == $element->value;
|
||||
}
|
||||
|
||||
if ( !$match )
|
||||
if ( !$match or in_array( $element->htmlId, $htmlIdsToIgnoreBecauseTheyAreHiddenByToggles ) )
|
||||
{
|
||||
$htmlIdsToIgnoreBecauseTheyAreHiddenByToggles = array_merge( $htmlIdsToIgnoreBecauseTheyAreHiddenByToggles, $toggleHtmlIds );
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class Node extends FormAbstract
|
||||
'where' => array(), // where clause to control which results to display
|
||||
'disabledIds' => array(), // Array of disabled IDs
|
||||
'noParentNodes' => 'Custom' // If a value is provided, subnodes of this class which have no parent node will be added into a pseudo-group with the title provided. e.g. custom packages in Nexus do not belong to any package group
|
||||
'autoPopulate' => FALSE // Whether or not to autopopulate children of root nodes (defaults to TRUE which means the children are loaded, use FALSE to only show the parent nodes by default until they are clicked on)
|
||||
'autoPopulate' => FALSE // Whether to autopopulate children of root nodes (defaults to TRUE which means the children are loaded, use FALSE to only show the parent nodes by default until they are clicked on)
|
||||
'clubs' => TRUE, // If TRUE, will also show nodes inside clubs that the user can access. Defaults to FALSE.
|
||||
'nodeGroups' => FALSE, // If TRUE, will show node groups for easier selection. Defaults to FALSE.
|
||||
'maxResults' => 200, // Maximum number of nodes to load. NULL to load all nodes or FALSE to respect node class definition. Defaults to FALSE.
|
||||
@@ -120,9 +120,21 @@ class Node extends FormAbstract
|
||||
}
|
||||
$this->options['url'] = $this->options['url']->setQueryString( '_nodeSelectName', $this->name );
|
||||
|
||||
if ( $this->options['clubs'] and ( !Settings::i()->clubs or !IPS::classUsesTrait( $this->options['class'], 'IPS\Content\ClubContainer' ) ) )
|
||||
if ( $this->options['clubs'] )
|
||||
{
|
||||
$this->options['clubs'] = FALSE;
|
||||
if( ( !Settings::i()->clubs or !IPS::classUsesTrait( $this->options['class'], 'IPS\Content\ClubContainer' ) ) )
|
||||
{
|
||||
$this->options['clubs'] = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure we have clubs to show */
|
||||
$totalClubNodes = (int) Db::i()->select( 'count(*)', 'core_clubs_node_map', [ 'node_class=?', $this->options['class'] ] )->first();
|
||||
if( !$totalClubNodes )
|
||||
{
|
||||
$this->options['clubs'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( $this->options['nodeGroups'] and ! ( IPS::classUsesTrait( $this->options['class'], Grouping::class ) and Member::loggedIn()->isModerator() ) )
|
||||
@@ -143,7 +155,7 @@ class Node extends FormAbstract
|
||||
*
|
||||
* @return string
|
||||
* @note $selectable controls whether the node is selectable, not whether it is provided as an option or not.
|
||||
* @note $showable controls whether or not the node should be displayed at all. On the front end this is based on view permissions, and on the backend we display all nodes regardless of view permissions.
|
||||
* @note $showable controls whether the node should be displayed at all. On the front end this is based on view permissions, and on the backend we display all nodes regardless of view permissions.
|
||||
*/
|
||||
public function html(): string
|
||||
{
|
||||
@@ -258,7 +270,7 @@ class Node extends FormAbstract
|
||||
$nodes = array();
|
||||
$children = array();
|
||||
$noParentNodes = array();
|
||||
if( isset( $nodeClass::$ownerTypes ) and $nodeClass::$ownerTypes !== NULL and $this->options['forceOwner'] !== FALSE )
|
||||
if( !empty( $nodeClass::$ownerTypes ) and $this->options['forceOwner'] !== FALSE )
|
||||
{
|
||||
$nodes = $nodeClass::loadByOwner( $this->options['forceOwner'] ?: Member::loggedIn(), $this->options['where'] );
|
||||
if ( $this->options['clubs'] )
|
||||
|
||||
Reference in new issue
Block a user