diff options
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 | } | ||