*** empty log message ***
[Packages/TYPO3.CMS.git] / misc / 3.0.0 / oldscripts / meta.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2003 Kasper Skårhøj (kasper@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the Typo3 project. The Typo3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Creates meta tags.
29 * See static_template 'plugin.meta'
30 *
31 * @author Kasper Skårhøj <kasper@typo3.com>
32 */
33
34
35 if (!is_object($this)) die("Not called from cObj!");
36
37 $globalMeta = $conf["global."];
38 $local = $conf["local."];
39 $regular = array();
40 $DC = array();
41
42 $localDescription = trim($this->stdWrap($local["description"],$local["description."]));
43 $localKeywords = trim($this->stdWrap($local["keywords"],$local["keywords."]));
44
45 // Unsetting secondary description and keywords if constant is not substituted!
46 if (substr($globalMeta["description_2"],0,2)=='{$') {$globalMeta["description_2"] = "";}
47 if (substr($globalMeta["keywords_2"],0,2)=='{$') {$globalMeta["keywords_2"] = "";}
48 if (!$conf["flags."]["useSecondaryDescKey"]) {
49 unset($globalMeta["keywords_2"]);
50 unset($globalMeta["description_2"]);
51 }
52
53 // Process them:
54 if ($globalMeta["description"] || $globalMeta["description_2"] || $localDescription) {
55 $val = trim($globalMeta["description"]);
56 if ($globalMeta["description_2"]) {
57 $val = ($val?ereg_replace("\.$","",$val).". ":"").$globalMeta["description_2"];
58 }
59 if ($localDescription) {
60 if ($conf["flags."]["alwaysGlobalDescription"] ) {
61 $val = ereg_replace("\.$","",$localDescription).". ".$val;
62 } else {
63 $val = $localDescription;
64 }
65 }
66 $val=trim($val);
67 $regular[] = '<META NAME="Description" CONTENT="'.htmlspecialchars($val).'">';
68 $DC[] = '<META NAME="DC.Description" CONTENT="'.htmlspecialchars($val).'">';
69 }
70 if ($globalMeta["keywords"] || $globalMeta["keywords_2"] || $localKeywords) {
71 $val = trim($globalMeta["keywords"]);
72 if ($globalMeta["keywords_2"]) {
73 $val = ereg_replace(",$","",$val).",".$globalMeta["keywords_2"];
74 }
75 if ($localKeywords) {
76 if ($conf["flags."]["alwaysGlobalKeywords"] ) {
77 $val = ereg_replace(",$","",$localKeywords).",".$val;
78 } else {
79 $val = $localKeywords;
80 }
81 }
82 $val=trim(ereg_replace(",$","",trim($val)));
83 $val=implode(",",t3lib_div::trimExplode(",",$val,1));
84 $regular[] = '<META NAME="Keywords" CONTENT="'.htmlspecialchars($val).'">';
85 $DC[] = '<META NAME="DC.Subject" CONTENT="'.htmlspecialchars($val).'">';
86 }
87 if ($globalMeta["robots"]) {
88 $regular[] = '<META NAME="Robots" CONTENT="'.htmlspecialchars($globalMeta["robots"]).'">';
89 }
90 if ($globalMeta["copyright"]) {
91 $regular[] = '<META NAME="Copyright" CONTENT="'.htmlspecialchars($globalMeta["copyright"]).'">';
92 $DC[] = '<META NAME="DC.Rights" CONTENT="'.htmlspecialchars($globalMeta["copyright"]).'">';
93 }
94 if ($globalMeta["language"]) {
95 $regular[] = '<META HTTP-EQUIV="Content-language" CONTENT="'.htmlspecialchars($globalMeta["language"]).'">';
96 $DC[] = '<META NAME="DC.Language" scheme="NISOZ39.50" CONTENT="'.htmlspecialchars($globalMeta["language"]).'">';
97 }
98 if ($globalMeta["email"]) {
99 $regular[] = '<LINK REV=made href="mailto:'.htmlspecialchars($globalMeta["email"]).'">';
100 $regular[] = '<META HTTP-EQUIV="Reply-to" CONTENT="'.htmlspecialchars($globalMeta["email"]).'">';
101 }
102 if ($globalMeta["author"]) {
103 $regular[] = '<META NAME="Author" CONTENT="'.htmlspecialchars($globalMeta["author"]).'">';
104 $DC[] = '<META NAME="DC.Creator" CONTENT="'.htmlspecialchars($globalMeta["author"]).'">';
105 }
106 if ($globalMeta["distribution"]) {
107 $regular[] = '<META NAME="Distribution" CONTENT="'.htmlspecialchars($globalMeta["distribution"]).'">';
108 }
109 if ($globalMeta["rating"]) {
110 $regular[] = '<META NAME="Rating" CONTENT="'.htmlspecialchars($globalMeta["rating"]).'">';
111 }
112 if ($globalMeta["revisit"]) {
113 $regular[] = '<META NAME="Revisit-after" CONTENT="'.htmlspecialchars($globalMeta["revisit"]).'">';
114 }
115
116 $DC[] = '<LINK REL="schema.dc" HREF="http://purl.org/metadata/dublin_core_elements">';
117
118
119 if (!$conf["flags."]["DC"]) {$DC=array();}
120
121 $content ="";
122 $content.= implode($regular,chr(10)).chr(10);
123 $content.= implode($DC,chr(10)).chr(10);
124
125 ?>