[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/plugins/ -> function.metadata.php (source)

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004 by Ted Kulp (wishy@users.sf.net)
   4  #This project's homepage is: http://cmsmadesimple.sf.net
   5  #
   6  #This program is free software; you can redistribute it and/or modify
   7  #it under the terms of the GNU General Public License as published by
   8  #the Free Software Foundation; either version 2 of the License, or
   9  #(at your option) any later version.
  10  #
  11  #This program is distributed in the hope that it will be useful,
  12  #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  #GNU General Public License for more details.
  15  #You should have received a copy of the GNU General Public License
  16  #along with this program; if not, write to the Free Software
  17  #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  
  19  function smarty_cms_function_metadata($params, &$smarty)
  20  {
  21      global $gCms;
  22      $config =& $gCms->GetConfig();
  23      $pageinfo =& $gCms->variables['pageinfo'];
  24  
  25      $result = '';    
  26  
  27      $showbase = true;
  28      
  29      #Show a base tag unless showbase is false in config.php
  30      #It really can't hinder, only help.
  31      if (isset($params['showbase']))
  32      {
  33          if ($params['showbase'] == 'false')
  34          {
  35              $showbase = false;
  36          }
  37      }
  38  
  39      if ($showbase)
  40      {
  41          $result .= "\n<base href=\"".$config['root_url']."/\" />\n";
  42      }
  43  
  44      $result .= get_site_preference('metadata', '');
  45  
  46      if (isset($pageinfo) && $pageinfo !== FALSE)
  47      {
  48          if (isset($pageinfo->content_metadata) && $pageinfo->content_metadata != '')
  49          {
  50              $result .= "\n" . $pageinfo->content_metadata;
  51          }
  52      }
  53  
  54      if ((!strpos($result,$smarty->left_delimiter) === false) and (!strpos($result,$smarty->right_delimiter) === false))
  55      {
  56          $smarty->_compile_source('metadata template', $result, $_compiled);
  57          @ob_start();
  58          $smarty->_eval('?>' . $_compiled);
  59          $result = @ob_get_contents();
  60          @ob_end_clean();
  61      }
  62  
  63      return $result;
  64  }
  65  
  66  function smarty_cms_help_function_metadata() {
  67      ?>
  68      <h3>What does this do?</h3>
  69      <p>Displays the metadata for this page. Both global metdata from the global settings page and metadata for each page will be shown.</p>
  70      <h3>How do I use it?</h3>
  71      <p>Just insert the tag into your template like: <code>{metadata}</code></p>
  72      <h3>What parameters does it take?</h3>
  73      <ul>
  74          <li><em>(optional)</em>showbase (true/false) - If set to false, the base tag will not be sent to the browser.  Defaults to true if use_hierarchy is set to true in config.php.</li>
  75      </ul>
  76      <?php
  77  }
  78  
  79  function smarty_cms_about_function_metadata() {
  80      ?>
  81      <p>Author: Ted Kulp&lt;ted@cmsmadesimple.org&gt;</p>
  82      <p>Version: 1.0</p>
  83      <p>
  84      Change History:<br/>
  85      None
  86      </p>
  87      <?php
  88  }
  89  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7