__construct() public method

Initialize new Smarty object
public __construct ( )
 /**
  * Construct
  */
 public function __construct()
 {
     parent::__construct();
     $this->JSRMS = new JSRMS();
     $this->JSRMS->requireResource('system');
     $this->muteExpectedErrors();
     $this->setCacheDir(SYSTEM_ROOT . '/classes/smarty/cache/');
     $this->setCompileDir(SYSTEM_ROOT . '/classes/smarty/templates_c/');
     $this->setTemplateDir(SYSTEM_ROOT . '/view/');
     $this->registerObject('Router', Router::getInstance(), array('build'), false);
     $this->registerObject('L10N', System::getLanguage(), array('_'), false);
     $this->assign('LoggedIn', System::getUser() != NULL);
     $this->assign('User', System::getUser());
     $this->assign('Navigation', Navigation::$elements);
     $this->assign('LangStrings', System::getLanguage()->getAllStrings());
     // Configuration
     $this->assign('HTTP_BASEDIR', System::getBaseURL());
     $this->assign('MOD_REWRITE', MOD_REWRITE);
     $this->assign('MAX_UPLOAD_SIZE', Utils::maxUploadSize());
     if (System::getSession()->getData('successMsg', '') != '') {
         $this->assign('successMsg', System::getSession()->getData('successMsg', ''));
         System::getSession()->setData('successMsg', '');
     }
     if (System::getSession()->getData('errorMsg', '') != '') {
         $this->assign('errorMsg', System::getSession()->getData('errorMsg', ''));
         System::getSession()->setData('errorMsg', '');
     }
     if (System::getSession()->getData('infoMsg', '') != '') {
         $this->assign('infoMsg', System::getSession()->getData('infoMsg', ''));
         System::getSession()->setData('infoMsg', '');
     }
 }
 function Smarty_Serweb()
 {
     global $config, $_SERWEB;
     // Smarty does not support "magic_quotes_runtime" enabled
     // So make sure to disable it.
     ini_set("magic_quotes_runtime", 0);
     // Class Constructor. These automatically get set with each new instance.
     parent::__construct();
     //set smarty directories
     $this->template_dir = array($_SERWEB["templatesdir"]);
     if ($_SERWEB["templatesdir"] != $_SERWEB["coretemplatesdir"]) {
         $this->template_dir[] = $_SERWEB["coretemplatesdir"];
     }
     $this->config_dir = $_SERWEB["templatesdir"] . 'configs/';
     $this->cache_dir = $_SERWEB["templatesdir"] . 'cache/';
     $this->plugins_dir = array();
     if (!empty($_SERWEB["smartypluginsdir"])) {
         $this->plugins_dir[] = $_SERWEB["smartypluginsdir"];
     }
     $this->plugins_dir[] = $_SERWEB["corefunctionsdir"] . "smarty_plugins/";
     $this->plugins_dir[] = $_SERWEB["smartydir"] . "plugins/";
     if (!empty($config->smarty_compile_dir)) {
         RecursiveMkdir($config->smarty_compile_dir);
         $this->compile_dir = $config->smarty_compile_dir;
     } else {
         $this->compile_dir = $_SERWEB["templatesdir"] . 'templates_c/';
     }
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     if (!file_exists(SUGAR_SMARTY_DIR)) {
         mkdir_recursive(SUGAR_SMARTY_DIR, true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'templates_c')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'templates_c', true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'configs')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'configs', true);
     }
     if (!file_exists(SUGAR_SMARTY_DIR . 'cache')) {
         mkdir_recursive(SUGAR_SMARTY_DIR . 'cache', true);
     }
     $this->template_dir = '.';
     $this->compile_dir = SUGAR_SMARTY_DIR . 'templates_c';
     $this->config_dir = SUGAR_SMARTY_DIR . 'configs';
     $this->cache_dir = SUGAR_SMARTY_DIR . 'cache';
     $this->request_use_auto_globals = true;
     // to disable Smarty from using long arrays
     if (file_exists('custom/include/Smarty/plugins')) {
         $plugins_dir[] = 'custom/include/Smarty/plugins';
     }
     $plugins_dir[] = 'include/Smarty/plugins';
     $this->plugins_dir = $plugins_dir;
     $this->assign("VERSION_MARK", getVersionedPath(''));
 }
Example #4
0
 /**
  * [__construct 构造方法自动运行]
  */
 public function __construct()
 {
     parent::__construct();
     $this->setTemplateDir($this->template_dir);
     $this->setCompileDir($this->compile_dir);
     // $this->caching = Smarty::CACHING_LIFETIME_CURRENT;
 }
Example #5
0
 public function __construct()
 {
     parent::__construct();
     $this->addTemplateDir(CFG_dir . 'p/tpl/');
     $this->compile_dir = CFG_dir . 'tmp/tpl_c';
     $this->plugins_dir = CFG_dir . 'p/libs/plugins/';
 }
 public function __construct()
 {
     // Class Constructor. These automatically get set with each new instance.
     parent::__construct();
     // call the objects initialization parameters
     self::setParams();
 }
Example #7
0
 public function __construct($smConf = array(), $filter = true)
 {
     parent::__construct();
     if (count($smConf) == 0) {
         $smConf = Piwik_Config::getInstance()->smarty;
     }
     foreach ($smConf as $key => $value) {
         $this->{$key} = $value;
     }
     $this->template_dir = $smConf['template_dir'];
     array_walk($this->template_dir, array("Piwik_Smarty", "addPiwikPath"), PIWIK_INCLUDE_PATH);
     $this->plugins_dir = $smConf['plugins_dir'];
     array_walk($this->plugins_dir, array("Piwik_Smarty", "addPiwikPath"), PIWIK_INCLUDE_PATH);
     $this->compile_dir = $smConf['compile_dir'];
     Piwik_Smarty::addPiwikPath($this->compile_dir, null, PIWIK_USER_PATH);
     $this->cache_dir = $smConf['cache_dir'];
     Piwik_Smarty::addPiwikPath($this->cache_dir, null, PIWIK_USER_PATH);
     $error_reporting = $smConf['error_reporting'];
     if ($error_reporting != (string) (int) $error_reporting) {
         $error_reporting = self::bitwise_eval($error_reporting);
     }
     $this->error_reporting = $error_reporting;
     if ($filter) {
         $this->load_filter('output', 'cachebuster');
         $use_ajax_cdn = Piwik_Config::getInstance()->General['use_ajax_cdn'];
         if ($use_ajax_cdn) {
             $this->load_filter('output', 'ajaxcdn');
         }
         $this->load_filter('output', 'trimwhitespace');
     }
 }
 function __construct($root = ".")
 {
     parent::__construct();
     if (!empty($root)) {
         $this->Init($root);
     }
 }
 public function __construct(Request $peticion, Acl $_acl)
 {
     parent::__construct();
     $this->_controlador = $peticion->getControlador();
     $this->_js = array();
     $this->_acl = $_acl;
 }
Example #10
0
 /**
  * Constructor. Inherits all methods from Smarty.
  */
 public function __construct()
 {
     parent::__construct();
     // Paths definition:
     $templates_path = ROOT_PATH . '/instances/' . Bootstrap::$instance . '/templates/';
     $this->setTemplateDir(ROOT_PATH . '/');
     // The templates are taken using the templates.config.php mappings, under the variable $_tpls.
     $this->setCompileDir($templates_path . '_smarty/compile/');
     $this->setConfigDir($templates_path . '_smarty/configs/');
     $this->setCacheDir($templates_path . '_smarty/cache/');
     // Get the instances inheritance.
     $instance_inheritance = \Sifo\Domains::getInstance()->getInstanceInheritance();
     // If there is inheritance.
     if (is_array($instance_inheritance)) {
         // First the child instance, last the parent instance.
         $instance_inheritance = array_reverse($instance_inheritance);
         foreach ($instance_inheritance as $current_instance) {
             $this->addPluginsDir(ROOT_PATH . '/instances/' . $current_instance . '/templates/' . '_smarty/plugins');
         }
     } else {
         $this->addPluginsDir($templates_path . '_smarty/plugins');
     }
     // Last path is the default smarty plugins directory.
     $this->addPluginsDir(ROOT_PATH . '/libs/Smarty-sifo-plugins');
     // Set this to false to avoid magical parsing of literal blocks without the {literal} tags.
     $this->auto_literal = false;
 }
Example #11
0
    public function __construct()
    {
        parent::__construct();

        // Store the Codeigniter super global instance... whatever
        $this->CI = get_instance();

//        $this->CI->load->config('smarty');
//
//        $this->template_dir      = $this->CI->config->item('template_directory');
//        $this->compile_dir       = $this->CI->config->item('compile_directory');
//        $this->cache_dir         = $this->CI->config->item('cache_directory');
//        $this->config_dir        = $this->CI->config->item('config_directory');
//        $this->template_ext      = $this->CI->config->item('template_ext');

        $this->template_dir      = $this->CI->config->item('template_dir');
        $this->compile_dir       = $this->CI->config->item('compile_dir');
        $this->cache_dir         = $this->CI->config->item('cache_dir');
        $this->config_dir        = $this->CI->config->item('config_dir');
        $this->template_ext      = $this->CI->config->item('template_ext');
        $this->exception_handler = null;

        // Add all helpers to plugins_dir
        $helpers = glob(APPPATH . 'helpers/', GLOB_ONLYDIR | GLOB_MARK);

        foreach ($helpers as $helper)
        {
            $this->plugins_dir[] = $helper;
        }
        
        // Should let us access Codeigniter stuff in views
        $this->assign("this", $this->CI);

    }
Example #12
0
 public function __construct()
 {
     parent::__construct();
     $ds = '/';
     $module = MODULE_NAME;
     $leftDelimiter = \Pandaphp::shell('Config::get', 'template_smarty_left_delimiter');
     $this->left_delimiter = $leftDelimiter;
     $rightDelimiter = \Pandaphp::shell('Config::get', 'template_smarty_right_delimiter');
     $this->right_delimiter = $rightDelimiter;
     // 设置模板文件目录
     $viewDirname = \Pandaphp::shell('Config::get', 'dirname_view');
     $theme = \Pandaphp::shell('Config::get', 'template_theme');
     $theme = $theme ? $theme . $ds : '';
     $templateDir = \Pandaphp::get('appPath') . $module . $ds . $viewDirname . $ds . $theme;
     $this->setTemplateDir($templateDir);
     // 设置编译后的模板文件目录]
     $runtimeDir = \Pandaphp::get('runtimePath');
     $compileDir = $runtimeDir . $module . $ds . 'template_complie' . $ds;
     $this->setCompileDir($compileDir);
     // 设置缓存的模板文件目录
     $cacheDir = $runtimeDir . $module . $ds . 'template_cache' . $ds;
     $this->setCacheDir($cacheDir);
     $isTemplateCache = \Pandaphp::shell('Config::get', 'template_cache_on');
     $this->setCaching($isTemplateCache);
     $templateCacheLifetime = \Pandaphp::shell('Config::get', 'template_cache_lifetime');
     $this->setCacheLifetime($templateCacheLifetime);
 }
 public function __construct()
 {
     parent::__construct();
     // It is not recommended to put these directories under the web server document root
     $this->setTemplateDir(DOCUMENT_ROOT . '/view/templates/');
     $this->setCompileDir(DOCUMENT_ROOT . '/view/templates_c/');
     $this->setCacheDir(DOCUMENT_ROOT . '/view/cache/');
     $this->setConfigDir(DOCUMENT_ROOT . '/view/configs/');
     $this->configLoad('paths.conf');
     $this->compile_check = false;
     // put to false for maximal performance when it is into production
     $this->force_compile = false;
     // should never be used in a production environment
     $this->debugging = false;
     //$this->debugging_ctrl = ($_SERVER['SERVER_NAME'] == 'localhost')
     $this->caching = 0;
     $this->cache_lifetime = 0;
     // Delimiters in HTML codes
     $this->left_delimiter = '{';
     $this->right_delimiter = '}';
     // Delimiters in JavaScript codes
     //$this->left_delimiter = '<!--{';
     //$this->right_delimiter = '}-->';
     $this->assign('app_name', 'HEHLan');
 }
Example #14
0
 /**
  * needs a proper description
  * @param string $tikidomain
  */
 function Smarty_Tiki($tikidomain = '')
 {
     parent::__construct();
     global $prefs, $style_base;
     $this->initializePaths();
     $this->setConfigDir(null);
     if (!isset($prefs['smarty_compilation'])) {
         $prefs['smarty_compilation'] = '';
     }
     $this->compile_check = $prefs['smarty_compilation'] != 'never';
     $this->force_compile = $prefs['smarty_compilation'] == 'always';
     $this->assign('app_name', 'Tiki');
     $this->setPluginsDir(array(TIKI_SMARTY_DIR, SMARTY_DIR . 'plugins'));
     if (!isset($prefs['smarty_security']) || $prefs['smarty_security'] == 'y') {
         $this->enableSecurity('Tiki_Security_Policy');
     } else {
         $this->disableSecurity();
     }
     $this->use_sub_dirs = false;
     $this->url_overriding_prefix_stack = array();
     if (!empty($prefs['smarty_notice_reporting']) and $prefs['smarty_notice_reporting'] === 'y') {
         $this->error_reporting = E_ALL;
     } else {
         $this->error_reporting = E_ALL ^ E_NOTICE;
     }
     $this->setCompileDir(realpath("templates_c"));
 }
Example #15
0
 /**
  * Constructor
  * @param 	string	$template [optional] : name of the template to load (without the .tpl)
  * @param 	array	$info [optional default Array()] : array containing page's meta informations, title, cache, cache_version, etc...
  * 					cach_lifetime : false or 0 to disactivate caching, null for default, or int to set cache lifetime
  * 					Set cache_version if you want to separate cache into versions
  */
 public function __construct($template = false, $info = array())
 {
     BF::register_error_output_callback(array($this, "show_error"));
     // > Define runtime variables
     parent::__construct();
     $this->compile_check = BF::gc('template_compile_check');
     $this->debugging = BF::gc('template_smarty_debug');
     $this->template_dir = BF::gf('tpl')->path();
     $this->compile_dir = BF::gf('compiled')->path();
     $this->cache_dir = BF::gf('cached')->path();
     $this->addPluginsDir(BF::gf('tags')->path());
     $this->content_type = BF::gc('template_default_content_type');
     $this->error_reporting = BF::gc('error_reporting');
     // > Caching
     // block for non-cachable content
     $this->cache_lifetime = BF::gc('template_cache_lifetime');
     $this->caching = BF::gc('template_cache') ? 1 : 0;
     //$this->cache_version = null;
     // > Register template infos
     $this->data = array();
     $this->assignByRef("_data", $this->data);
     // > Register common template functions and blocks. Others will be found in the tags dir
     $this->loadFilter('pre', 'translate');
     // trim top and bottom
     $this->registerFilter("output", create_function('$x', 'return trim($x);'));
     if ($template !== false) {
         $this->load($template, $info);
     }
 }
Example #16
0
 function CiSmarty()
 {
     parent::__construct();
     $uri = explode('/', $_SERVER['REQUEST_URI']);
     $uri[1] = !isset($uri[1]) ? '' : $uri[1];
     if ($this->is_mobile()) {
         $uri[1] = 'mobile';
     }
     if ($this->is_weixin()) {
         $uri[1] = 'weixin';
     }
     switch ($uri[1]) {
         case 'admin':
             $this->template_dir = APPPATH . THEME_ADMIN . '/';
             break;
         case 'mobile':
             $this->template_dir = APPPATH . THEME_MOBILE . '/';
         case 'weixin':
             $this->template_dir = APPPATH . THEME_MOBILE . '/';
         case 'pc':
             $this->template_dir = APPPATH . THEME_PC . '/';
             break;
         default:
             $this->template_dir = APPPATH . THEME_MOBILE . '/';
             break;
     }
     $this->compile_dir = APPPATH . 'cache/' . 'templates_c/';
     $this->left_delimiter = '{';
     $this->right_delimiter = '}';
 }
Example #17
0
 function __construct($environment, $theme = '')
 {
     // call parent constructor
     parent::__construct();
     // set environment and translator
     $this->environment = $environment;
     $this->translator = $this->environment->getTranslationObject();
     // set directory paths
     $this->setTemplateDir('htdocs/templates/');
     $this->setCompileDir('htdocs/templates/templates_c/');
     $this->setConfigDir('etc/smarty/');
     $this->setCacheDir('cache/');
     // set caching
     $this->caching = Smarty::CACHING_OFF;
     // theme support
     if (!empty($theme) && !$this->setTheme($theme)) {
         // set to default
         $this->setTheme('default');
     }
     // multilanguage support
     //$this->registerFilter('pre', array($this, 'smarty_filter_i18n'));
     $this->registerFilter('output', array($this, 'smarty_filter_i18n'));
     $this->registerFilter("output", array($this, "smarty_filter_textfunctions"));
     $this->registerPlugin('function', 'i18n', array($this, 'smarty_function_i18n'));
     $this->registerPlugin('function', 'embed', array($this, 'smarty_function_embed'));
 }
Example #18
0
 function __construct()
 {
     $config = GuiModule::sGetConfig();
     $tmpPath = Zoop::getTmpDir();
     //	call the parent contructor
     parent::__construct();
     $this->template_dir = array();
     //	set the default for the base template dir
     //	this should be using the new config stuff, not defines
     if (!defined("gui_template_dir")) {
         define("gui_template_dir", app_dir . "/templates");
     }
     //	set the standard template directory and any others registerd with zoop
     $this->addTemplateDir(gui_template_dir);
     //	set the compile directory
     $this->setCompileDir($tmpPath . "/smarty2");
     //	set the cache_dir directory
     //	what does this even do?  I'm pretty sure that is not set up
     $this->setCacheDir($tmpPath . "/guicache");
     //	set the config directory
     //	what does this even do?  I'm pretty sure that is not set up
     $this->setConfigDir(app_dir . "/guiconfig");
     //	set the plugin directories
     $this->addPluginsDir(dirname(__FILE__) . '/plugins');
     //	one for plugins added into gui
     $this->addPluginsDir(app_dir . "/guiplugins");
     //	one or plugins specific to the app
 }
Example #19
0
 function __construct($configArray)
 {
     //print_r($configArray);
     if ($configArray) {
         foreach ($configArray as $k => $v) {
             if (isset($this->{$k})) {
                 $this->{$k} = $v;
             }
         }
     }
     // Class Constructor.
     // These automatically get set with each new instance.
     parent::__construct();
     $this->compile_id = system::param("siteDomain");
     $this->addTemplateDir(array("main" => $this->tempateDir));
     $this->setCompileDir($this->compileDir);
     $this->setConfigDir($this->configDir);
     $this->setCacheDir($this->cacheDir);
     if (system::param("optimizeHTML")) {
         $this->loadFilter("pre", "trimwhitespace");
     }
     $this->setCaching(Smarty::CACHING_LIFETIME_SAVED);
     $this->setCacheLifetime(60 * 60 * 24);
     if (defined("ROOT_PATH_ADM")) {
         $this->assign("urlBaseAdm", system::param("urlBase") . "adm/");
     }
     $this->assign("urlBase", system::param("urlBase"));
     $this->assign("siteDomain", $this->compile_id);
 }
Example #20
0
    /**
     * @param modX $modx A reference to the modX object
     * @param array $params An array of configuration parameters
     */
    function __construct(modX &$modx, $params= array ()) {
        parent :: __construct();
        $this->modx= & $modx;

        /* set up configuration variables for Smarty. */
        $this->template_dir = $modx->getOption('manager_path') . 'templates/';
        $this->compile_dir  = $modx->getOption(xPDO::OPT_CACHE_PATH) . 'mgr/smarty/';
        $this->config_dir   = $modx->getOption('core_path') . 'model/smarty/configs';
        $this->plugins_dir  = array(
            $this->modx->getOption('core_path') . 'model/smarty/plugins',
        );
        $this->caching = false;

        foreach ($params as $paramKey => $paramValue) {
            $this->$paramKey= $paramValue;
        }

        if (!is_dir($this->compile_dir)) {
            $this->modx->getCacheManager();
            $this->modx->cacheManager->writeTree($this->compile_dir);
        }

		$this->assign('app_name','MODX');

		$this->_blocks = array();
		$this->_derived = null;
	}
Example #21
0
 public function __construct()
 {
     global $_F;
     parent::__construct();
     if ($_F['module']) {
         $this->cache_dir = APP_ROOT . "data/{$_F['module']}/cache";
         $this->compile_dir = APP_ROOT . "data/{$_F['module']}/template/";
         $this->template_dir = APP_ROOT . "modules/{$_F['module']}/tpl/";
         if (!file_exists($this->template_dir)) {
             $this->template_dir = APP_ROOT . "modules/{$_F['module']}/templates/";
             if (!file_exists($this->template_dir)) {
                 $this->template_dir = APP_ROOT . "modules/{$_F['module']}/templates/";
             }
         }
     } else {
         $this->cache_dir = APP_ROOT . "data/cache";
         $this->compile_dir = APP_ROOT . 'data/template/';
         $this->template_dir = APP_ROOT . 'tpl/';
         if (!file_exists($this->template_dir)) {
             $this->template_dir = APP_ROOT . "templates/";
             if (!file_exists($this->template_dir)) {
                 $this->template_dir = APP_ROOT . "template/";
             }
         }
     }
     if (defined('TPL_ROOT')) {
         $this->template_dir = TPL_ROOT;
     }
     $this->caching = false;
     $this->debugging = false;
     $this->cache_lifetime = 300;
 }
Example #22
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->setConfigDir(sfConfig::get('sf_smarty_config_directories', array(sfConfig::get('sf_app_config_dir') . '/smarty', sfConfig::get('sf_config_dir') . '/smarty')));
     if (($is_debug = sfConfig::get('sf_debug')) && sfConfig::get('sf_smarty_display_debug_console')) {
         $this->debugging = true;
     }
     $this->compile_dir = sfConfig::get('sf_smarty_compile_directory', sfConfig::get('sf_app_cache_dir') . '/smarty/templates_c');
     $this->cache_dir = sfConfig::get('sf_smarty_cache_directory', sfConfig::get('sf_app_cache_dir') . '/smarty/cache');
     $this->allow_php_tag = sfConfig::get('sf_smarty_allow_php_tag', false);
     // OLD STYLE
     $this->php_handling = sfConfig::get('sf_smarty_php_handling', SMARTY_PHP_ALLOW);
     // NEW STYLE
     $this->allow_php_templates = sfConfig::get('sf_smarty_allow_php_templates', true);
     $this->auto_literal = sfConfig::get('sf_smarty_auto_literal', true);
     $this->error_unassigned = sfConfig::get('sf_smarty_error_unassigned', $is_debug);
     $this->use_sub_dirs = sfConfig::get('sf_smarty_use_subdirs', false);
     $this->left_delimiter = sfConfig::get('sf_smarty_left_delimiter', '}');
     $this->right_delimiter = sfConfig::get('sf_smarty_right_delimiter', '{');
     // ENGAGE THE SMARTY CACHE --- OR DON'T, DEPENDING ON SYMFONY VIEW CACHE SETTINGS
     $this->cache_lifetime = sfConfig::get('sf_smarty_cache_lifetime', 3600);
     $this->force_cache = sfConfig::get('sf_smarty_force_cache', false);
     $this->compile_check = sfConfig::get('sf_smarty_compile_check', false);
     if (sfConfig::get('sf_cache')) {
         $this->caching = sfConfig::get('sf_smarty_caching', true);
         $this->force_compile = sfConfig::get('sf_smarty_force_compile', false);
     } else {
         $this->caching = sfConfig::get('sf_smarty_caching', false);
         $this->force_compile = sfConfig::get('sf_smarty_force_compile', true);
     }
 }
Example #23
0
 /**
  * @internal
  *
  * @todo get rid of registerClass
  */
 public function __construct()
 {
     parent::__construct();
     self::$defaultConfig['compile_dir'] = Application::$FILE_ROOT . 'tmp/smarty_compile';
     self::$defaultConfig['cache_dir'] = Application::$FILE_ROOT . 'tmp/smarty_cache';
     $config = Config::get('smarty', self::$defaultConfig);
     $this->setTemplateDir(dirname(dirname(__DIR__)) . '/template/html');
     $this->addTemplateDir(dirname(Application::$WEB_ROOT) . '/template');
     $this->addPluginsDir(__DIR__ . '/smarty_plugins/');
     $this->error_reporting = E_ALL & ~E_NOTICE;
     $this->_file_perms = $config['file_perms'];
     $this->_dir_perms = $config['dir_perms'];
     // cache dir
     FileUtil::makedir($config['cache_dir'], $config['dir_perms']);
     $this->setCacheDir($config['cache_dir']);
     // compile dir
     FileUtil::makedir($config['compile_dir'], $config['dir_perms']);
     $this->setCompileDir($config['compile_dir']);
     // add classes for usage in templates
     $this->registerClass('Session', 'FeM\\sPof\\Session');
     $this->registerClass('Group', 'FeM\\sPof\\model\\Group');
     $this->registerClass('DBConnection', 'FeM\\sPof\\model\\DBConnection');
     $this->registerClass('SessionRegister', 'FeM\\sPof\\model\\SessionRegister');
     $this->registerClass('Config', 'FeM\\sPof\\Config');
     $this->registerClass('Authorization', 'FeM\\sPof\\Authorization');
     $this->registerClass('Auth', 'FeM\\sPof\\Authorization');
 }
Example #24
0
 public function __construct()
 {
     parent::__construct();
     $this->setTemplateDir('templates/');
     $this->setCompileDir('templates/cache/templates_c/');
     $this->setCacheDir('templates/cache/');
 }
Example #25
0
 public function __construct()
 {
     $this->error_reporting = E_ALL;
     parent::__construct();
     $this->error_reporting = E_ALL;
     $this->register_compiler_function('publish', array($this, 'compiler_publishAsset'));
 }
Example #26
0
 public function __construct()
 {
     parent::__construct();
     // Store the Codeigniter super global instance... whatever
     $CI = get_instance();
     // Load the Smarty config file
     $CI->load->config('smarty');
     // Turn on/off debug
     $this->debugging = config_item('smarty_debug');
     // Set some pretty standard Smarty directories
     $this->setCompileDir(config_item('compile_directory'));
     $this->setCacheDir(config_item('cache_directory'));
     $this->setConfigDir(config_item('config_directory'));
     // Default template extension
     $this->template_ext = config_item('template_ext');
     // How long to cache templates for
     $this->cache_lifetime = config_item('cache_lifetime');
     // Disable Smarty security policy
     $this->disableSecurity();
     // If caching is enabled, then disable force compile and enable cache
     if (config_item('cache_status') === TRUE) {
         $this->enable_caching();
     } else {
         $this->disable_caching();
     }
     // Set the error reporting level
     $this->error_reporting = config_item('template_error_reporting');
     // Should let us access Codeigniter stuff in views
     // This means we can go for example {$this->session->userdata('item')}
     // just like we normally would in standard CI views
     $this->assign("this", $CI);
 }
 public function init()
 {
     parent::__construct();
     iaSystem::renderTime('main', 'beforeSmartyFuncInit');
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'captcha', array(__CLASS__, 'captcha'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_wysiwyg', array(__CLASS__, 'ia_wysiwyg'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_add_media', array(__CLASS__, 'ia_add_media'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_print_css', array(__CLASS__, 'ia_print_css'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_print_js', array(__CLASS__, 'ia_print_js'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_print_title', array(__CLASS__, 'ia_print_title'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_page_url', array(__CLASS__, 'ia_page_url'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'lang', array(__CLASS__, 'lang'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'preventCsrf', array(__CLASS__, 'preventCsrf'));
     $this->registerPlugin(self::PLUGIN_FUNCTION, 'printImage', array(__CLASS__, 'printImage'));
     $this->registerPlugin(self::PLUGIN_BLOCK, 'access', array(__CLASS__, 'access'));
     $this->registerPlugin(self::PLUGIN_BLOCK, 'ia_add_js', array(__CLASS__, 'ia_add_js'));
     $iaCore = iaCore::instance();
     if (iaCore::ACCESS_FRONT == $iaCore->getAccessType()) {
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'accountActions', array(__CLASS__, 'accountActions'));
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'accordion', array(__CLASS__, 'accordion'));
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'arrayToLang', array(__CLASS__, 'arrayToLang'));
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_blocks', array(__CLASS__, 'ia_blocks'));
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_block_view', array(__CLASS__, 'ia_block_view'));
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'ia_url', array(__CLASS__, 'ia_url'));
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'navigation', array(__CLASS__, 'pagination'));
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'printFavorites', array(__CLASS__, 'printFavorites'));
         $this->registerPlugin(self::PLUGIN_FUNCTION, 'width', array(__CLASS__, 'width'));
         $this->registerPlugin(self::PLUGIN_BLOCK, 'ia_block', array(__CLASS__, 'ia_block'));
     }
     // uncomment this to get rid of useless whitespaces in html
     // $this->loadFilter('output', 'trimwhitespace');
     $iaCore->startHook('phpSmartyAfterFuncInit', array('iaSmarty' => &$this));
 }
Example #28
0
 function __construct()
 {
     //$this->Smarty();
     parent::__construct();
     $config =& get_config();
     // absolute path prevents "template not found" errors
     /*$this->template_dir = (!empty($config['smarty_template_dir']) ? $config['smarty_template_dir'] 
     																	  : BASEPATH . 'application/views/templates');
     																	
     		$this->compile_dir  = (!empty($config['smarty_compile_dir']) ? $config['compile_dir'] 
     																	 : BASEPATH . 'application/views/cache');      
     		*/
     $this->template_dir = !empty($config['smarty_template_dir']) ? $config['smarty_template_dir'] : APPPATH . 'views/templates';
     $this->compile_dir = !empty($config['smarty_compile_dir']) ? $config['compile_dir'] : APPPATH . 'views/cache';
     if (function_exists('site_url')) {
         // URL helper required
         $this->assign("site_url", site_url());
         // so we can get the full path to CI easily
     }
     /* SMARTY 3.X miatt kilőve 2014.05.06
     		// register Smarty resource named "ci"
     		$this->register_resource("ci", array($this,
     						"ci_get_template", "ci_get_timestamp", "ci_get_secure", "ci_get_trusted")
     		);
     		*/
 }
Example #29
0
 /**
  * Get a new instance of Template (smarty)
  * 
  * @param string $template      [optional] Path to a template file. Default is null
  * @param string $module        [optional] Name of a module to add as template dir
  * 
  * @return Template             Return instance of Template
  */
 public function __construct($template = null, $module = null)
 {
     parent::__construct();
     $this->cache_dir = WEBAPP_DIR . DS . 'cache' . DS . 'html' . DS;
     $this->compile_dir = WEBAPP_DIR . DS . 'cache' . DS . 'templates_c' . DS;
     // Get plugins directories
     $this->addPluginsDir($this->_getPluginsDirs());
     if ($module !== null) {
         $this->module = $module;
         $this->template_dir = array();
         $dir = '';
         $subs = explode(DS, preg_replace('#^/#', '', $template));
         if (count($subs) > 1) {
             $template = array_pop($subs);
             $dir = DS . join(DS, $subs);
         }
         if (is_dir(WEBAPP_MODULES_DIR . DS . $module . DS . 'template' . $dir)) {
             $this->addTemplateDir(WEBAPP_MODULES_DIR . DS . $module . DS . 'template' . $dir);
         }
         $this->addTemplateDir(MODULES_DIR . DS . $module . DS . 'template' . $dir);
     }
     if ($template !== null) {
         $this->setTemplate($template);
     }
 }
Example #30
0
 function __construct()
 {
     global $a, $c;
     $this->action = $a;
     $this->controller = $c;
     //$c="user";
     //smarty配置
     parent::__construct();
     //模板的路径
     $this->setTemplateDir(APP_PATH . '/views/' . $c);
     //编译模板位置
     $this->setCompileDir(APP_PATH . '/views/smarty/templates_c/');
     //配置文件路径
     $this->setConfigDir(APP_PATH . '/views/smarty/configs/');
     //缓存路径
     $this->setCacheDir(APP_PATH . '/views/smarty/cache/');
     $this->left_delimiter = "{{";
     $this->right_delimiter = "}}";
     //index.html
     $this->template = $a . ".html";
     //        $this->assign("assets", APP_PATH."/assets");
     $this->assign("assets", "app/assets");
     //检查登录
     $this->check_login();
     $this->model = D();
 }