public function prepareFrontendView(&$posts) { if ($posts) { list($tags, $post_tags) = $this->getTagByPost(array_keys($posts)); if ($tags) { $tag_model = new blogTagPluginModel(); $tags_data = $tag_model->getByField('id', $tags, 'id'); $wa = wa(); foreach ($tags_data as &$tag) { $tag['link'] = $wa->getRouteUrl('blog/frontend', array('tag' => urlencode($tag['name'])), true); $tag['name'] = htmlspecialchars($tag['name'], ENT_QUOTES, 'utf-8'); } unset($tag); foreach ($post_tags as $id => $post_item_tags) { $html = ""; $tag_html = array(); foreach ($post_item_tags as $tag_id) { if (isset($tags_data[$tag_id])) { $t = $tags_data[$tag_id]; $tag_html[] = <<<HTML <a href="{$t['link']}">{$t['name']}</a> HTML; } } $html = '<div class="tags">' . _wp('Tags') . ': '; $html .= implode(", ", $tag_html); $html .= "</div>"; $posts[$id]['plugins']['after'][$this->id] = $html; } } } }