]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - application/formatter/BookmarkDefaultFormatter.php
3 namespace Shaarli\Formatter
;
6 * Class BookmarkDefaultFormatter
8 * Default bookmark formatter.
9 * Escape values for HTML display and automatically add link to URL and hashtags.
11 * @package Shaarli\Formatter
13 class BookmarkDefaultFormatter
extends BookmarkFormatter
18 public function formatTitle($bookmark)
20 return escape($bookmark->getTitle());
26 public function formatDescription($bookmark)
28 $indexUrl = ! empty($this->contextData
['index_url']) ? $this->contextData
['index_url'] : '';
29 return format_description(escape($bookmark->getDescription()), $indexUrl);
35 protected function formatTagList($bookmark)
37 return escape(parent
::formatTagList($bookmark));
43 public function formatTagString($bookmark)
45 return implode(' ', $this->formatTagList($bookmark));
51 public function formatUrl($bookmark)
53 if (! empty($this->contextData
['index_url']) && (
54 startsWith($bookmark->getUrl(), '?') || startsWith($bookmark->getUrl(), '/')
56 return $this->contextData
['index_url'] . escape($bookmark->getUrl());
58 return escape($bookmark->getUrl());
64 protected function formatRealUrl($bookmark)
66 if (! empty($this->contextData
['index_url']) && (
67 startsWith($bookmark->getUrl(), '?') || startsWith($bookmark->getUrl(), '/')
69 return $this->contextData
['index_url'] . escape($bookmark->getUrl());
71 return escape($bookmark->getUrl());
77 protected function formatThumbnail($bookmark)
79 return escape($bookmark->getThumbnail());