Example #1
0
 public function onFinish()
 {
     if ($this->components !== null) {
         $this->components->cleanup();
         $this->components = null;
     }
     if ($this->tpl !== null) {
         $this->tpl->assign('req', null);
         $this->tpl = null;
     }
     //Daemon::log('onFinish -- ' . $_SERVER['REQUEST_URI']);
 }
Example #2
0
<?php

require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
//$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
$fn = 'caching/index.tpl';
if (isset($_REQUEST['clear'])) {
    $tpl->clear_cache($fn, '*');
}
$tpl->caching = 1;
$tpl->cache_lifetime = 60;
// ������
if (!$tpl->is_cached('index.tpl')) {
    $tpl->assign('var', '�����-������ ��������, ��������, �� ��');
}
$tpl->display($fn);
Example #3
0
<?php

require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
//$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
$fn = 'shortcuts/index.tpl';
$tpl->display($fn);
echo '<hr />' . (microtime(TRUE) - MICROTIME_START);
echo '<hr />';
highlight_file($tpl->_get_compile_path($fn, ''));
echo '<hr />';
highlight_file($tpl->template_dir . $fn);
Example #4
0
<?php

// Multilang example
require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
$tpl->lang = gpcvar_str($_REQUEST['lang']);
if ($tpl->lang === '') {
    $tpl->lang = 'en';
}
function lang_getmessage($phrase)
{
    if (Quicky::$obj->lang == 'ru') {
        if ($phrase = 'HI') {
            return 'Привет';
        }
        if ($phrase = 'BYE') {
            return 'Пока';
        }
    } else {
        if ($phrase = 'HI') {
            return 'Hi';
        }
        if ($phrase = 'BYE') {
            return 'Bye';
        }
    }
}
function quicky_lang_callback($m)
Example #5
0
 public function init()
 {
     $this->error_reporting = E_ALL;
     $this->plugins_dir = array(QUICKY_DIR . 'plugins');
     $this->_smarty_vars =& $this->_block_props;
     $this->_block_props['capture'] = array();
     $this->_block_props['foreach'] = array();
     $this->_block_props['section'] = array();
     $this->_block_props['begin'] = array();
     $this->capture =& $this->_block_props['capture'];
     $this->foreach =& $this->_block_props['foreach'];
     $this->section =& $this->_block_props['section'];
     $this->begin =& $this->_block_props['begin'];
     Quicky::$obj = $this;
 }
Example #6
0
<?php

// ������ ���������� �������� ����������
require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
session_start();
if (!isset($_SESSION['lastrock_action']) || isset($_REQUEST['stop'])) {
    $_SESSION['lastrock_action'] = 'intro';
}
$tpl = new Quicky();
//$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
require_once '../Quicky.form.class.php';
$playform = new Quicky_form('play');
$playform->addElement('btn1', new QButton(array('name' => 'numbtn1')));
$playform->addElement('btn2', new QButton(array('name' => 'numbtn2')));
$playform->addElement('btn3', new QButton(array('name' => 'numbtn3')));
$form = new Quicky_form('startgame');
$form->addElement('num', array('name' => 'num'));
$form->addElement('startbtn', new QButton(array('name' => 'submit')));
if ($_SESSION['lastrock_action'] == 'play') {
    if ($playform->btn1->clicked()) {
        $humantake = 1;
    } elseif ($playform->btn2->clicked()) {
        $humantake = 2;
    } elseif ($playform->btn3->clicked()) {
        $humantake = 3;
    } else {
        $humantake = 0;
Example #7
0
<?php

require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
//$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
$tpl->detect_form('test');
$tpl->display($fn = 'form/form_detection.tpl');
$form = $tpl->getFormByName('test');
echo 'Entered value: ' . htmlspecialchars($form->textbox1->getValue());
echo '<hr />' . (microtime(TRUE) - MICROTIME_START);
echo '<hr />';
highlight_file($tpl->_get_compile_path($fn, ''));
echo '<hr />';
highlight_file($tpl->template_dir . $fn);
echo '<hr />';
highlight_file(__FILE__);
Example #8
0
<?php

chdir('..');
require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
//$tpl->compiler_prefs['inline_includes'] = TRUE;
$tpl->force_compile = TRUE;
$tpl->debug_mode = TRUE;
$tpl->plugins_dir[] = QUICKY_DIR . 'customplugins/';
//$tpl->depart_scopes = TRUE;
//$tpl->compile_check = FALSE;
$tpl->assign('testvariable', 'testvalue');
$fn = '|debug.tpl';
$tpl->display($fn);
echo '<br />' . (microtime(TRUE) - MICROTIME_START);
echo '<hr />';
highlight_file($tpl->_get_compile_path($fn, ''));
echo '<hr />';
highlight_file($tpl->template_dir . $fn);
Example #9
0
<?php

require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
//$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
$tpl->assign('myvar', 'myvalue');
$tpl->load_string('myname', '{$myvar|escape}');
$fn = 'string://myname';
$tpl->display($fn);
echo '<hr />' . (microtime(TRUE) - MICROTIME_START);
echo '<hr />';
highlight_file($p = $tpl->_get_compile_path($fn, ''));
echo '<hr />';
highlight_file($tpl->_get_template_path($fn));
echo '<hr />';
highlight_file(__FILE__);
Example #10
0
 /**
  * @return \Quicky
  */
 public function getQuickyInstance()
 {
     require_once $this->config->utilsdir->value . 'lang_om_number.php';
     $tpl = new \Quicky();
     $tpl->load_filter('pre', 'optimize');
     $tpl->template_dir = $this->config->themesdir->value;
     $tpl->compile_dir = '/tmp/templates_c/';
     $tpl->compiler_prefs['inline_includes'] = true;
     $tpl->force_compile = true;
     return $tpl;
 }
Example #11
0
<?php

require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
//$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
require_once $tpl->fetch_plugin('addons/memory_cache.class');
$tpl->cache_dir = 'qmem://' . $tpl->cache_dir;
$fn = 'caching/index.tpl';
if (isset($_REQUEST['clear'])) {
    $tpl->clear_cache($fn, '*');
}
$tpl->caching = 1;
$tpl->cache_lifetime = 60;
// ������
if (!$tpl->is_cached('index.tpl')) {
    $tpl->assign('var', '�����-������ ��������, ��������, �� ��');
}
$tpl->display($fn);
Example #12
0
<?php

require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
//$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
$tpl->assign('Name', 'Fred Irving Johnathan Bradley Peppergill');
$tpl->assign('FirstName', array('John', 'Mary', 'James', 'Henry'));
$tpl->assign('LastName', array('Doe', 'Smith', 'Johnson', 'Case'));
$tpl->assign('Class', array(array('A', 'B', 'C', 'D'), array('E', 'F', 'G', 'H'), array('I', 'J', 'K', 'L'), array('M', 'N', 'O', 'P')));
$tpl->assign('contacts', array(array('phone' => '1', 'fax' => '2', 'cell' => '3'), array('phone' => '555-4444', 'fax' => '555-3333', 'cell' => '760-1234')));
$tpl->assign('option_values', array('NY', 'NE', 'KS', 'IA', 'OK', 'TX'));
$tpl->assign('option_output', array('New York', 'Nebraska', 'Kansas', 'Iowa', 'Oklahoma', 'Texas'));
$tpl->assign('option_selected', 'NE');
$tpl->config_load('test.conf');
$fn = 'simple/index.tpl';
$tpl->display($fn);
echo '<br />' . (microtime(TRUE) - MICROTIME_START);
echo '<hr />';
highlight_file($tpl->_get_compile_path($fn, ''));
echo '<hr />';
highlight_file($tpl->template_dir . $fn);
Example #13
0
<?php

require_once '../Quicky.class.php';
define('MICROTIME_START', microtime(TRUE));
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
function testfunc()
{
    return 'Hello World!';
}
$tpl->register_function('testfunction', 'testfunc');
$fn = 'userdefined_func.tpl';
$tpl->display($fn);
echo '<hr />' . (microtime(TRUE) - MICROTIME_START);
echo '<hr />';
highlight_file($tpl->_get_compile_path($fn, ''));
echo '<hr />';
highlight_file($tpl->template_dir . $fn);
Example #14
0
<?php

define('MICROTIME_START', microtime(TRUE));
require_once '../Quicky.class.php';
error_reporting(E_ALL);
ini_set('display_errors', 'On');
$tpl = new Quicky();
$tpl->assign('myFunc', function () {
    return 'myResult';
});
$tpl->force_compile = TRUE;
//$tpl->compile_check = FALSE;
$fn = 'syntax/misc.tpl';
$tpl->display($fn);
echo '<hr />' . (microtime(TRUE) - MICROTIME_START);
echo '<hr />';
highlight_file($p = $tpl->_get_compile_path($fn, ''));
echo '<hr />';
highlight_file($tpl->_get_template_path($fn));