Version 4.1.19
This commit is contained in:
1 parent
28bd025b35
commit
2bd5025018
2674 files changed
+233518
-77766
No files matched your search
@@ -2,9 +2,9 @@
|
||||
/**
|
||||
* @brief Content Item Feed Widget
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Social Suite
|
||||
* @package IPS Community Suite
|
||||
* @subpackage forums
|
||||
* @since 16 Oct 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
@@ -28,7 +28,40 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
* Class
|
||||
*/
|
||||
protected static $class;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Moderator permission to generate caches on [optional]
|
||||
*/
|
||||
protected $moderatorPermissions = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param String $uniqueKey Unique key for this specific instance
|
||||
* @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 ) )
|
||||
{
|
||||
$cacheKeyChecks = array();
|
||||
|
||||
foreach( $this->moderatorPermissions as $permission )
|
||||
{
|
||||
$cacheKeyChecks[] = \IPS\Member::loggedIn()->modPermission( $permission );
|
||||
}
|
||||
|
||||
$this->cacheKey .= '_' . implode( '_', $cacheKeyChecks );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify widget configuration
|
||||
*
|
||||
@@ -205,6 +238,17 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
unset( $values[ 'widget_feed_container_' . $class::$title ] );
|
||||
}
|
||||
|
||||
if ( is_array( $values['widget_feed_item_author'] ) )
|
||||
{
|
||||
$members = array();
|
||||
foreach( $values['widget_feed_item_author'] as $member )
|
||||
{
|
||||
$members[] = $member->member_id;
|
||||
}
|
||||
|
||||
$values['widget_feed_item_author'] = $members;
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
@@ -263,7 +307,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'] ) )
|
||||
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'] ) );
|
||||
}
|
||||
@@ -296,7 +340,7 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
|
||||
return $where;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render a widget
|
||||
*
|
||||
@@ -305,13 +349,30 @@ abstract class _WidgetComment extends \IPS\Widget\PermissionCache
|
||||
public function render()
|
||||
{
|
||||
$class = static::$class;
|
||||
|
||||
|
||||
/* What visible status are we checking? */
|
||||
$hidden = \IPS\Content\Hideable::FILTER_AUTOMATIC;
|
||||
|
||||
if( isset( $this->configuration['widget_feed_comment_status_visible'] ) )
|
||||
{
|
||||
switch( $this->configuration['widget_feed_comment_status_visible'] )
|
||||
{
|
||||
case 'visible':
|
||||
$hidden = \IPS\Content\Hideable::FILTER_PUBLIC_ONLY;
|
||||
break;
|
||||
|
||||
case 'hidden':
|
||||
$hidden = \IPS\Content\Hideable::FILTER_ONLY_HIDDEN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$items = $class::getItemsWithPermission(
|
||||
$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'] ) ? $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_comment_status_visible'] ) and ( $this->configuration['widget_feed_comment_status_visible'] == 'either' or $this->configuration['widget_feed_comment_status_visible'] == 'hidden' ) ? TRUE : FALSE )
|
||||
$hidden
|
||||
);
|
||||
|
||||
if ( count( $items ) )
|
||||
|
||||
Reference in new issue
Block a user