Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\Content;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -24,7 +24,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
{
|
||||
/**
|
||||
* Class
|
||||
* @brief Class
|
||||
*/
|
||||
protected static $class;
|
||||
|
||||
@@ -32,6 +32,16 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
* @brief Moderator permission to generate caches on [optional]
|
||||
*/
|
||||
protected $moderatorPermissions = array();
|
||||
|
||||
/**
|
||||
* Skip the getItemsWithPermission check?
|
||||
*/
|
||||
protected static $permissionCheck = 'read';
|
||||
|
||||
/**
|
||||
* Skip the getItemsWithPermission check?
|
||||
*/
|
||||
protected static $skipPermissions = FALSE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -40,15 +50,13 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
* @param array $configuration Widget custom configuration
|
||||
* @param null|string|array $access Array/JSON string of executable apps (core=sidebar only, content=IP.Content only, etc)
|
||||
* @param null|string $orientation Orientation (top, bottom, right, left)
|
||||
* @param boolean $allowReuse If true, when the block is used, it will remain in the sidebar so it can be used again.
|
||||
* @param string $menuStyle Menu is a drop down menu, modal is a bigger modal panel.
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( $uniqueKey, array $configuration, $access=null, $orientation=null )
|
||||
{
|
||||
parent::__construct( $uniqueKey, $configuration, $access, $orientation );
|
||||
|
||||
if( count( $this->moderatorPermissions ) )
|
||||
if( \count( $this->moderatorPermissions ) )
|
||||
{
|
||||
$cacheKeyChecks = array();
|
||||
|
||||
@@ -69,37 +77,51 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
*/
|
||||
public function configuration( &$form=null )
|
||||
{
|
||||
/* Init */
|
||||
$class = static::$class;
|
||||
$itemClass = $class::$itemClass;
|
||||
|
||||
if ( $form === null )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form;
|
||||
}
|
||||
$form = parent::configuration( $form );
|
||||
|
||||
foreach( $this->formElements() as $element )
|
||||
{
|
||||
$form->add( $element );
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the form elements to use
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function formElements()
|
||||
{
|
||||
/* Init */
|
||||
$class = static::$class;
|
||||
$itemClass = $class::$itemClass;
|
||||
$return = array();
|
||||
|
||||
/* Block title */
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'widget_feed_title', isset( $this->configuration['widget_feed_title'] ) ? $this->configuration['widget_feed_title'] : \IPS\Member::loggedIn()->language()->addToStack( $class::$title . '_pl' ) ) );
|
||||
$return['title'] = new \IPS\Helpers\Form\Text( 'widget_feed_title', isset( $this->configuration['widget_feed_title'] ) ? $this->configuration['widget_feed_title'] : \IPS\Member::loggedIn()->language()->addToStack( $class::$title . '_pl' ) );
|
||||
|
||||
/* Container */
|
||||
if ( isset( $itemClass::$containerNodeClass ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'widget_feed_container_' . $itemClass::$title, isset( $this->configuration['widget_feed_container'] ) ? $this->configuration['widget_feed_container'] : 0, FALSE, array(
|
||||
$return['container'] = new \IPS\Helpers\Form\Node( 'widget_feed_container_' . $itemClass::$title, isset( $this->configuration['widget_feed_container'] ) ? $this->configuration['widget_feed_container'] : 0, FALSE, array(
|
||||
'class' => $itemClass::$containerNodeClass,
|
||||
'zeroVal' => 'all',
|
||||
'permissionCheck' => 'view',
|
||||
'multiple' => true
|
||||
) ) );
|
||||
'multiple' => TRUE,
|
||||
'clubs' => TRUE
|
||||
) );
|
||||
}
|
||||
|
||||
/* Use permissions? */
|
||||
if ( in_array( 'IPS\Content\Permissions', class_implements( $itemClass ) ) )
|
||||
if ( \in_array( 'IPS\Content\Permissions', class_implements( $itemClass ) ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'widget_feed_use_perms', isset( $this->configuration['widget_feed_use_perms'] ) ? $this->configuration['widget_feed_use_perms'] : TRUE, FALSE ) );
|
||||
$return['permissions'] = new \IPS\Helpers\Form\YesNo( 'widget_feed_use_perms', isset( $this->configuration['widget_feed_use_perms'] ) ? $this->configuration['widget_feed_use_perms'] : TRUE, FALSE );
|
||||
}
|
||||
|
||||
/* Types */
|
||||
if ( in_array( 'IPS\Content\Lockable', class_implements( $itemClass ) ) )
|
||||
if ( \in_array( 'IPS\Content\Lockable', class_implements( $itemClass ) ) )
|
||||
{
|
||||
$types = array(
|
||||
'any' => 'mod_confirm_either',
|
||||
@@ -107,9 +129,9 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
'closed' => 'mod_confirm_lock'
|
||||
);
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'widget_feed_item_status_locked', isset( $this->configuration['widget_feed_item_status_locked'] ) ? $this->configuration['widget_feed_item_status_locked'] : 'any', FALSE, array( 'options' => $types ) ) );
|
||||
$return['locked'] = new \IPS\Helpers\Form\Radio( 'widget_feed_item_status_locked', isset( $this->configuration['widget_feed_item_status_locked'] ) ? $this->configuration['widget_feed_item_status_locked'] : 'any', FALSE, array( 'options' => $types ) );
|
||||
}
|
||||
if ( in_array( 'IPS\Content\Pinnable', class_implements( $itemClass ) ) )
|
||||
if ( \in_array( 'IPS\Content\Pinnable', class_implements( $itemClass ) ) )
|
||||
{
|
||||
$types = array(
|
||||
'any' => 'mod_confirm_either',
|
||||
@@ -117,9 +139,9 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
'notpinned' => 'mod_confirm_unpin'
|
||||
);
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'widget_feed_item_status_pinned', isset( $this->configuration['widget_feed_item_status_pinned'] ) ? $this->configuration['widget_feed_item_status_pinned'] : 'any', FALSE, array( 'options' => $types ) ) );
|
||||
$return['pinned'] = new \IPS\Helpers\Form\Radio( 'widget_feed_item_status_pinned', isset( $this->configuration['widget_feed_item_status_pinned'] ) ? $this->configuration['widget_feed_item_status_pinned'] : 'any', FALSE, array( 'options' => $types ) );
|
||||
}
|
||||
if ( in_array( 'IPS\Content\Featurable', class_implements( $itemClass ) ) )
|
||||
if ( \in_array( 'IPS\Content\Featurable', class_implements( $itemClass ) ) )
|
||||
{
|
||||
$types = array(
|
||||
'any' => 'mod_confirm_either',
|
||||
@@ -127,9 +149,9 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
'notfeatured' => 'mod_confirm_unfeature'
|
||||
);
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'widget_feed_item_status_featured', isset( $this->configuration['widget_feed_item_status_featured'] ) ? $this->configuration['widget_feed_item_status_featured'] : 'any', FALSE, array( 'options' => $types ) ) );
|
||||
$return['featured'] = new \IPS\Helpers\Form\Radio( 'widget_feed_item_status_featured', isset( $this->configuration['widget_feed_item_status_featured'] ) ? $this->configuration['widget_feed_item_status_featured'] : 'any', FALSE, array( 'options' => $types ) );
|
||||
}
|
||||
if ( in_array( 'IPS\Content\Hideable', class_implements( $class ) ) )
|
||||
if ( \in_array( 'IPS\Content\Hideable', class_implements( $class ) ) )
|
||||
{
|
||||
$types = array(
|
||||
'any' => 'mod_confirm_either',
|
||||
@@ -137,14 +159,23 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
'hidden' => 'mod_confirm_hidden'
|
||||
);
|
||||
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'widget_feed_comment_status_visible', isset( $this->configuration['widget_feed_comment_status_visible'] ) ? $this->configuration['widget_feed_comment_status_visible'] : 'any', FALSE, array( 'options' => $types ) ) );
|
||||
$return['hidden'] = new \IPS\Helpers\Form\Radio( 'widget_feed_comment_status_visible', isset( $this->configuration['widget_feed_comment_status_visible'] ) ? $this->configuration['widget_feed_comment_status_visible'] : 'any', FALSE, array( 'options' => $types ) );
|
||||
}
|
||||
if ( \IPS\IPS::classUsesTrait( $itemClass, 'IPS\Content\Solvable' ) )
|
||||
{
|
||||
$types = array(
|
||||
'any' => 'solved_either',
|
||||
'solved' => 'solved_solved',
|
||||
'unsolved' => 'solved_unsolved'
|
||||
);
|
||||
|
||||
$return['solved'] = new \IPS\Helpers\Form\Radio( 'widget_feed_status_solved', isset( $this->configuration['widget_feed_status_solved'] ) ? $this->configuration['widget_feed_status_solved'] : 'any', FALSE, array( 'options' => $types ) );
|
||||
}
|
||||
|
||||
/* Author */
|
||||
$author = NULL;
|
||||
try
|
||||
{
|
||||
if ( isset( $this->configuration['widget_feed_item_author'] ) and is_array( $this->configuration['widget_feed_item_author'] ) )
|
||||
if ( isset( $this->configuration['widget_feed_item_author'] ) and \is_array( $this->configuration['widget_feed_item_author'] ) )
|
||||
{
|
||||
foreach( $this->configuration['widget_feed_item_author'] as $id )
|
||||
{
|
||||
@@ -153,36 +184,36 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
}
|
||||
}
|
||||
catch( \OutOfRangeException $ex ) { }
|
||||
$form->add( new \IPS\Helpers\Form\Member( 'widget_feed_item_author', $author, FALSE, array( 'multiple' => true ) ) );
|
||||
$return['author'] = new \IPS\Helpers\Form\Member( 'widget_feed_item_author', $author, FALSE, array( 'multiple' => true ) );
|
||||
|
||||
/* Minimum comments/reviews */
|
||||
if ( isset( $class::$commentClass ) )
|
||||
{
|
||||
if ( $class::$firstCommentRequired )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'widget_feed_item_min_posts', isset( $this->configuration['widget_feed_item_min_posts'] ) ? $this->configuration['widget_feed_item_min_posts'] : 0, FALSE, array( 'unlimitedLang' => 'any', 'unlimited' => 0 ) ) );
|
||||
$return['min_posts'] = new \IPS\Helpers\Form\Number( 'widget_feed_item_min_posts', isset( $this->configuration['widget_feed_item_min_posts'] ) ? $this->configuration['widget_feed_item_min_posts'] : 0, FALSE, array( 'unlimitedLang' => 'any', 'unlimited' => 0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'widget_feed_item_min_comments', isset( $this->configuration['widget_feed_item_min_comments'] ) ? $this->configuration['widget_feed_item_min_comments'] : 0, FALSE, array( 'unlimitedLang' => 'any', 'unlimited' => 0 ) ) );
|
||||
$return['min_comments'] = new \IPS\Helpers\Form\Number( 'widget_feed_item_min_comments', isset( $this->configuration['widget_feed_item_min_comments'] ) ? $this->configuration['widget_feed_item_min_comments'] : 0, FALSE, array( 'unlimitedLang' => 'any', 'unlimited' => 0 ) );
|
||||
}
|
||||
}
|
||||
if ( isset( $class::$reviewClass ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'widget_feed_item_min_reviews', isset( $this->configuration['widget_feed_item_min_reviews'] ) ? $this->configuration['widget_feed_item_min_reviews'] : 0, FALSE, array( 'unlimitedLang' => 'any', 'unlimited' => 0 ) ) );
|
||||
$return['min_reviews'] = new \IPS\Helpers\Form\Number( 'widget_feed_item_min_reviews', isset( $this->configuration['widget_feed_item_min_reviews'] ) ? $this->configuration['widget_feed_item_min_reviews'] : 0, FALSE, array( 'unlimitedLang' => 'any', 'unlimited' => 0 ) );
|
||||
}
|
||||
|
||||
/* Rating */
|
||||
if ( in_array( 'IPS\Content\Ratings', class_implements( $class ) ) and isset( $class::$databaseColumnMap['rating_average'] ) )
|
||||
if ( \in_array( 'IPS\Content\Ratings', class_implements( $class ) ) and isset( $class::$databaseColumnMap['rating_average'] ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Rating( 'widget_feed_item_min_rating', isset( $this->configuration['widget_feed_item_min_rating'] ) ? $this->configuration['widget_feed_item_min_rating'] : 0, FALSE, array() ) );
|
||||
$return['rating'] = new \IPS\Helpers\Form\Rating( 'widget_feed_item_min_rating', isset( $this->configuration['widget_feed_item_min_rating'] ) ? $this->configuration['widget_feed_item_min_rating'] : 0, FALSE, array() );
|
||||
}
|
||||
|
||||
if ( isset( $class::$databaseColumnMap['date'] ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'widget_feed_comment_date', isset( $this->configuration['widget_feed_comment_date'] ) ? $this->configuration['widget_feed_comment_date'] : '0', FALSE, array(
|
||||
$return['date_restrict'] = new \IPS\Helpers\Form\Select( 'widget_feed_comment_date', isset( $this->configuration['widget_feed_comment_date'] ) ? (int) $this->configuration['widget_feed_comment_date'] : 0, FALSE, array(
|
||||
'options' => array(
|
||||
0 => 'show_all',
|
||||
0 => $class::databaseTableCount() > \IPS\UPGRADE_LARGE_TABLE_SIZE ? 'search_year' : 'show_all',
|
||||
1 => 'today',
|
||||
5 => 'last_5_days',
|
||||
7 => 'last_7_days',
|
||||
@@ -194,30 +225,30 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
60 => 'last_60_days',
|
||||
90 => 'last_90_days',
|
||||
)
|
||||
) ) );
|
||||
) );
|
||||
}
|
||||
|
||||
/* Number to show */
|
||||
$form->add( new \IPS\Helpers\Form\Number( 'widget_feed_show', isset( $this->configuration['widget_feed_show'] ) ? $this->configuration['widget_feed_show'] : 5, TRUE ) );
|
||||
$return['show'] = new \IPS\Helpers\Form\Number( 'widget_feed_show', isset( $this->configuration['widget_feed_show'] ) ? $this->configuration['widget_feed_show'] : 5, TRUE );
|
||||
|
||||
/* Sort */
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'widget_feed_sort_dir', isset( $this->configuration['widget_feed_sort_dir'] ) ? $this->configuration['widget_feed_sort_dir'] : 'desc', FALSE, array(
|
||||
$return['sort'] = new \IPS\Helpers\Form\Select( 'widget_feed_sort_dir', isset( $this->configuration['widget_feed_sort_dir'] ) ? $this->configuration['widget_feed_sort_dir'] : 'desc', FALSE, array(
|
||||
'options' => array(
|
||||
'desc' => 'descending',
|
||||
'asc' => 'ascending'
|
||||
)
|
||||
) ) );
|
||||
|
||||
/* Fix up some language strings */
|
||||
$langs = array( 'widget_feed_item_status_locked', 'widget_feed_item_status_pinned', 'widget_feed_item_status_featured', 'widget_feed_comment_status_visible', 'widget_feed_item_author', 'widget_feed_item_min_posts', 'widget_feed_item_min_comments', 'widget_feed_item_min_reviews', 'widget_feed_item_min_rating' );
|
||||
) );
|
||||
|
||||
/* Fix up some language strings */
|
||||
$langs = array( 'widget_feed_item_status_locked', 'widget_feed_item_status_pinned', 'widget_feed_item_status_featured', 'widget_feed_comment_status_visible', 'widget_feed_item_author', 'widget_feed_item_min_posts', 'widget_feed_item_min_comments', 'widget_feed_item_min_reviews', 'widget_feed_item_min_rating' );
|
||||
$words = \IPS\Member::loggedIn()->language()->get( $langs );
|
||||
|
||||
foreach( $langs as $lang )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ $lang ] = sprintf( $words[ $lang ], \IPS\Member::loggedIn()->language()->addToStack( $itemClass::$title ) );
|
||||
}
|
||||
|
||||
return $form;
|
||||
foreach( $langs as $lang )
|
||||
{
|
||||
\IPS\Member::loggedIn()->language()->words[ $lang ] = sprintf( $words[ $lang ], \IPS\Member::loggedIn()->language()->addToStack( $itemClass::$title ) );
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,13 +262,13 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
$class = static::$class;
|
||||
$itemClass = $class::$itemClass;
|
||||
|
||||
if ( is_array( $values[ 'widget_feed_container_' . $itemClass::$title ] ) )
|
||||
if ( \is_array( $values[ 'widget_feed_container_' . $itemClass::$title ] ) )
|
||||
{
|
||||
$values['widget_feed_container'] = array_keys( $values[ 'widget_feed_container_' . $itemClass::$title ] );
|
||||
unset( $values[ 'widget_feed_container_' . $class::$title ] );
|
||||
}
|
||||
|
||||
if ( is_array( $values['widget_feed_item_author'] ) )
|
||||
if ( \is_array( $values['widget_feed_item_author'] ) )
|
||||
{
|
||||
$members = array();
|
||||
foreach( $values['widget_feed_item_author'] as $member )
|
||||
@@ -261,15 +292,47 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
$class = static::$class;
|
||||
$itemClass = $class::$itemClass;
|
||||
$where = array();
|
||||
|
||||
|
||||
/* Reset now as this could have been previously set to TRUE if using multiple Content widgets */
|
||||
static::$permissionCheck = 'read';
|
||||
|
||||
/* Container */
|
||||
if ( isset( $itemClass::$containerNodeClass ) and !empty( $this->configuration['widget_feed_container'] ) )
|
||||
{
|
||||
$where['item'][] = array( \IPS\Db::i()->in( $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['container'], $this->configuration['widget_feed_container'] ) );
|
||||
$nodeIds = array();
|
||||
|
||||
if ( ! empty( $this->configuration['widget_feed_use_perms'] ) )
|
||||
{
|
||||
static::$skipPermissions = TRUE;
|
||||
}
|
||||
|
||||
foreach( $this->configuration['widget_feed_container'] as $id )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( ! empty( $this->configuration['widget_feed_use_perms'] ) )
|
||||
{
|
||||
if ( $itemClass::$containerNodeClass::load( $id )->can('read') )
|
||||
{
|
||||
$nodeIds[] = $id;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$nodeIds[] = $id;
|
||||
}
|
||||
}
|
||||
catch( \Exception $e )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$where['item'][] = array( \IPS\Db::i()->in( $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['container'], $nodeIds ) );
|
||||
}
|
||||
|
||||
|
||||
/* Locked or open status */
|
||||
if ( isset( $this->configuration['widget_feed_item_status_locked'] ) and in_array( 'IPS\Content\Lockable', class_implements( $itemClass ) ) )
|
||||
if ( isset( $this->configuration['widget_feed_item_status_locked'] ) and \in_array( 'IPS\Content\Lockable', class_implements( $itemClass ) ) )
|
||||
{
|
||||
if ( $this->configuration['widget_feed_item_status_locked'] == 'closed' )
|
||||
{
|
||||
@@ -282,7 +345,7 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
}
|
||||
|
||||
/* Featured or unfeatured */
|
||||
if ( isset( $this->configuration['widget_feed_item_status_featured'] ) and in_array( 'IPS\Content\Featurable', class_implements( $itemClass ) ) )
|
||||
if ( isset( $this->configuration['widget_feed_item_status_featured'] ) and \in_array( 'IPS\Content\Featurable', class_implements( $itemClass ) ) )
|
||||
{
|
||||
if ( $this->configuration['widget_feed_item_status_featured'] == 'notfeatured' )
|
||||
{
|
||||
@@ -293,9 +356,19 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
$where['item'][] = array( $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['featured'] . '=1' );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( isset( $this->configuration['widget_feed_status_solved'] ) and $this->configuration['widget_feed_status_solved'] != 'any' )
|
||||
{
|
||||
$where['item'][] = $this->configuration['widget_feed_status_solved'] == 'solved' ? array( $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['solved_comment_id'] . '>0' ) : array( $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['solved_comment_id'] . '=0' );
|
||||
|
||||
if ( $this->configuration['widget_feed_status_solved'] == 'solved' )
|
||||
{
|
||||
$where[] = array( $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnId . '=' . $itemClass::$databaseColumnMap['solved_comment_id'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* Pinned or unpinned */
|
||||
if ( isset( $this->configuration['widget_feed_item_status_pinned'] ) and in_array( 'IPS\Content\Pinnable', class_implements( $itemClass ) ) )
|
||||
if ( isset( $this->configuration['widget_feed_item_status_pinned'] ) and \in_array( 'IPS\Content\Pinnable', class_implements( $itemClass ) ) )
|
||||
{
|
||||
if ( $this->configuration['widget_feed_item_status_pinned'] == 'notpinned' )
|
||||
{
|
||||
@@ -308,7 +381,7 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
}
|
||||
|
||||
/* Author */
|
||||
if ( isset( $this->configuration['widget_feed_item_author'] ) and is_array( $this->configuration['widget_feed_item_author'] ) and count( $this->configuration['widget_feed_item_author'] ) )
|
||||
if ( isset( $this->configuration['widget_feed_item_author'] ) and \is_array( $this->configuration['widget_feed_item_author'] ) and \count( $this->configuration['widget_feed_item_author'] ) )
|
||||
{
|
||||
$where['item'][] = array( \IPS\Db::i()->in( $itemClass::$databaseTable . '.' . $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['author'], $this->configuration['widget_feed_item_author'] ) );
|
||||
}
|
||||
@@ -332,12 +405,16 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
{
|
||||
$where['item'][] = array( $itemClass::$databasePrefix . $itemClass::$databaseColumnMap['rating_average'] . '>?', (int) $this->configuration['widget_feed_item_min_rating'] );
|
||||
}
|
||||
|
||||
|
||||
/* Start date */
|
||||
if ( isset( $this->configuration['widget_feed_comment_date'] ) and isset( $this->configuration['widget_feed_comment_date'] ) and $this->configuration['widget_feed_comment_date'] > 0 )
|
||||
{
|
||||
$where[] = array( $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['date'] . '>?', \IPS\DateTime::create()->sub( new \DateInterval( 'P' . $this->configuration['widget_feed_comment_date'] . 'D' ) )->getTimestamp() );
|
||||
}
|
||||
else if ( $class::databaseTableCount() > \IPS\UPGRADE_LARGE_TABLE_SIZE )
|
||||
{
|
||||
$where[] = array( $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['date'] . '>?', \IPS\DateTime::create()->sub( new \DateInterval( 'P1Y' ) )->getTimestamp() );
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
@@ -372,11 +449,11 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
$this->buildWhere(),
|
||||
( isset( $this->configuration['widget_feed_sort_on'] ) and isset( $this->configuration['widget_feed_sort_dir'] ) ) ? ( $class::$databasePrefix . $class::$databaseColumnMap['date'] . ' ' . $this->configuration['widget_feed_sort_dir'] ) : NULL,
|
||||
( isset( $this->configuration['widget_feed_show'] ) AND $this->configuration['widget_feed_show'] ) ? $this->configuration['widget_feed_show'] : 5,
|
||||
( !isset( $this->configuration['widget_feed_use_perms'] ) or $this->configuration['widget_feed_use_perms'] ) ? 'read' : NULL,
|
||||
( !isset( $this->configuration['widget_feed_use_perms'] ) or $this->configuration['widget_feed_use_perms'] ) ? static::$permissionCheck : NULL,
|
||||
$hidden
|
||||
);
|
||||
|
||||
if ( count( $items ) )
|
||||
|
||||
if ( \count( $items ) )
|
||||
{
|
||||
return $this->output( $items, isset( $this->configuration['widget_feed_title'] ) ? $this->configuration['widget_feed_title'] : \IPS\Member::loggedIn()->language()->addToStack( $class::$title . '_pl' ) );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user