diff options
author | Kevin Chabowski <kevin@kch42.de> | 2012-04-24 21:47:34 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2012-04-24 21:47:34 +0200 |
commit | 315d92afcdb95b360b5a4217f222a8b408a33290 (patch) | |
tree | 63f1cc60618cd5965632a01a9a6617700cdb0c4d /ratatoeskr/frontend.php | |
parent | 958a721cf66eff27629b05d407a028e6f469e2b5 (diff) | |
download | ratatoeskr-cms-315d92afcdb95b360b5a4217f222a8b408a33290.tar.gz ratatoeskr-cms-315d92afcdb95b360b5a4217f222a8b408a33290.tar.bz2 ratatoeskr-cms-315d92afcdb95b360b5a4217f222a8b408a33290.zip |
Uncatched exception, if a tag had no translation for current language.
Now fixed. These tags are now filtered out.
Also, Beta 5
Diffstat (limited to 'ratatoeskr/frontend.php')
-rw-r--r-- | ratatoeskr/frontend.php | 21 |
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 |