Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

@@ -12,7 +12,7 @@
namespace IPS\downloads\extensions\core\Notifications;
/* 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,22 +24,31 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
class _Files
{
/**
* Get configuration
* Get fields for configuration
*
* @param \IPS\Member $member The member
* @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
* @return array
*/
public function getConfiguration( $member )
{
public static function configurationOptions( \IPS\Member $member = NULL )
{
return array(
'new_file_version' => array( 'default' => array( 'email' ), 'disabled' => array() ),
'new_file_version' => array(
'type' => 'standard',
'notificationTypes' => array( 'new_file_version' ),
'title' => 'notifications__downloads_Files',
'showTitle' => FALSE,
'description' => 'notifications__downloads_Files_desc',
'default' => array( 'inline', 'push', 'email' ),
'disabled' => array()
)
);
}
/**
* Parse notification: new_content
* Parse notification: new_file_version
*
* @param \IPS\Notification\Inline $notification The notification
* @param bool $htmlEscape TRUE to escape HTML in title
* @return array
* @code
return array(
@@ -52,20 +61,42 @@ class _Files
);
* @endcode
*/
public function parse_new_file_version( $notification )
public function parse_new_file_version( $notification, $htmlEscape=TRUE )
{
$item = $notification->item;
if ( !$item )
{
throw new \OutOfRangeException;
}
return array(
'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 ) ? \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') ) ) ),
'url' => $notification->item->url(),
'content' => $notification->item->content(),
'author' => $notification->extra ?: $notification->item->author(),
'unread' => (bool) ( $item->unread() )
);
}
/**
* 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
* @return array
*/
public static function parse_mobile_new_file_version( \IPS\Lang $language, \IPS\downloads\File $file )
{
return array(
'body' => $language->addToStack( 'notification__new_file_version', FALSE, array( 'htmlsprintf' => array(
$file->author()->name,
$file->mapped('title')
) ) ),
'data' => array(
'url' => (string) $file->url(),
'author' => $file->author()
),
'channelId' => 'files',
);
}
}