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,25 +12,39 @@
|
||||
namespace IPS\nexus\extensions\core\FrontNavigation;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application\Module;
|
||||
use IPS\core\FrontNavigation\FrontNavigationAbstract;
|
||||
use IPS\Dispatcher;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\Settings;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Front Navigation Extension: Subscriptions
|
||||
*/
|
||||
class _Subscriptions extends \IPS\core\FrontNavigation\FrontNavigationAbstract
|
||||
{
|
||||
class Subscriptions extends FrontNavigationAbstract
|
||||
{
|
||||
/**
|
||||
* @var string Default icon
|
||||
*/
|
||||
public string $defaultIcon = '\f021';
|
||||
|
||||
/**
|
||||
* Get Type Title which will display in the AdminCP Menu Manager
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function typeTitle()
|
||||
public static function typeTitle(): string
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('nexus_subscriptions');
|
||||
return Member::loggedIn()->language()->addToStack('nexus_subscriptions');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,50 +52,50 @@ class _Subscriptions extends \IPS\core\FrontNavigation\FrontNavigationAbstract
|
||||
* For example, if this will link to a particular feature which has been diabled, it should
|
||||
* not be available, even if the user has permission
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*/
|
||||
public static function isEnabled()
|
||||
public static function isEnabled() : bool
|
||||
{
|
||||
return \IPS\Settings::i()->nexus_subs_enabled;
|
||||
return Settings::i()->nexus_subs_enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can the currently logged in user access the content this item links to?
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*/
|
||||
public function canAccessContent()
|
||||
public function canAccessContent(): bool
|
||||
{
|
||||
return \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'nexus', 'subscriptions' ) );
|
||||
return Member::loggedIn()->canAccessModule( Module::get( 'nexus', 'subscriptions' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Title
|
||||
*
|
||||
* @return string
|
||||
* @return string
|
||||
*/
|
||||
public function title()
|
||||
public function title(): string
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('nexus_subscriptions');
|
||||
return Member::loggedIn()->language()->addToStack('nexus_subscriptions');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Link
|
||||
*
|
||||
* @return \IPS\Http\Url
|
||||
* @return string|Url|null
|
||||
*/
|
||||
public function link()
|
||||
public function link(): Url|string|null
|
||||
{
|
||||
return \IPS\Http\Url::internal( "app=nexus&module=subscriptions&controller=subscriptions", 'front', 'nexus_subscriptions' );
|
||||
return Url::internal( "app=nexus&module=subscriptions&controller=subscriptions", 'front', 'nexus_subscriptions' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is Active?
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*/
|
||||
public function active()
|
||||
public function active(): bool
|
||||
{
|
||||
return \IPS\Dispatcher::i()->application->directory === 'nexus' and \IPS\Dispatcher::i()->module and \IPS\Dispatcher::i()->module->key === 'subscriptions' and \IPS\Dispatcher::i()->controller == 'subscriptions';
|
||||
return Dispatcher::i()->application->directory === 'nexus' and Dispatcher::i()->module and Dispatcher::i()->module->key === 'subscriptions' and Dispatcher::i()->controller == 'subscriptions';
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user