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,39 +12,52 @@
|
||||
namespace IPS\nexus\widgets;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Member;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use IPS\Widget\Customizable;
|
||||
use IPS\Widget\StaticCache;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* donations Widget
|
||||
*/
|
||||
class _donations extends \IPS\Widget\StaticCache
|
||||
class donations extends StaticCache implements Customizable
|
||||
{
|
||||
/**
|
||||
* @brief Widget Key
|
||||
*/
|
||||
public $key = 'donations';
|
||||
public string $key = 'donations';
|
||||
|
||||
/**
|
||||
* @brief App
|
||||
*/
|
||||
public $app = 'nexus';
|
||||
|
||||
public string $app = 'nexus';
|
||||
|
||||
/**
|
||||
* @brief Plugin
|
||||
* Constructor
|
||||
*
|
||||
* @param String $uniqueKey Unique key for this specific instance
|
||||
* @param array $configuration Widget custom configuration
|
||||
* @param array|string|null $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc)
|
||||
* @param string|null $orientation Orientation (top, bottom, right, left)
|
||||
* @param string $layout
|
||||
* @return void
|
||||
*/
|
||||
public $plugin = '';
|
||||
|
||||
public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null )
|
||||
public function __construct(string $uniqueKey, array $configuration, array|string $access=null, string $orientation=null, string $layout='table' )
|
||||
{
|
||||
parent::__construct( $uniqueKey, $configuration, $access, $orientation );
|
||||
parent::__construct( $uniqueKey, $configuration, $access, $orientation, $layout );
|
||||
|
||||
$member = \IPS\Member::loggedIn();
|
||||
$member = Member::loggedIn();
|
||||
|
||||
$theme = $member->skin ?: \IPS\Theme::defaultTheme();
|
||||
$theme = $member->skin ?: Theme::defaultTheme();
|
||||
$this->cacheKey = "widget_{$this->key}_" . $this->uniqueKey . '_' . md5( json_encode( $configuration ) . "_" . $member->language()->id . "_" . $member->member_id ? 1 : 0 . "_" . $theme . "_" . $orientation );
|
||||
}
|
||||
|
||||
@@ -53,10 +66,9 @@ class _donations extends \IPS\Widget\StaticCache
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
public function init(): void
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'donations.css', 'nexus' ) );
|
||||
return parent::init();
|
||||
parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,8 +76,14 @@ class _donations extends \IPS\Widget\StaticCache
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
public function render(): string
|
||||
{
|
||||
/* Do we have any donation goals to show? */
|
||||
if( !Settings::i()->donation_goals )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return $this->output();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user