コード例 #1
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new SmartyLazyRegister();
     }
     return self::$instance;
 }
コード例 #3
0
ファイル: smarty.config.inc.php プロジェクト: M03G/PrestaShop
function smartyRegisterFunction($smarty, $type, $function, $params, $lazy = true)
{
    if (!in_array($type, array('function', 'modifier', 'block'))) {
        return false;
    }
    // lazy is better if the function is not called on every page
    if ($lazy) {
        $lazy_register = SmartyLazyRegister::getInstance();
        if ($lazy_register->isRegistered($params)) {
            return;
        }
        $lazy_register->register($params);
        if (is_array($params)) {
            $params = $params[1];
        }
        // SmartyLazyRegister allows to only load external class when they are needed
        $smarty->registerPlugin($type, $function, array($lazy_register, $params));
    } else {
        $smarty->registerPlugin($type, $function, $params);
    }
}