Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
103 - 1
<?php
2
class MetaTagGenerator extends SeoPluginsController{
3
	var $metaTags = "";
4
 
5
	function index() {
6
		$this->set('sectionHead', 'Meta Tag Generator');
7
		$userId = isLoggedIn();
8
 
9
		$websiteController = New WebsiteController();
10
		$this->set('websiteList', $websiteController->__getAllWebsites($userId, true));
11
		$this->set('websiteNull', true);
12
		$this->set('onChange', pluginPOSTMethod('search_form', 'subcontent', 'action=show'));
13
 
14
		$this->pluginRender('index');
15
	}
16
 
17
	function show($info, $error=false) {
18
		if(empty($info['website_id'])) {
19
			print( "<script>".pluginGETMethod()."</script>");
20
			return;
21
		}
22
 
23
		$langController = New LanguageController();
24
		$this->set('langList', $langController->__getAllLanguages());
25
		$this->set('langNull', true);
26
 
27
		if(empty($error)){
28
			$websiteController = New WebsiteController();
29
			$websiteInfo = $websiteController->__getWebsiteInfo($info['website_id']);
30
			$websiteInfo['website_id'] = $info['website_id'];
31
		}else{
32
			$websiteInfo = $info;
33
		}
34
		$this->set('websiteInfo', $websiteInfo);
35
 
36
		$this->pluginRender('showsiteinfo');
37
	}
38
 
39
	function createmetatag($info) {
40
 
41
		$errMsg['title'] = formatErrorMsg($this->validate->checkBlank($info['title']));
42
		$errMsg['description'] = formatErrorMsg($this->validate->checkBlank($info['description']));
43
		$errMsg['keywords'] = formatErrorMsg($this->validate->checkBlank($info['keywords']));
44
 
45
		# error occurs
46
		if($this->validate->flagErr){
47
			$this->set('errMsg', $errMsg);
48
			$this->show($info, true);
49
			return;
50
		}
51
		print "<p><b>Meta Tags</b><br><br>";
52
		$this->highLight('<head>', false);
53
		$this->highLight('<title>'.$info['title'].'</title>');
54
		$this->highLight('<meta name="description" content="'.$info['description'].'">');
55
		$this->highLight('<meta name="keywords" content="'.$info['keywords'].'">');
56
		if(!empty($info['owner_name'])) $this->highLight('<meta name="author" content="'.$info['owner_name'].'">');
57
		if(!empty($info['copyright'])) $this->highLight('<meta name="copyright" content="'.$info['copyright'].'">');
58
		if(!empty($info['owner_email'])) $this->highLight('<meta name="email" content="'.$info['owner_email'].'">');
59
		if(!empty($info['lang_code'])) $this->highLight('<meta http-equiv="Content-Language" content="'.$info['lang_code'].'">');
60
		if(!empty($info['charset'])) $this->highLight('<meta name="Charset" content="'.$info['charset'].'">');
61
		if(!empty($info['rating'])) $this->highLight('<meta name="Rating" content="'.$info['rating'].'">');
62
		if(!empty($info['distribution'])) $this->highLight('<meta name="Distribution" content="'.$info['distribution'].'">');
63
		if(!empty($info['robots'])) $this->highLight('<meta name="Robots" content="'.$info['robots'].'">');
64
		if(!empty($info['revisit-after'])) $this->highLight('<meta name="Revisit-after" content="'.$info['revisit-after'].'">');
65
		if(!empty($info['expires'])) $this->highLight('<meta name="expires" content="'.$info['expires'].'">');
66
		$this->highLight('</head>', false);
67
		print "<textarea style='width:600px;' rows='15'>$this->metaTags</textarea>";
68
		print "</p>";
69
	}
70
 
71
	function highLight($str, $padd=true){
72
 
73
		if($padd) $this->metaTags .= "&nbsp;&nbsp;";
74
		$this->metaTags .= stripslashes($str);
75
		$this->metaTags .= "\n";
76
	}
77
}