/**
 * Smarty {script src="" type="javascript"} function plugin
 *
 * Type:     function
 * Name:     
 * Date:     
 * Purpose:  
 * Examples: {script}
 * Output:   
 * @link 
 * @author   Gerits Aurelien
 * @version  1.0
 * @param array
 * @param Smarty
 * @return string
 */
function smarty_function_script($params, $template)
{
    $src = $params['src'];
    $type = $params['type'];
    $load = $params['load'] ? $params['load'] : 'normal';
    if (!isset($src)) {
        trigger_error("src: missing 'src' parameter in link", E_USER_WARNING);
        return;
    }
    if (!isset($type)) {
        trigger_error("type: missing 'type' parameter in type", E_USER_WARNING);
        return;
    }
    $ini = new magixcjquery_view_helper_script();
    $concat = $params['concat'];
    if ($concat == '1') {
        $system = new magixglobal_model_system();
        if (defined('PATHADMIN')) {
            $url = $system->getUrlConcat(array('src' => $src, 'caches' => 'caching/caches', 'filesgroups' => 'min/groupsConfig.php', 'minDir' => '/' . PATHADMIN . '/min/', 'callback' => '/admin'));
        } else {
            $url = $system->getUrlConcat(array('src' => $src, 'caches' => 'var/caches', 'filesgroups' => 'min/groupsConfig.php', 'minDir' => '/min/', 'callback' => ''));
        }
    } elseif ($concat == '0') {
        $url = $src;
    } else {
        $url = $src;
    }
    $head = $ini->src($url, $type, $load);
    return $head;
}
/**
 * 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 magixglobal_model_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 magixcjquery_view_helper_headLink();
    switch ($rel) {
        case 'stylesheet':
            $head = $ini->linkStyleSheet($url, $params['media']);
            break;
        case 'rss':
            $head = $ini->linkRss($href);
            break;
    }
    return $head;
}