]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
Display content warning as title if collapsing is deactivated
[friendica.git] / include / text.php
index 6e11c3a38a64e48395bda7324e20aeaa7984868f..8a6fd003129456c944117c42a9c9799c09458196 100644 (file)
@@ -1214,7 +1214,7 @@ function put_item_in_cache(&$item, $update = false)
  * @param boolean $is_preview
  * @return string item body html
  * @hook prepare_body_init item array before any work
- * @hook content_filter ('item'=>item array, 'filter_reasons'=>string array) before first bbcode to html
+ * @hook prepare_body_content_filter ('item'=>item array, 'filter_reasons'=>string array) before first bbcode to html
  * @hook prepare_body ('item'=>item array, 'html'=>body string, 'is_preview'=>boolean, 'filter_reasons'=>string array) after first bbcode to html
  * @hook prepare_body_final ('item'=>item array, 'html'=>body string) after attach icons and blockquote special case handling (spoiler, author)
  */
@@ -1270,17 +1270,19 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
 
        // Compile eventual content filter reasons
        $filter_reasons = [];
-       if (!empty($item['content-warning']) && !PConfig::get(local_user(), 'social', 'disable_cw')) {
-               $filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']);
-       }
+       if (!$is_preview && !($item['self'] && local_user() == $item['uid'])) {
+               if (!empty($item['content-warning']) && (!local_user() || !PConfig::get(local_user(), 'social', 'disable_cw', false))) {
+                       $filter_reasons[] = L10n::t('Content warning: %s', $item['content-warning']);
+               }
 
-       $hook_data = [
-               'item' => $item,
-               'filter_reasons' => $filter_reasons
-       ];
-       Addon::callHooks('content_filter', $hook_data);
-       $filter_reasons = $hook_data['filter_reasons'];
-       unset($hook_data);
+               $hook_data = [
+                       'item' => $item,
+                       'filter_reasons' => $filter_reasons
+               ];
+               Addon::callHooks('prepare_body_content_filter', $hook_data);
+               $filter_reasons = $hook_data['filter_reasons'];
+               unset($hook_data);
+       }
 
        // Update the cached values if there is no "zrl=..." on the links.
        $update = (!local_user() && !remote_user() && ($item["uid"] == 0));