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,23 +12,28 @@
|
||||
namespace IPS\core\MobileNavigation;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use function defined;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mobile Navigation Extension: Custom Item
|
||||
*/
|
||||
abstract class _MobileNavigationAbstract
|
||||
abstract class MobileNavigationAbstract
|
||||
{
|
||||
/**
|
||||
* Allow multiple instances?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function allowMultiple()
|
||||
public static function allowMultiple() : bool
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -37,10 +42,10 @@ abstract class _MobileNavigationAbstract
|
||||
* Get configuration fields
|
||||
*
|
||||
* @param array $existingConfiguration The existing configuration, if editing an existing item
|
||||
* @param int $id The ID number of the existing item, if editing
|
||||
* @param int|null $id The ID number of the existing item, if editing
|
||||
* @return array
|
||||
*/
|
||||
public static function configuration( $existingConfiguration, $id = NULL )
|
||||
public static function configuration( array $existingConfiguration, ?int $id = NULL ) : array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
@@ -49,10 +54,10 @@ abstract class _MobileNavigationAbstract
|
||||
* Parse configuration fields
|
||||
*
|
||||
* @param array $configuration The values received from the form
|
||||
* @param int $id The ID number of the existing item, if editing
|
||||
* @param int|null $id The ID number of the existing item, if editing
|
||||
* @return array
|
||||
*/
|
||||
public static function parseConfiguration( $configuration, $id )
|
||||
public static function parseConfiguration( array $configuration, ?int $id ) : array
|
||||
{
|
||||
return $configuration;
|
||||
}
|
||||
@@ -60,27 +65,26 @@ abstract class _MobileNavigationAbstract
|
||||
/**
|
||||
* @brief The configuration
|
||||
*/
|
||||
protected $configuration;
|
||||
protected array $configuration = [];
|
||||
|
||||
/**
|
||||
* @brief The ID number
|
||||
*/
|
||||
public $id;
|
||||
public ?int $id = null;
|
||||
|
||||
/**
|
||||
* @brief The permissions
|
||||
*/
|
||||
public $permissions;
|
||||
public array|string|null $permissions = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $configuration The configuration
|
||||
* @param int $id The ID number
|
||||
* @param string $permissions The permissions (* or comma-delimited list of groups)
|
||||
* @return void
|
||||
* @param string|array $permissions The permissions (* or comma-delimited list of groups)
|
||||
*/
|
||||
public function __construct( $configuration, $id, $permissions )
|
||||
public function __construct( array $configuration, int $id, string|array $permissions )
|
||||
{
|
||||
$this->configuration = $configuration;
|
||||
$this->id = $id;
|
||||
@@ -92,7 +96,7 @@ abstract class _MobileNavigationAbstract
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function permissionsCanInherit()
|
||||
public static function permissionsCanInherit() : bool
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -104,7 +108,7 @@ abstract class _MobileNavigationAbstract
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isEnabled()
|
||||
public static function isEnabled() : bool
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -114,7 +118,7 @@ abstract class _MobileNavigationAbstract
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canAccessContent()
|
||||
public function canAccessContent() : bool
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -124,7 +128,7 @@ abstract class _MobileNavigationAbstract
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canView()
|
||||
public function canView() : bool
|
||||
{
|
||||
if ( static::isEnabled() )
|
||||
{
|
||||
@@ -134,7 +138,7 @@ abstract class _MobileNavigationAbstract
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->permissions == '*' ? TRUE : \IPS\Member::loggedIn()->inGroup( explode( ',', $this->permissions ) );
|
||||
return $this->permissions == '*' ? TRUE : Member::loggedIn()->inGroup( explode( ',', $this->permissions ) );
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
@@ -145,21 +149,21 @@ abstract class _MobileNavigationAbstract
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function title();
|
||||
abstract public function title() : string;
|
||||
|
||||
/**
|
||||
* Get Link
|
||||
*
|
||||
* @return \IPS\Http\Url
|
||||
* @return Url|string
|
||||
*/
|
||||
abstract public function link();
|
||||
abstract public function link() : Url|string;
|
||||
|
||||
/**
|
||||
* Get icon
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function icon()
|
||||
public function icon() : ?string
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user