'Text/html used to separate displayed keywords', 'tag_none' => 'Text/html to display if there are no keywords for the post', ); var $_frontend; // options var $tag_separator = ', '; var $tag_none = 'none'; var $_block_set = false; // set when keywords block is initialized var $_cachedtags = null; var $_isfeed = false; function PostTags(&$frontend, $args, $dummy_run=false) { $this->LightPressPlugin($frontend, $args, $dummy_run); } function run($hook, &$post) { if (!$this->active) return ($this->hide()); $f =& $this->_frontend; switch ($hook) { case 'get_posts_loop': // force tag cache load and assign tags to post $post['tags'] = $f->getPostTags($post['post_id']); break; case 'parse_post': // process tags block for each post $tpl =& $f->tpl; $this->_isfeed = isset($GLOBALS['feed_type']); // initialize post template block if (!$this->_block_set) { $tpl->setFile('plugin_posttags', (($this->_isfeed) ? 'plugins/post_tags_feed.xml' : 'plugins/post_tags.xml')); $tpl->setBlock('plugin_posttags', 'post_tag', 'BLOCK_POST_TAGS'); $this->_block_set = true; } // process meta data $appendblock = false; if (isset($post['tags'])) { foreach($post['tags'] as $tag) { $tpl->setVar(array( 'post_tag_name' => $tag, 'post_tag_encoded' => $f->getTagEncoded($tag), 'post_tag_permalink' => $f->getTagPermalink($tag), 'post_tag_separator' => $appendblock ? $this->tag_separator : '')); $tpl->parse('BLOCK_POST_TAGS', 'post_tag', $appendblock); $appendblock = true; } } if ($appendblock) $tpl->parse('PLUGIN_POSTTAGS', 'plugin_posttags'); else $tpl->setVar('PLUGIN_POSTTAGS', $this->tag_none); break; } } function hide() { $tpl =& $this->_frontend->tpl; // hide template tags $tpl->setVar('PLUGIN_POSTTAGS', ''); } } ?>