Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

+28 -25
View File
@@ -11,45 +11,48 @@
namespace IPS\core\widgets;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\core\Feature;
use IPS\Helpers\Form;
use IPS\Helpers\Form\Number;
use IPS\Output;
use IPS\Theme;
use IPS\Widget\Customizable;
use IPS\Widget\PermissionCache;
use function count;
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;
}
/**
* Promoted Content Widget
*/
class _promoted extends \IPS\Widget\PermissionCache
class promoted extends PermissionCache implements Customizable
{
/**
* @brief Widget Key
*/
public $key = 'promoted';
public string $key = 'promoted';
/**
* @brief App
*/
public $app = 'core';
public string $app = 'core';
/**
* @brief Plugin
*/
public $plugin = '';
/**
* Initialize widget
*
* @return null
* @return void
*/
public function init()
public function init(): void
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote.css', 'core' ) );
if ( \IPS\Theme::i()->settings['responsive'] )
{
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'styles/promote_responsive.css', 'core' ) );
}
Output::i()->cssFiles = array_merge( Output::i()->cssFiles, Theme::i()->css( 'styles/promote.css', 'core' ) );
parent::init();
}
@@ -57,14 +60,14 @@ class _promoted extends \IPS\Widget\PermissionCache
/**
* Specify widget configuration
*
* @param null|\IPS\Helpers\Form $form Form object
* @return \IPS\Helpers\Form
* @param null|Form $form Form object
* @return Form
*/
public function configuration( &$form=null )
public function configuration( Form &$form=null ): Form
{
$form = parent::configuration( $form );
$form->add( new \IPS\Helpers\Form\Number( 'toshow', isset( $this->configuration['toshow'] ) ? $this->configuration['toshow'] : 5, TRUE ) );
$form->add( new Number( 'toshow', $this->configuration['toshow'] ?? 5, TRUE ) );
return $form;
}
@@ -74,12 +77,12 @@ class _promoted extends \IPS\Widget\PermissionCache
*
* @return string
*/
public function render()
public function render(): string
{
$limit = isset ( $this->configuration['toshow'] ) ? $this->configuration['toshow'] : 5;
$stream = \IPS\core\Promote::internalStream( $limit );
$limit = $this->configuration['toshow'] ?? 5;
$stream = Feature::internalStream( $limit );
if ( ! \count( $stream ) )
if ( ! count( $stream ) )
{
return '';
}