Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -13,13 +13,13 @@ namespace IPS\Content;
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
|
||||
use IPS\core\Feature;
|
||||
use IPS\Events\Event;
|
||||
use IPS\File;
|
||||
use IPS\IPS;
|
||||
use IPS\Member;
|
||||
use IPS\Patterns\ActiveRecordIterator;
|
||||
use OutOfRangeException;
|
||||
use function class_implements;
|
||||
use function get_called_class;
|
||||
use function in_array;
|
||||
|
||||
if( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
@@ -37,6 +37,12 @@ trait Featurable
|
||||
*/
|
||||
public function canFeature( ?Member $member=NULL ) : bool
|
||||
{
|
||||
/* Extensions go first */
|
||||
if( $permCheck = Permissions::can( 'feature', $this, $member ) )
|
||||
{
|
||||
return ( $permCheck === Permissions::PERM_ALLOW );
|
||||
}
|
||||
|
||||
if( !$this->actionEnabled( 'feature', $member ) )
|
||||
{
|
||||
return false;
|
||||
@@ -113,6 +119,9 @@ trait Featurable
|
||||
|
||||
$this->$featuredColumn = $featured;
|
||||
$this->save();
|
||||
|
||||
/* Fire an event */
|
||||
Event::fire( 'onStatusChange', $this, array( ( $featured ? 'feature' : 'unfeature' ) ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -130,7 +139,7 @@ trait Featurable
|
||||
{
|
||||
$where = array( array( static::$databaseTable . '.' . static::$databasePrefix . static::$databaseColumnMap['featured'] . '=?', 1 ) );
|
||||
|
||||
if ( in_array( 'IPS\Content\FuturePublishing', class_implements( get_called_class() ) ) )
|
||||
if( IPS::classUsesTrait( get_called_class(), FuturePublishing::class ) )
|
||||
{
|
||||
$where[] = array( static::$databaseTable . '.' . static::$databasePrefix . static::$databaseColumnMap['is_future_entry'] . '=?', 0 );
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user