aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Messages.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2022-03-29 11:42:53 +0200
committerMario Vavti <mario@mariovavti.com>2022-03-29 11:42:53 +0200
commit0784cd593a39a4fc297e8a82f7e79bc8019a0868 (patch)
tree22182afb37cf460f8208fff9d276a0672add3185 /Zotlabs/Widget/Messages.php
parent0e2e9321025f87fe9587f3d183adaea6185e4e20 (diff)
parent9c5d2ee5630dd7033904039dcd1e92db8821b644 (diff)
downloadvolse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.tar.gz
volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.tar.bz2
volse-hubzilla-0784cd593a39a4fc297e8a82f7e79bc8019a0868.zip
Merge branch '7.2RC'7.2
Diffstat (limited to 'Zotlabs/Widget/Messages.php')
-rw-r--r--Zotlabs/Widget/Messages.php27
1 files changed, 21 insertions, 6 deletions
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 71f4bd310..d045ae85b 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -1,5 +1,13 @@
<?php
+/**
+ * * Name: HQ Messages
+ * * Description: Quick access to messages, direct messages, starred messages (if enabled) and notifications
+ * * Author: Mario Vavti
+ * * Requires: hq
+ */
+
+
namespace Zotlabs\Widget;
use App;
@@ -17,8 +25,8 @@ class Messages {
$tpl = get_markup_template('messages_widget.tpl');
$o = replace_macros($tpl, [
- '$entries' => $page['entries'],
- '$offset' => $page['offset'],
+ '$entries' => $page['entries'] ?? [],
+ '$offset' => $page['offset'] ?? 0,
'$feature_star' => feature_enabled(local_channel(), 'star_posts'),
'$strings' => [
'messages_title' => t('Public and restricted messages'),
@@ -37,11 +45,11 @@ class Messages {
if (!local_channel())
return;
- if ($options['offset'] == -1) {
+ if (isset($options['offset']) && $options['offset'] == -1) {
return;
}
- if ($options['type'] == 'notification') {
+ if (isset($options['type']) && $options['type'] == 'notification') {
return self::get_notices_page($options);
}
@@ -103,13 +111,20 @@ class Messages {
if (!$summary) {
$summary = $item['summary'];
}
+
if (!$summary) {
- $summary = htmlentities(html2plain(bbcode($item['body'], ['drop_media' => true]), 75, true), ENT_QUOTES, 'UTF-8', false);
+ $summary = html2plain(bbcode($item['body'], ['drop_media' => true]), 75, true);
+ if ($summary) {
+ $summary = htmlentities($summary, ENT_QUOTES, 'UTF-8', false);
+ }
}
+
if (!$summary) {
$summary = '...';
}
- $summary = substr_words($summary, 68);
+ else {
+ $summary = substr_words($summary, 68);
+ }
switch(intval($item['item_private'])) {
case 1: