]> git.mxchange.org Git - friendica.git/blobdiff - src/Content/Text/HTML.php
Remove redundant htmlentities/htmlspecialchars
[friendica.git] / src / Content / Text / HTML.php
index 6e31697e07fa6fca3c28107e22edeb4cd827e81c..276094a8f9e9d691c0eb743b0cf74bc69fa4bd24 100644 (file)
@@ -7,15 +7,18 @@ namespace Friendica\Content\Text;
 
 use DOMDocument;
 use DOMXPath;
+use Friendica\Content\Feature;
 use Friendica\Core\Addon;
 use Friendica\Core\L10n;
 use Friendica\Core\Config;
 use Friendica\Core\PConfig;
+use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\Model\Contact;
 use Friendica\Util\Network;
 use Friendica\Util\Proxy as ProxyUtils;
+use Friendica\Util\Strings;
 use Friendica\Util\XML;
 use League\HTMLToMarkdown\HtmlConverter;
 
@@ -710,7 +713,7 @@ class HTML
         *
         * @param string $s
         */
-       public static function htmlToBBVideo($s)
+       public static function toBBCodeVideo($s)
        {
                $s = preg_replace(
                        '#<object[^>]+>(.*?)https?://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+)(.*?)</object>#ism',
@@ -905,7 +908,7 @@ class HTML
        public static function micropro($contact, $redirect = false, $class = '', $textmode = false)
        {
                // Use the contact URL if no address is available
-               if (!x($contact, "addr")) {
+               if (empty($contact['addr'])) {
                        $contact["addr"] = $contact["url"];
                }
 
@@ -921,7 +924,7 @@ class HTML
                }
 
                // If there is some js available we don't need the url
-               if (x($contact, 'click')) {
+               if (!empty($contact['click'])) {
                        $url = '';
                }
 
@@ -948,7 +951,7 @@ class HTML
         *
         * @return string Formatted HTML.
         */
-       public static function search($s, $id = 'search-box', $url = 'search', $save = false, $aside = true)
+       public static function search($s, $id = 'search-box', $url = 'search', $aside = true)
        {
                $mode = 'text';
 
@@ -958,12 +961,12 @@ class HTML
                $save_label = $mode === 'text' ? L10n::t('Save') : L10n::t('Follow');
 
                $values = [
-                               '$s' => htmlspecialchars($s),
+                               '$s' => $s,
                                '$id' => $id,
                                '$action_url' => $url,
                                '$search_label' => L10n::t('Search'),
                                '$save_label' => $save_label,
-                               '$savedsearch' => local_user() && Feature::isEnabled(local_user(), 'savedsearch'),
+                               '$savedsearch' => 'savedsearch',
                                '$search_hint' => L10n::t('@name, !forum, #tags, content'),
                                '$mode' => $mode
                        ];
@@ -1009,7 +1012,7 @@ class HTML
                        $tpl = Renderer::getMarkupTemplate('wall/content_filter.tpl');
                        $html = Renderer::replaceMacros($tpl, [
                                '$reasons'   => $reasons,
-                               '$rnd'       => random_string(8),
+                               '$rnd'       => Strings::getRandomHex(8),
                                '$openclose' => L10n::t('Click to open/close'),
                                '$html'      => $html
                        ]);