<?php if (!defined('PmWiki')) exit();
/*
	Merge MetaTags 0.1
	merges keywords and description metatags for PmWiki pages to
	be more search engine friendly.
	copyright (c) 2006 Yuri Giuntoli (www.giuntoli.com)

	This PHP script is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation.

	This PHP script is not part of the standard PmWiki distribution.

	0.1 - 23.01.2006
		First concept implementation
	
*/


	define(MERGEMETATAGS, '0.1');

	include_once("$FarmD/scripts/stdmarkup.php");
	$HTMLHeaderFmt['meta'] = 'function:MergeMetaTags';

	function MergeMetaTags($pagename, $args) {
		global $PCache;

		foreach((array)@$PCache[$pagename]['=keywords'] as $v) {
			$mtkeywords[] = str_replace("'", '&#039;', $v);
		}
		if ($mtkeywords!='') print "<meta name='keywords' content='".@implode(',',$mtkeywords)."' />\n";

		foreach((array)@$PCache[$pagename]['=description'] as $v) {
			$mtdescription[] = str_replace("'", '&#039;', $v);
		}
		if ($mtdescription!='') print "<meta name='description' content='".@implode(' ',$mtdescription)."' />\n";
	}

?>