Documentation TYPO3 par Ameos

meta.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00038 if (!is_object($this))  die('Not called from cObj!');
00039 
00040 $globalMeta = $conf['global.'];
00041 $local = $conf['local.'];
00042 $regular = array();
00043 $DC = array();
00044 
00045 $localDescription = trim($this->stdWrap($local['description'],$local['description.']));
00046 $localKeywords = trim($this->stdWrap($local['keywords'],$local['keywords.']));
00047 
00048 // Unsetting secondary description and keywords if constant is not substituted!
00049 if (substr($globalMeta['description_2'],0,2)=='{$')             {$globalMeta['description_2'] = '';}
00050 if (substr($globalMeta['keywords_2'],0,2)=='{$')                {$globalMeta['keywords_2'] = '';}
00051 if (!$conf['flags.']['useSecondaryDescKey'])    {
00052         unset($globalMeta['keywords_2']);
00053         unset($globalMeta['description_2']);
00054 }
00055 
00056 // Process them:
00057 if ($globalMeta['description'] || $globalMeta['description_2'] || $localDescription)    {
00058         $val = trim($globalMeta['description']);
00059         if ($globalMeta['description_2'])       {
00060                 $val = ($val?ereg_replace('\.$','',$val).'. ':'').$globalMeta['description_2'];
00061         }
00062         if ($localDescription)  {
00063                 if ($conf['flags.']['alwaysGlobalDescription'] )        {
00064                         $val = ereg_replace('\.$','',$localDescription).'. '.$val;
00065                 } else {
00066                         $val = $localDescription;
00067                 }
00068         }
00069         $val=trim($val);
00070         $regular[] = '<meta name="description" content="'.htmlspecialchars($val).'" />';
00071         $DC[] = '<meta name="DC.Description" content="'.htmlspecialchars($val).'" />';
00072 }
00073 if ($globalMeta['keywords'] || $globalMeta['keywords_2'] || $localKeywords)     {
00074         $val = trim($globalMeta['keywords']);
00075         if ($globalMeta['keywords_2'])  {
00076                 $val = ereg_replace(',$','',$val).','.$globalMeta['keywords_2'];
00077         }
00078         if ($localKeywords)     {
00079                 if ($conf['flags.']['alwaysGlobalKeywords'] )   {
00080                         $val = ereg_replace(',$','',$localKeywords).','.$val;
00081                 } else {
00082                         $val = $localKeywords;
00083                 }
00084         }
00085         $val=trim(ereg_replace(',$','',trim($val)));
00086         $val=implode(',',t3lib_div::trimExplode(',',$val,1));
00087         $regular[] = '<meta name="keywords" content="'.htmlspecialchars($val).'" />';
00088         $DC[] = '<meta name="DC.Subject" content="'.htmlspecialchars($val).'" />';
00089 }
00090 if ($globalMeta['robots'])      {
00091         $regular[] = '<meta name="robots" content="'.htmlspecialchars($globalMeta['robots']).'" />';
00092 }
00093 if ($globalMeta['copyright'])   {
00094         $regular[] = '<meta name="copyright" content="'.htmlspecialchars($globalMeta['copyright']).'" />';
00095         $DC[] = '<meta name="DC.Rights" content="'.htmlspecialchars($globalMeta['copyright']).'" />';
00096 }
00097 if ($globalMeta['language'])    {
00098         $regular[] = '<meta http-equiv="content-language" content="'.htmlspecialchars($globalMeta['language']).'" />';
00099         $DC[] = '<meta name="DC.Language" scheme="NISOZ39.50" content="'.htmlspecialchars($globalMeta['language']).'" />';
00100 }
00101 if ($globalMeta['email'])       {
00102         $regular[] = '<link rev="made" href="mailto:'.htmlspecialchars($globalMeta['email']).'" />';
00103         $regular[] = '<meta http-equiv="reply-to" content="'.htmlspecialchars($globalMeta['email']).'" />';
00104 }
00105 if ($globalMeta['author'])      {
00106         $regular[] = '<meta name="author" content="'.htmlspecialchars($globalMeta['author']).'" />';
00107         $DC[] = '<meta name="DC.Creator" content="'.htmlspecialchars($globalMeta['author']).'" />';
00108 }
00109 if ($globalMeta['distribution'])        {
00110         $regular[] = '<meta name="distribution" content="'.htmlspecialchars($globalMeta['distribution']).'" />';
00111 }
00112 if ($globalMeta['rating'])      {
00113         $regular[] = '<meta name="rating" content="'.htmlspecialchars($globalMeta['rating']).'" />';
00114 }
00115 if ($globalMeta['revisit'])     {
00116         $regular[] = '<meta name="revisit-after" content="'.htmlspecialchars($globalMeta['revisit']).'" />';
00117 }
00118 
00119 $DC[] = '<link rel="schema.dc" href="http://purl.org/metadata/dublin_core_elements" />';
00120 
00121 
00122 if (!$conf['flags.']['DC'])     {$DC=array();}
00123 
00124 $content ='';
00125 $content.= implode($regular,chr(10)).chr(10);
00126 $content.= implode($DC,chr(10)).chr(10);
00127 
00128 ?>


Généré par Le spécialiste TYPO3 avec  doxygen 1.4.6