<?php
//重制间接模板中间件！
$SEOTools_name=$name;
$SEOTools_title=$title;

if($zbp->Config('SEOTools')->distitle_seo) {

	if($zbp->Config('SEOTools')->title_change){
		if(!($type=='index'&&$page=='1')){
			$name=$SEOTools_title;
			$title=$SEOTools_name;
		}
	}

	include $zbp->usersdir . 'theme/' . $zbp->theme . '/compile/header.php';

	if($zbp->Config('SEOTools')->title_change) {
		if(!($type=='index'&&$page=='1')) {
			$name=$SEOTools_name;
			$title=$SEOTools_title;
		}
	}

	if($type=='index'){
		$keywords = $zbp->Config('SEOTools')->title_keywords;
		$description = $zbp->Config('SEOTools')->title_description;
	}elseif($type=='category'){
		$keywords = $category->Name;
		$description = $category->Intro;
	}elseif($type=='article'||$type=='page'){
		$aryTags = array();
		foreach($article->Tags as $key){
				$aryTags[] = $key->Name;
		}
		if(count($aryTags)>0) {
			$keywords = implode(',',$aryTags);
			$description = preg_replace('/&nbsp;[\r\n\s]+/', '', trim(SubStrUTF8(TransferHTML($article->Content,'[nohtml]'),$zbp->Config('SEOTools')->title_ms)).'...');
		}
	}

	if(isset($keywords)&&strlen($keywords)>0){
		echo '<meta name="keywords" content="'.htmlspecialchars($keywords).'" />' . "\r\n";
	}

	if(isset($description)&&strlen($description)>0){
		echo '<meta name="description" content="'.htmlspecialchars($description).'" />' . "\r\n";
	}
	}else {
		include $zbp->usersdir . 'theme/' . $zbp->theme . '/compile/header.php';
}

?>