'Keywords to always include in the page\'s "meta=keywords" header value', 'include_categories' => 'Set to 1 to include post categories.' ); var $_frontend; // options var $always_include = ''; var $include_categories = 1; function TagMetaKeywords(&$frontend, $args, $dummy_run=false) { $this->LightPressPlugin($frontend, $args, $dummy_run); } function run($hook, &$data) { if (!$this->active) return ($this->hide()); $f =& $this->_frontend; $tpl =& $f->tpl; // add keywords & categories to page keywords array $pagekeys = explode(',', $this->always_include); foreach($f->getPostTags() as $post_tags) $pagekeys = array_merge($pagekeys, $post_tags); if ($this->include_categories) { $posts =& $f->getPosts(); $categories =& $f->getCategories(); foreach ($posts as $post) { if (isset($post['categories'])) { foreach ($post['categories'] as $post_category) $pagekeys[] = $categories[$post_category]['cat_name']; } } } $pagekeys = array_unique($pagekeys); // setup meta keywords for page header $keywordlist = ''; foreach($pagekeys as $keyword) { if ($keywordlist != '') $keywordlist .= ","; $keywordlist .= $keyword; } $tpl->setVar('PLUGIN_TAGMETAKEYWORDS', htmlspecialchars($keywordlist)); } function hide() { $this->_frontend->tpl->setVar('PLUGIN_TAGMETAKEYWORDS', ''); } } ?>