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,24 +12,33 @@
|
||||
namespace IPS\downloads\extensions\core\Notifications;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\downloads\File;
|
||||
use IPS\Extensions\NotificationsAbstract;
|
||||
use IPS\Lang;
|
||||
use IPS\Member;
|
||||
use IPS\Notification\Inline;
|
||||
use OutOfRangeException;
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification Options
|
||||
*/
|
||||
class _Files
|
||||
class Files extends NotificationsAbstract
|
||||
{
|
||||
/**
|
||||
* Get fields for configuration
|
||||
*
|
||||
* @param \IPS\Member|null $member The member (to take out any notification types a given member will never see) or NULL if this is for the ACP
|
||||
* @param Member|null $member The member (to take out any notification types a given member will never see) or NULL if this is for the ACP
|
||||
* @return array
|
||||
*/
|
||||
public static function configurationOptions( \IPS\Member $member = NULL ): array
|
||||
public static function configurationOptions( Member $member = NULL ): array
|
||||
{
|
||||
return array(
|
||||
'new_file_version' => array(
|
||||
@@ -47,30 +56,30 @@ class _Files
|
||||
/**
|
||||
* Parse notification: new_file_version
|
||||
*
|
||||
* @param \IPS\Notification\Inline $notification The notification
|
||||
* @param bool $htmlEscape TRUE to escape HTML in title
|
||||
* @param Inline $notification The notification
|
||||
* @param bool $htmlEscape TRUE to escape HTML in title
|
||||
* @return array
|
||||
* @code
|
||||
return array(
|
||||
'title' => "Mark has replied to A Topic", // The notification title
|
||||
'url' => \IPS\Http\Url\Friendly::internal( ... ), // The URL the notification should link to
|
||||
'content' => "Lorem ipsum dolar sit", // [Optional] Any appropriate content. Do not format this like an email where the text
|
||||
// explains what the notification is about - just include any appropriate content.
|
||||
// For example, if the notification is about a post, set this as the body of the post.
|
||||
'author' => \IPS\Member::load( 1 ), // [Optional] The user whose photo should be displayed for this notification
|
||||
);
|
||||
* return array(
|
||||
* 'title' => "Mark has replied to A Topic", // The notification title
|
||||
* 'url' => \IPS\Http\Url\Friendly::internal( ... ), // The URL the notification should link to
|
||||
* 'content' => "Lorem ipsum dolar sit", // [Optional] Any appropriate content. Do not format this like an email where the text
|
||||
* // explains what the notification is about - just include any appropriate content.
|
||||
* // For example, if the notification is about a post, set this as the body of the post.
|
||||
* 'author' => \IPS\Member::load( 1 ), // [Optional] The user whose photo should be displayed for this notification
|
||||
* );
|
||||
* @endcode
|
||||
*/
|
||||
public function parse_new_file_version( $notification, $htmlEscape=TRUE )
|
||||
public function parse_new_file_version(Inline $notification, bool $htmlEscape=TRUE ): array
|
||||
{
|
||||
$item = $notification->item;
|
||||
if ( !$item )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
return array(
|
||||
'title' => ( $item->container()->version_numbers ) ? \IPS\Member::loggedIn()->language()->addToStack( 'notification__new_file_version_with', FALSE, array( 'sprintf' => array( $item->author()->name, $item->version, $item->mapped('title') ) ) ) : \IPS\Member::loggedIn()->language()->addToStack( 'notification__new_file_version', FALSE, array( 'sprintf' => array( $item->author()->name, $item->mapped('title') ) ) ),
|
||||
'title' => ( $item->container()->version_numbers ) ? Member::loggedIn()->language()->addToStack( 'notification__new_file_version_with', FALSE, array( 'sprintf' => array( $item->author()->name, $item->version, $item->mapped('title') ) ) ) : Member::loggedIn()->language()->addToStack( 'notification__new_file_version', FALSE, array( 'sprintf' => array( $item->author()->name, $item->mapped('title') ) ) ),
|
||||
'url' => $notification->item->url(),
|
||||
'content' => $notification->item->content(),
|
||||
'author' => $notification->extra ?: $notification->item->author(),
|
||||
@@ -81,11 +90,11 @@ class _Files
|
||||
/**
|
||||
* Parse notification for mobile: new_file_version
|
||||
*
|
||||
* @param \IPS\Lang $language The language that the notification should be in
|
||||
* @param \IPS\downloads\File $file The file
|
||||
* @param Lang $language The language that the notification should be in
|
||||
* @param File $file The file
|
||||
* @return array
|
||||
*/
|
||||
public static function parse_mobile_new_file_version( \IPS\Lang $language, \IPS\downloads\File $file )
|
||||
public static function parse_mobile_new_file_version( Lang $language, File $file ): array
|
||||
{
|
||||
return array(
|
||||
'title' => $language->addToStack( 'notification__new_file_version_title' ),
|
||||
|
||||
Reference in new issue
Block a user