Exemplo n.º 1
0
 /**
  * @return \SmartyBC
  * @throws \Kohana_Exception
  */
 public static function init()
 {
     $tmp = new \SmartyBC();
     $tmp->muteExpectedErrors();
     //loading config file smarty
     $conf = \Kohana::$config->load('smarty')->get('smarty_config');
     $tmp->addTemplateDir($conf['template_dir']);
     $tmp->setCompileDir($conf['compile_dir']);
     $tmp->setCacheDir($conf['cache_dir']);
     $tmp->setConfigDir($conf['config_dir']);
     $tmp->setPluginsDir($conf['plugins_dir']);
     $tmp->assign('base_UI', $conf['base_UI']);
     $tmp->assign('debugging', $conf['debugging']);
     $tmp->debugging = $conf['debugging'];
     $tmp->debugging_ctrl = $conf['debugging_ctrl'];
     $tmp->error_reporting = $conf['error_reporting'];
     return $tmp;
 }
<?php

require_once $basedir . "/vendor/autoload.php";
$smarty = new SmartyBC();
$smarty->setTemplateDir($basedir . '/templates');
$smarty->setCompileDir($basedir . '/templates_c');
$smarty->setCacheDir($basedir . '/cache');
$smarty->setConfigDir($basedir . '/configs');
$smarty->security = false;
$smarty->setCaching(Smarty::CACHING_LIFETIME_SAVED);
$smarty->assign('baseurl', $baseurl);
Exemplo n.º 3
0
 /**
  *
  *
  * @return Smarty The smarty object used for rendering.
  */
 public function smarty()
 {
     if (is_null($this->_Smarty)) {
         $Smarty = new SmartyBC();
         $Smarty->setCacheDir(PATH_CACHE . '/Smarty/cache');
         $Smarty->setCompileDir(PATH_CACHE . '/Smarty/compile');
         $Smarty->addPluginsDir(PATH_LIBRARY . '/SmartyPlugins');
         //         Gdn::PluginManager()->Trace = TRUE;
         Gdn::pluginManager()->callEventHandlers($Smarty, 'Gdn_Smarty', 'Init');
         $this->_Smarty = $Smarty;
     }
     return $this->_Smarty;
 }
Exemplo n.º 4
0
 public function smart_view($view, $vars = array(), $return = FALSE)
 {
     $orgin_view = $view;
     if (!strpos($view, ".php") && !strpos($view, ".tpl")) {
         $view .= ".tpl";
     }
     PC::preparing_view($view);
     $view_name = $view;
     $smarty = new SmartyBC();
     $config =& get_config();
     $this->caching = 1;
     $smarty->setCompileDir(APPPATH . '/third_party/Smarty-3.1.8/templates_c');
     $smarty->setConfigDir(APPPATH . '/third_party/Smarty-3.1.8/configs');
     $smarty->setCacheDir(APPPATH . '/cache');
     if (strpos($this->_module, '_child') !== false) {
         list($path, $_view) = Modules::find($view, $this->_module, 'views/');
         if ($path == FALSE) {
             list($path, $_view) = Modules::find($view, str_replace("_child", "", $this->_module), 'views/');
         }
     } else {
         list($path, $_view) = Modules::find($view, $this->_module . "_child", 'views/');
         if ($path == FALSE) {
             list($path, $_view) = Modules::find($view, $this->_module, 'views/');
         }
     }
     if ($path == FALSE) {
         list($path, $_view) = Modules::find($orgin_view . ".php", $this->_module, 'views/');
         if ($path != FALSE) {
             $view = $orgin_view . ".php";
             $view_name = $view;
         }
     }
     if ($path == FALSE && strpos($this->_module, '_child') !== false) {
         list($path, $_view) = Modules::find($view, str_replace("_child", "", $this->_module), 'views/');
     }
     if ($path != FALSE) {
         $this->_ci_view_paths = array($path => TRUE) + $this->_ci_view_paths;
         $view = $_view;
     }
     $path_fragment = explode("/", $path);
     if ($path_fragment[0] == "modules") {
         global $active_show;
         $controller =& $active_show->controller;
         $theme_path = "themes/" . $controller->BuilderEngine->get_option('active_frontend_theme') . "/modules/" . $this->_module;
         $theme_file = $theme_path . "/" . $_view . ".php";
         if (file_exists($theme_file)) {
             $path = "../../" . $theme_path;
             $this->_ci_view_paths = array($path => TRUE) + $this->_ci_view_paths;
             $view = $path . "/" . $_view;
         }
         // To be updated
         $view_name = basename($view_name);
     }
     global $active_show;
     global $BuilderEngine;
     $vars['BuilderEngine'] =& $BuilderEngine;
     $vars['versions'] =& $active_show->controller->versions;
     $vars['user'] =& $active_show->controller->user;
     $vars['this'] =& $this;
     $smarty->setTemplateDir($path);
     foreach ($vars as $key => $value) {
         $smarty->assign($key, $value);
     }
     $smarty->assign("test_var", "qweqweqwe");
     if ($return) {
         ob_start();
         $smarty->display($view_name);
         $output = ob_get_contents();
         ob_end_clean();
         return $output;
     } else {
         $smarty->display($view_name);
     }
     /*
     global $active_show;
     global $BuilderEngine;
     $vars['BuilderEngine'] = &$BuilderEngine;
     
     
     
     $vars['versions'] = &$active_show->controller->versions;
     
     $vars['user'] = &$active_show->controller->user;
     
     return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
     */
 }
Exemplo n.º 5
0
include 'Helper/Paypal.php';
include 'Helper/Cart.php';
include 'Helper/Krco.php';
include 'Helper/Xml.php';
include 'Helper/URL.php';
include 'Helper/String.php';
include 'Helper/Structure.php';
include 'Helper/Renderer.php';
include 'Helper/File.php';
include 'Renderer/Cart.php';
$smarty = new SmartyBC();
$smarty->force_compile = true;
$smarty->addPluginsDir('./plugins');
if (isset($var['temp_dir']) && strlen($var['temp_dir']) > 0) {
    $smarty->setCompileDir($var['temp_dir'] . DS . $_SERVER['SERVER_NAME'] . DS);
    $smarty->setCacheDir($var['temp_dir'] . DS . $_SERVER['SERVER_NAME'] . DS);
}
define("MAIN_TEST_DATA_FILE", 'tests/data.json');
/**
 * Handle '/' request
 * @return always true
 */
function HandlePageList()
{
    $pagenames = array_map(function ($page) {
        preg_match('|templates/(?P<pagename>[^\\.]+)\\.tpl|', $page, $matches);
        $pagename = $matches['pagename'];
        return $pagename != 'index' ? $pagename : null;
    }, glob('templates/*.tpl'));
    include 'pagelist.php';
    return true;
Exemplo n.º 6
0
<?php

ini_set("display_errors", 1);
error_reporting(E_ALL);
require "setup.php";
define("PROJECT_DIR", $local_project_dir);
define("SMARTY_DIR", "smarty-3.1.27/libs/");
require SMARTY_DIR . "Smarty.class.php";
$smarty = new SmartyBC();
$smarty->setTemplateDir(PROJECT_DIR . "smarty/templates");
$smarty->setCompileDir(PROJECT_DIR . "smarty/templates_c");
$smarty->setCacheDir(PROJECT_DIR . "smarty/cache");
$smarty->setConfigDir(PROJECT_DIR . "smarty/config");
$smarty->assign('lbr', '{');
$smarty->assign('rbr', '}');