Example #1
0
/**
 * 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'];
    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 helpers_headScript();
    $concat = $params['concat'];
    if ($concat == '1') {
        $system = new component_core_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);
    return $head;
}
Example #2
0
 /**
  * instance singleton
  * @access public
  */
 private static function getInstance()
 {
     if (!isset(self::$instance)) {
         if (is_null(self::$instance)) {
             self::$instance = new helpers_headScript();
         }
     }
     return self::$instance;
 }