diff options
author | Arthur <arthur@hoa.ro> | 2016-03-25 19:20:55 +0100 |
---|---|---|
committer | Arthur <arthur@hoa.ro> | 2016-03-25 19:20:55 +0100 |
commit | f66a1990e5d93a6f302ce594968e5e717b93da72 (patch) | |
tree | 22e5da81979bc7ee596fcd5c9c56d4c01c599aa4 /application/LinkFilter.php | |
parent | b2764886c7b52ed98debb90b2ebf075dec5ae2e8 (diff) | |
parent | 528a6f8a232c060faf024008e4f8a09b4aa8dabc (diff) | |
download | Shaarli-f66a1990e5d93a6f302ce594968e5e717b93da72.tar.gz Shaarli-f66a1990e5d93a6f302ce594968e5e717b93da72.tar.zst Shaarli-f66a1990e5d93a6f302ce594968e5e717b93da72.zip |
Merge pull request #515 from ArthurHoaro/template-feeds
Refactor RSS feeds generation, and do it through templates
Diffstat (limited to 'application/LinkFilter.php')
-rw-r--r-- | application/LinkFilter.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/application/LinkFilter.php b/application/LinkFilter.php index 3fd803cb..5e0d8015 100644 --- a/application/LinkFilter.php +++ b/application/LinkFilter.php | |||
@@ -44,7 +44,7 @@ class LinkFilter | |||
44 | * Filter links according to parameters. | 44 | * Filter links according to parameters. |
45 | * | 45 | * |
46 | * @param string $type Type of filter (eg. tags, permalink, etc.). | 46 | * @param string $type Type of filter (eg. tags, permalink, etc.). |
47 | * @param string $request Filter content. | 47 | * @param mixed $request Filter content. |
48 | * @param bool $casesensitive Optional: Perform case sensitive filter if true. | 48 | * @param bool $casesensitive Optional: Perform case sensitive filter if true. |
49 | * @param bool $privateonly Optional: Only returns private links if true. | 49 | * @param bool $privateonly Optional: Only returns private links if true. |
50 | * | 50 | * |
@@ -110,6 +110,8 @@ class LinkFilter | |||
110 | * @param string $smallHash permalink hash. | 110 | * @param string $smallHash permalink hash. |
111 | * | 111 | * |
112 | * @return array $filtered array containing permalink data. | 112 | * @return array $filtered array containing permalink data. |
113 | * | ||
114 | * @throws LinkNotFoundException if the smallhash doesn't match any link. | ||
113 | */ | 115 | */ |
114 | private function filterSmallHash($smallHash) | 116 | private function filterSmallHash($smallHash) |
115 | { | 117 | { |
@@ -121,6 +123,11 @@ class LinkFilter | |||
121 | return $filtered; | 123 | return $filtered; |
122 | } | 124 | } |
123 | } | 125 | } |
126 | |||
127 | if (empty($filtered)) { | ||
128 | throw new LinkNotFoundException(); | ||
129 | } | ||
130 | |||
124 | return $filtered; | 131 | return $filtered; |
125 | } | 132 | } |
126 | 133 | ||
@@ -318,3 +325,8 @@ class LinkFilter | |||
318 | return array_filter(explode(' ', trim($tagsOut)), 'strlen'); | 325 | return array_filter(explode(' ', trim($tagsOut)), 'strlen'); |
319 | } | 326 | } |
320 | } | 327 | } |
328 | |||
329 | class LinkNotFoundException extends Exception | ||
330 | { | ||
331 | protected $message = 'The link you are trying to reach does not exist or has been deleted.'; | ||
332 | } | ||