aboutsummaryrefslogtreecommitdiff
path: root/ratatoeskr/frontend.php
diff options
context:
space:
mode:
Diffstat (limited to 'ratatoeskr/frontend.php')
-rw-r--r--ratatoeskr/frontend.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/ratatoeskr/frontend.php b/ratatoeskr/frontend.php
index 7198c09..883f842 100644
--- a/ratatoeskr/frontend.php
+++ b/ratatoeskr/frontend.php
@@ -55,12 +55,19 @@ function section_transform_ste($section, $lang)
*/
function tag_transform_ste($tag, $lang)
{
- return array(
- "id" => $tag->get_id(),
- "name" => $tag->name,
- "title" => $tag->title[$lang]->text,
- "__obj" => $tag
- );
+ try
+ {
+ return array(
+ "id" => $tag->get_id(),
+ "name" => $tag->name,
+ "title" => $tag->title[$lang]->text,
+ "__obj" => $tag
+ );
+ }
+ catch(DoesNotExistError $e)
+ {
+ return False;
+ }
}
/*
@@ -107,7 +114,7 @@ function article_transform_ste($article, $lang)
"status" => $article->status,
"section" => section_transform_ste($a_section, $lang),
"timestamp" => $article->timestamp,
- "tags" => array_map(function($tag) use ($lang) { return tag_transform_ste($tag, $lang); }, $article->get_tags()),
+ "tags" => array_filter(array_map(function($tag) use ($lang) { return tag_transform_ste($tag, $lang); }, $article->get_tags())),
"languages" => $languages,
"comments_allowed" => $article->allow_comments,
"__obj" => $article