]> git.mxchange.org Git - friendica.git/commitdiff
Add one-line content filter when there's only one reason
authorHypolite Petovan <mrpetovan@gmail.com>
Sun, 22 Apr 2018 18:28:34 +0000 (14:28 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Sun, 22 Apr 2018 18:28:34 +0000 (14:28 -0400)
include/text.php

index 2ec017caffa9bb613348d153f8cae2c47cc92a01..6c09167494231dd20635681ef307ef6bb55c822c 100644 (file)
@@ -1412,15 +1412,24 @@ function apply_content_filter($html, array $reasons)
 {
        if (count($reasons)) {
                $rnd = random_string(8);
-               $content_filter_html = '<ul class="content-filter-reasons">';
-               foreach ($reasons as $reason) {
-                       $content_filter_html .= '<li>' . htmlspecialchars($reason) . '</li>' . PHP_EOL;
+
+               if (count($reasons) > 1) {
+                       $content_filter_html = '<ul class="content-filter-reasons">';
+                       foreach ($reasons as $reason) {
+                               $content_filter_html .= '<li>' . htmlspecialchars($reason) . '</li>' . PHP_EOL;
+                       }
+                       $content_filter_html .= '</ul>
+                               <p><button type="button" id="content-filter-wrap-' . $rnd . '" class="btn btn-default btn-small content-filter-button" onclick="openClose(\'content-filter-' . $rnd . '\');"><i class="glyphicon glyphicon-eye-open"></i> ' .
+                               L10n::t('Click to open/close') .
+                               '</button></p>';
+               } elseif (count($reasons) == 1) {
+                       $reason = array_pop($reasons);
+                       $content_filter_html .= '<p>' . htmlspecialchars($reason) . ' <button type="button" id="content-filter-wrap-' . $rnd . '" class="btn btn-default btn-xs content-filter-button" onclick="openClose(\'content-filter-' . $rnd . '\');"><i class="glyphicon glyphicon-eye-open"></i> ' .
+                               L10n::t('Click to open/close') .
+                               '</button></p>';
                }
-               $content_filter_html .= '</ul>
-                       <p><span id="content-filter-wrap-' . $rnd . '" class="fakelink content-filter-button" onclick=openClose(\'content-filter-' . $rnd . '\'); >' .
-                       L10n::t('Click to open/close') .
-                       '</span></p>
-                       <div id="content-filter-' . $rnd . '" class="content-filter-content" style="display: none;">';
+
+               $content_filter_html .= '<div id="content-filter-' . $rnd . '" class="content-filter-content" style="display: none;">';
 
                $html = $content_filter_html . $html . '</div>';
        }