diff options
author | Mario <mario@mariovavti.com> | 2021-06-17 07:33:45 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-06-17 07:33:45 +0000 |
commit | b55676d08914d58927b5503a1bfa283397cd6d44 (patch) | |
tree | 34827895f126f9afe0c1db284e089632e19984c6 /include | |
parent | b5a8ca6ef72366d355c99702f0a775ccc36734d5 (diff) | |
download | volse-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.php | 2 | ||||
-rw-r--r-- | include/text.php | 27 |
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); +} |