aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-06-17 07:33:45 +0000
committerMario <mario@mariovavti.com>2021-06-17 07:33:45 +0000
commitb55676d08914d58927b5503a1bfa283397cd6d44 (patch)
tree34827895f126f9afe0c1db284e089632e19984c6 /include
parentb5a8ca6ef72366d355c99702f0a775ccc36734d5 (diff)
downloadvolse-hubzilla-b55676d08914d58927b5503a1bfa283397cd6d44.tar.gz
volse-hubzilla-b55676d08914d58927b5503a1bfa283397cd6d44.tar.bz2
volse-hubzilla-b55676d08914d58927b5503a1bfa283397cd6d44.zip
New landing page HQ with separate views for direct messages, public/limited messages and starred messages if the feature is enabled
Diffstat (limited to 'include')
-rw-r--r--include/items.php2
-rw-r--r--include/text.php27
2 files changed, 28 insertions, 1 deletions
diff --git a/include/items.php b/include/items.php
index 15de6c730..7fa3a8e71 100644
--- a/include/items.php
+++ b/include/items.php
@@ -2494,7 +2494,7 @@ function send_status_notifications($post_id,$item) {
Enotify::submit(array(
- 'type' => NOTIFY_COMMENT,
+ 'type' => ((intval($item['item_private']) === 2) ? NOTIFY_MAIL : NOTIFY_COMMENT),
'from_xchan' => $item['author_xchan'],
'to_xchan' => $r[0]['channel_hash'],
'item' => $item,
diff --git a/include/text.php b/include/text.php
index 8dc5ee188..a0c2689af 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3880,3 +3880,30 @@ function sanitize_text_field($str) {
return preg_replace('/\s+/S', ' ', $str);
}
+/**
+ * @brief shortens a string to $max_length without cutting off words
+ * @param string $str
+ * @param intval $max_length
+ * @param string $suffix (optional)
+
+ * @return string
+ */
+function substr_words($str, $max_length, $suffix = '...') {
+
+ if (strlen($str) > $max_length) {
+ $words = preg_split('/\s/', $str);
+ $ret = '';
+ $i = 0;
+ while (true) {
+ $length = (strlen($ret) + strlen($words[$i]));
+ if ($length > $max_length) {
+ break;
+ }
+ $ret .= " " . $words[$i];
+ ++$i;
+ }
+ $ret .= $suffix;
+ }
+
+ return (($ret) ? $ret : $str);
+}