Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Topic Model
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @subpackage Forums
|
||||
* @since 8 Jan 2014
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS\forums;
|
||||
@@ -34,7 +33,8 @@ class _Topic extends \IPS\Content\Item implements
|
||||
\IPS\Content\Polls, \SplObserver,
|
||||
\IPS\Content\Ratings,
|
||||
\IPS\Content\Searchable,
|
||||
\IPS\Content\Embeddable
|
||||
\IPS\Content\Embeddable,
|
||||
\IPS\Content\MetaData
|
||||
{
|
||||
const ARCHIVE_NOT = 0;
|
||||
const ARCHIVE_DONE = 1;
|
||||
@@ -97,7 +97,8 @@ class _Topic extends \IPS\Content\Item implements
|
||||
'moved_on' => 'moved_on',
|
||||
'featured' => 'featured',
|
||||
'state' => 'state',
|
||||
'updated' => 'last_post'
|
||||
'updated' => 'last_post',
|
||||
'meta_data' => 'topic_meta_data'
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1085,6 +1086,17 @@ class _Topic extends \IPS\Content\Item implements
|
||||
|
||||
return parent::unhide( $member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Can promote this comment/item?
|
||||
*
|
||||
* @param \IPS\Member|NULL $member The member to check for (NULL for currently logged in member)
|
||||
* @return boolean
|
||||
*/
|
||||
public function canPromoteToSocialMedia( $member=NULL )
|
||||
{
|
||||
return parent::canPromoteToSocialMedia( $member ) and $this->container()->can_view_others;
|
||||
}
|
||||
|
||||
/* !Saved Actions */
|
||||
|
||||
@@ -1105,10 +1117,11 @@ class _Topic extends \IPS\Content\Item implements
|
||||
* @param string $action The action
|
||||
* @param \IPS\Member|NULL $member The member doing the action (NULL for currently logged in member)
|
||||
* @param string|NULL $reason Reason (for hides)
|
||||
* @param bool $immedaitely Delete Immediately
|
||||
* @return void
|
||||
* @throws \OutOfRangeException|\InvalidArgumentException|\RuntimeException
|
||||
*/
|
||||
public function modAction( $action, \IPS\Member $member = NULL, $reason = NULL )
|
||||
public function modAction( $action, \IPS\Member $member = NULL, $reason = NULL, $immediately = FALSE )
|
||||
{
|
||||
if ( mb_substr( $action, 0, 12 ) === 'savedAction-' )
|
||||
{
|
||||
@@ -1450,6 +1463,23 @@ class _Topic extends \IPS\Content\Item implements
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should this topic be archived again?
|
||||
*
|
||||
* @param \IPS\Member\NULL $member The member (NULL for currently logged in member)
|
||||
* @return bool
|
||||
*/
|
||||
public function canRemoveArchiveExcludeFlag( $member=NULL )
|
||||
{
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
|
||||
if ( $member->hasAcpRestriction( 'forums', 'forums', 'archive_manage' ) AND $this->topic_archive_status == static::ARCHIVE_EXCLUDE )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unarchive confirm message
|
||||
@@ -1650,6 +1680,41 @@ class _Topic extends \IPS\Content\Item implements
|
||||
return parent::commentMultimodActions( $member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Can Feature a Comment
|
||||
*
|
||||
* @param \IPS\Member|NULL The member, or NULL for currently logged in
|
||||
* @return bool
|
||||
* @note This is a wrapper for the extension so content items can extend and apply their own logic
|
||||
*/
|
||||
public function canFeatureComment( \IPS\Member $member = NULL )
|
||||
{
|
||||
if ( $this->isArchived() OR $this->isQuestion() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::canFeatureComment( $member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Can perform an action on a message
|
||||
*
|
||||
* @param string The action
|
||||
* @param \IPS\Member|NULL The member, or NULL for currently logged in
|
||||
* @return bool
|
||||
* @note This is a wrapper for the extension so content items can extend and apply their own logic
|
||||
*/
|
||||
public function canOnMessage( $action, \IPS\Member $member = NULL )
|
||||
{
|
||||
if ( $this->isArchived() )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return parent::canOnMessage( $action, $member );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get comments
|
||||
*
|
||||
@@ -1662,9 +1727,10 @@ class _Topic extends \IPS\Content\Item implements
|
||||
* @param \IPS\DateTime|NULL $cutoff If an \IPS\DateTime object is provided, only comments posted AFTER that date will be included
|
||||
* @param mixed $extraWhereClause Additional where clause(s) (see \IPS\Db::build for details)
|
||||
* @param bool|NULL $bypassCache Used in cases where comments may have already been loaded i.e. splitting comments on an item.
|
||||
* @param bool $includeDeleted Include Deleted Content
|
||||
* @return array|NULL|\IPS\Content\Comment If $limit is 1, will return \IPS\Content\Comment or NULL for no results. For any other number, will return an array.
|
||||
*/
|
||||
public function comments( $limit=NULL, $offset=NULL, $order='date', $orderDirection='asc', $member=NULL, $includeHiddenComments=NULL, $cutoff=NULL, $extraWhereClause=NULL, $bypassCache=FALSE )
|
||||
public function comments( $limit=NULL, $offset=NULL, $order='date', $orderDirection='asc', $member=NULL, $includeHiddenComments=NULL, $cutoff=NULL, $extraWhereClause=NULL, $bypassCache=FALSE, $includeDeleted=FALSE )
|
||||
{
|
||||
static $comments = array();
|
||||
$idField = static::$databaseColumnId;
|
||||
@@ -1708,7 +1774,7 @@ class _Topic extends \IPS\Content\Item implements
|
||||
$class = static::$commentClass;
|
||||
}
|
||||
|
||||
$comments[ $_hash ] = $this->_comments( $class, $limit ?: static::getCommentsPerPage(), $offset, ( isset( $class::$databaseColumnMap[ $order ] ) ? ( $class::$databasePrefix . $class::$databaseColumnMap[ $order ] ) : $order ) . ' ' . $orderDirection, $member, $includeHiddenComments, $cutoff, $includeWarnings, $extraWhereClause );
|
||||
$comments[ $_hash ] = $this->_comments( $class, $limit ?: static::getCommentsPerPage(), $offset, ( isset( $class::$databaseColumnMap[ $order ] ) ? ( $class::$databasePrefix . $class::$databaseColumnMap[ $order ] ) : $order ) . ' ' . $orderDirection, $member, $includeHiddenComments, $cutoff, $includeWarnings, $extraWhereClause, $includeDeleted );
|
||||
|
||||
/* Restore comment class now */
|
||||
if( $commentClass )
|
||||
@@ -1873,4 +1939,26 @@ class _Topic extends \IPS\Content\Item implements
|
||||
$firstComment = $this->firstComment();
|
||||
return $firstComment ? $firstComment->content() : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Supported Meta Data Types
|
||||
*
|
||||
* @return array|NULL
|
||||
*/
|
||||
public static function supportedMetaDataTypes()
|
||||
{
|
||||
return array( 'core_FeaturedComments', 'core_ContentMessages' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get content for embed
|
||||
*
|
||||
* @param array $params Additional parameters to add to URL
|
||||
* @return string
|
||||
*/
|
||||
public function embedContent( $params )
|
||||
{
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'forums', 'front' ) );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'forums' )->embedTopic( $this, $this->url()->setQueryString( $params ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user