sidebar.php 997 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. function echo_sidebar ($image, $text, $links = null) {
  3. echo "<div class=\"sidebar\">";
  4. if (isset($image)) {
  5. if (
  6. isset($_COOKIE["images"]) &&
  7. ($_COOKIE["images"] === "disabled" ||
  8. ($_COOKIE["images"] !== "enabled" && (isset($_SERVER["HTTP_SAVE_DATA"]) && $_SERVER["HTTP_SAVE_DATA"] === "on")))
  9. )
  10. $image = get_placeholder();
  11. echo "<a href=\"" . convert_bandcamp_link(resize_link($image, 0)) . "\">";
  12. echo "<img src=\"" . convert_bandcamp_link($image) . "\">";
  13. echo "</a>";
  14. };
  15. if (!empty($text)) echo "<p>" . nl2br(htmlspecialchars(trim($text))) . "</p>";
  16. if ($links && $links->count()) {
  17. echo "<p>";
  18. foreach ($links as $index => $link) {
  19. echo "<a href=\"" . convert_bandcamp_link($link->getAttribute("href")) . "\">" . htmlspecialchars($link->textContent) . "</a>";
  20. if ($index !== count($links) - 1) echo "<br>";
  21. };
  22. echo "</p>";
  23. };
  24. echo "</div>";
  25. };
  26. ?>