Esempio n. 1
0
 /**
  * instance singleton
  * @access public
  */
 private static function getInstance()
 {
     if (!isset(self::$instance)) {
         if (is_null(self::$instance)) {
             self::$instance = new helpers_headLink();
         }
     }
     return self::$instance;
 }
Esempio n. 2
0
/**
 * Smarty {headlink rel="" href="" optionnal(media="")} function plugin
 *
 * Type:     function
 * Name:     
 * Date:     
 * Purpose:  
 * Examples: {headlink}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_headlink($params, $template)
{
    $rel = $params['rel'];
    if (!isset($rel)) {
        trigger_error("rel: missing 'rel' parameter in link");
        return;
    }
    $href = $params['href'];
    if (!isset($href)) {
        trigger_error("href: missing 'href' parameter in link");
        return;
    }
    $concat = $params['concat'];
    if ($concat == '1') {
        $system = new component_core_system();
        if (defined('PATHADMIN')) {
            $url = $system->getUrlConcat(array('href' => $href, 'caches' => 'caching/caches', 'filesgroups' => 'min/groupsConfig.php', 'minDir' => '/' . PATHADMIN . '/min/', 'callback' => '/admin'));
        } else {
            $url = $system->getUrlConcat(array('href' => $href, 'caches' => 'var/caches', 'filesgroups' => 'min/groupsConfig.php', 'minDir' => '/min/', 'callback' => ''));
        }
    } elseif ($concat == '0') {
        $url = $href;
    } else {
        $url = $href;
    }
    $ini = new helpers_headLink();
    switch ($rel) {
        case 'stylesheet':
            $head = $ini->linkStyleSheet($url, $params['media']);
            break;
        case 'rss':
            $head = $ini->linkRss($href);
            break;
    }
    return $head;
}