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
@@ -11,38 +11,44 @@
|
||||
namespace IPS\{app}\extensions\core\AdminNotifications;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\core\AdminNotification;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member as MemberClass;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* ACP Notification Extension
|
||||
*/
|
||||
class _{class} extends \IPS\core\AdminNotification
|
||||
class {class} extends AdminNotification
|
||||
{
|
||||
/**
|
||||
* @brief Identifier for what to group this notification type with on the settings form
|
||||
*/
|
||||
public static $group = 'other';
|
||||
public static string $group = '{group}';
|
||||
|
||||
/**
|
||||
* @brief Priority 1-5 (1 being highest) for this group compared to others
|
||||
*/
|
||||
public static $groupPriority = 3;
|
||||
public static int $groupPriority = 3;
|
||||
|
||||
/**
|
||||
* @brief Priority 1-5 (1 being highest) for this notification type compared to others in the same group
|
||||
*/
|
||||
public static $itemPriority = 1;
|
||||
public static int $itemPriority = {priority};
|
||||
|
||||
/**
|
||||
* Title for settings
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function settingsTitle()
|
||||
public static function settingsTitle(): string
|
||||
{
|
||||
return 'acp_notification_{class}';
|
||||
}
|
||||
@@ -50,10 +56,10 @@ class _{class} extends \IPS\core\AdminNotification
|
||||
/**
|
||||
* Can a member access this type of notification?
|
||||
*
|
||||
* @param \IPS\Member $member The member
|
||||
* @param MemberClass $member The member
|
||||
* @return bool
|
||||
*/
|
||||
public static function permissionCheck( \IPS\Member $member ): bool
|
||||
public static function permissionCheck( MemberClass $member ): bool
|
||||
{
|
||||
return true;// $member->hasAcpRestriction( ... );
|
||||
}
|
||||
@@ -61,9 +67,9 @@ class _{class} extends \IPS\core\AdminNotification
|
||||
/**
|
||||
* Is this type of notification ever optional (controls if it will be selectable as "viewable" in settings)
|
||||
*
|
||||
* @return string
|
||||
* @return bool
|
||||
*/
|
||||
public static function mayBeOptional()
|
||||
public static function mayBeOptional(): bool
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -91,9 +97,9 @@ class _{class} extends \IPS\core\AdminNotification
|
||||
/**
|
||||
* Notification Body (full HTML, must be escaped where necessary)
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function body(): string
|
||||
public function body(): ?string
|
||||
{
|
||||
return "Body";
|
||||
}
|
||||
@@ -105,7 +111,7 @@ class _{class} extends \IPS\core\AdminNotification
|
||||
*/
|
||||
public function severity(): string
|
||||
{
|
||||
return static::SEVERITY_NORMAL;
|
||||
return {severity};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,23 +124,13 @@ class _{class} extends \IPS\core\AdminNotification
|
||||
return static::DISMISSIBLE_TEMPORARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Style
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function style(): string
|
||||
{
|
||||
return static::STYLE_INFORMATION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick link from popup menu
|
||||
*
|
||||
* @return \IPS\Http\Url
|
||||
* @return Url
|
||||
*/
|
||||
public function link(): \IPS\Http\Url
|
||||
public function link(): Url
|
||||
{
|
||||
return parent::link(); // \IPS\Http\Url::internal( '...' );
|
||||
return parent::link(); // Url::internal( '...' );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user