]> git.mxchange.org Git - friendica.git/commitdiff
Remove function prepare_text and use BBCode::convert() instead
authorPhilipp Holzer <admin+github@philipp.info>
Tue, 22 Oct 2019 22:58:13 +0000 (00:58 +0200)
committerPhilipp Holzer <admin+github@philipp.info>
Tue, 22 Oct 2019 22:58:13 +0000 (00:58 +0200)
include/text.php
src/Model/Event.php
src/Model/Item.php
src/Model/Profile.php

index e4393b09caeef38bb1e61fd3d8aa0193ac338d3f..84efebac2de123fe2738f96e7a79a60b2a1d2e88 100644 (file)
@@ -17,19 +17,6 @@ function activity_match($haystack,$needle) {
        return (($haystack === $needle) || ((basename($needle) === $haystack) && strstr($needle, NAMESPACE_ACTIVITY_SCHEMA)));
 }
 
-/**
- * @brief Given a text string, convert from bbcode to html and add smilie icons.
- *
- * @param string $text String with bbcode.
- * @return string Formatted HTML
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- */
-function prepare_text($text)
-{
-       $s = BBCode::convert($text);
-       return trim($s);
-}
-
 /**
  * return array with details for categories and folders for an item
  *
index 91521808447ad472b8d3935474673685ff65d56c..cbd245a2339713494d740d7d5085b3374e144458 100644 (file)
@@ -911,7 +911,7 @@ class Event extends BaseObject
                $tpl = Renderer::getMarkupTemplate('event_stream_item.tpl');
                $return = Renderer::replaceMacros($tpl, [
                        '$id'             => $item['event-id'],
-                       '$title'          => prepare_text($item['event-summary']),
+                       '$title'          => BBCode::convert($item['event-summary']),
                        '$dtstart_label'  => L10n::t('Starts:'),
                        '$dtstart_title'  => $dtstart_title,
                        '$dtstart_dt'     => $dtstart_dt,
@@ -929,7 +929,7 @@ class Event extends BaseObject
                        '$author_name'    => $item['author-name'],
                        '$author_link'    => $profile_link,
                        '$author_avatar'  => $item['author-avatar'],
-                       '$description'    => prepare_text($item['event-desc']),
+                       '$description'    => BBCode::convert($item['event-desc']),
                        '$location_label' => L10n::t('Location:'),
                        '$show_map_label' => L10n::t('Show map'),
                        '$hide_map_label' => L10n::t('Hide map'),
@@ -979,7 +979,7 @@ class Event extends BaseObject
                        }
                }
 
-               $location['name'] = prepare_text($location['name']);
+               $location['name'] = BBCode::convert($location['name']);
 
                // Construct the map HTML.
                if (isset($location['address'])) {
index 456d770260c661ba5881aa1956b50fd0714b8b50..4c98eb50474f0ce62a4007db0ce5c545636f1583 100644 (file)
@@ -3348,7 +3348,7 @@ class Item extends BaseObject
                ) {
                        self::addRedirLinkToImageLinks($item);
 
-                       $item["rendered-html"] = prepare_text($item["body"]);
+                       $item["rendered-html"] = BBCode::convert($item["body"]);
                        $item["rendered-hash"] = hash("md5", $item["body"]);
 
                        $hook_data = ['item' => $item, 'rendered-html' => $item['rendered-html'], 'rendered-hash' => $item['rendered-hash']];
index b69860edfff73038d4f6438f4ab2e865be765c2c..de329038911dfb342b2bd168b837d318d667750e 100644 (file)
@@ -823,51 +823,51 @@ class Profile
                                $profile['religion'] = [L10n::t('Religion:'), $a->profile['religion']];
                        }
 
-                       if ($txt = prepare_text($a->profile['about'])) {
+                       if ($txt = BBCode::convert($a->profile['about'])) {
                                $profile['about'] = [L10n::t('About:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['interest'])) {
+                       if ($txt = BBCode::convert($a->profile['interest'])) {
                                $profile['interest'] = [L10n::t('Hobbies/Interests:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['likes'])) {
+                       if ($txt = BBCode::convert($a->profile['likes'])) {
                                $profile['likes'] = [L10n::t('Likes:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['dislikes'])) {
+                       if ($txt = BBCode::convert($a->profile['dislikes'])) {
                                $profile['dislikes'] = [L10n::t('Dislikes:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['contact'])) {
+                       if ($txt = BBCode::convert($a->profile['contact'])) {
                                $profile['contact'] = [L10n::t('Contact information and Social Networks:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['music'])) {
+                       if ($txt = BBCode::convert($a->profile['music'])) {
                                $profile['music'] = [L10n::t('Musical interests:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['book'])) {
+                       if ($txt = BBCode::convert($a->profile['book'])) {
                                $profile['book'] = [L10n::t('Books, literature:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['tv'])) {
+                       if ($txt = BBCode::convert($a->profile['tv'])) {
                                $profile['tv'] = [L10n::t('Television:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['film'])) {
+                       if ($txt = BBCode::convert($a->profile['film'])) {
                                $profile['film'] = [L10n::t('Film/dance/culture/entertainment:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['romance'])) {
+                       if ($txt = BBCode::convert($a->profile['romance'])) {
                                $profile['romance'] = [L10n::t('Love/Romance:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['work'])) {
+                       if ($txt = BBCode::convert($a->profile['work'])) {
                                $profile['work'] = [L10n::t('Work/employment:'), $txt];
                        }
 
-                       if ($txt = prepare_text($a->profile['education'])) {
+                       if ($txt = BBCode::convert($a->profile['education'])) {
                                $profile['education'] = [L10n::t('School/education:'), $txt];
                        }