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,43 +12,48 @@
|
||||
namespace IPS\blog\widgets;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\blog\Entry;
|
||||
use IPS\Content\Filter;
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Helpers\Form\Number;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* recentEntries Widget
|
||||
*/
|
||||
class _recentEntries extends \IPS\Widget\PermissionCache
|
||||
class recentEntries extends PermissionCache implements Customizable
|
||||
{
|
||||
/**
|
||||
* @brief Widget Key
|
||||
*/
|
||||
public $key = 'recentEntries';
|
||||
public string $key = 'recentEntries';
|
||||
|
||||
/**
|
||||
* @brief App
|
||||
*/
|
||||
public $app = 'blog';
|
||||
|
||||
/**
|
||||
* @brief Plugin
|
||||
*/
|
||||
public $plugin = '';
|
||||
public string $app = 'blog';
|
||||
|
||||
/**
|
||||
* Specify widget configuration
|
||||
*
|
||||
* @param null|\IPS\Helpers\Form $form Form object
|
||||
* @return null|\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( 'number_to_show', isset( $this->configuration['number_to_show'] ) ? $this->configuration['number_to_show'] : 5, TRUE ) );
|
||||
$form->add( new Number( 'number_to_show', $this->configuration['number_to_show'] ?? 5, TRUE ) );
|
||||
return $form;
|
||||
}
|
||||
|
||||
@@ -57,10 +62,10 @@ class _recentEntries extends \IPS\Widget\PermissionCache
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
public function render(): string
|
||||
{
|
||||
$entries = \IPS\blog\Entry::getItemsWithPermission( array( array( 'entry_status!=?', 'draft' ) ), NULL, isset( $this->configuration['number_to_show'] ) ? $this->configuration['number_to_show'] : 5, 'read', \IPS\Content\Hideable::FILTER_PUBLIC_ONLY );
|
||||
if ( \count( $entries ) )
|
||||
$entries = Entry::getItemsWithPermission( array( array( 'entry_status!=?', 'draft' ) ), NULL, $this->configuration['number_to_show'] ?? 5, 'read', Filter::FILTER_PUBLIC_ONLY );
|
||||
if ( count( $entries ) )
|
||||
{
|
||||
return $this->output( $entries );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user