/**
 * Smarty {headmeta meta=""} function plugin
 *
 * Type:     function
 * Name:     
 * Date:     
 * Purpose:  
 * Examples: {headmeta}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_headmeta($params, $template)
{
    $meta = $params['meta'];
    if (!isset($meta)) {
        trigger_error("meta: missing 'meta' parameter");
        return;
    }
    $head = '';
    $ini = new helpers_headMeta();
    switch ($meta) {
        case 'contentType':
            $content = !isset($params['content']) ? trigger_error("content: missing 'content' parameter") : $params['content'];
            $charset = !empty($params['charset']) ? $params['charset'] : 'utf8';
            $head = $ini->contentType($content, $charset);
            break;
        case 'contentStyleType':
            $content = !isset($params['content']) ? trigger_error("content: missing 'content' parameter") : $params['content'];
            $head = $ini->contentStyleType($content);
            break;
        case 'contentLanguage':
            $content = !isset($params['content']) ? trigger_error("content: missing 'content' parameter") : $params['content'];
            $head = $ini->contentLanguage($content);
            break;
        case 'revisitAfter':
            $int = !empty($params['int']) ? $params['int'] : 3;
            $delay = !empty($params['delay']) ? $params['delay'] : 'days';
            $head = $ini->revisitAfter($int, $delay);
            break;
        case 'keywords':
            $content = !isset($params['content']) ? trigger_error("content: missing 'content' parameter") : $params['content'];
            $head = $ini->keywords($content);
            break;
        case 'robots':
            $content = !isset($params['content']) ? trigger_error("content: missing 'content' parameter") : $params['content'];
            $head = $ini->robots($content);
            break;
        case 'googleSiteVerification':
            $content = !isset($params['content']) ? trigger_error("content: missing 'content' parameter") : $params['content'];
            $head = $ini->googleSiteVerification($content);
            break;
        case 'description':
            $content = !isset($params['content']) ? trigger_error("content: missing 'content' parameter") : $params['content'];
            $head = $ini->description($content);
            break;
    }
    return $head;
}
Beispiel #2
0
 /**
  * instance singleton
  * @access public
  */
 private static function getInstance()
 {
     if (!isset(self::$instance)) {
         if (is_null(self::$instance)) {
             self::$instance = new helpers_headMeta();
         }
     }
     return self::$instance;
 }