本文整理汇总了PHP中template::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP template::getInstance方法的具体用法?PHP template::getInstance怎么用?PHP template::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
*
*
* @param
* @access public
* @return void
*/
public function init()
{
$this->loadConfig();
$this->vars = array_merge_recursive($_POST, $_GET);
$this->template =& template::getInstance($this);
$this->template->initByFile($this->config['template']);
}
示例2: init
public function init()
{
$token = isset($_SESSION['token']) ? $_SESSION['token'] : $_COOKIE['token'];
$personal_id = isset($_SESSION['person']) ? $_SESSION['person'] : $_COOKIE['person'];
$user_ip = system::getInstance()->getRealIp();
// data 1st raw check before sql is used
if (strlen($token) == 32 && (filter_var($personal_id, FILTER_VALIDATE_EMAIL) || strlen($personal_id) > 0 && system::getInstance()->isLatinOrNumeric($personal_id))) {
$query = "SELECT * FROM\r\n " . property::getInstance()->get('db_prefix') . "_user a,\r\n " . property::getInstance()->get('db_prefix') . "_user_access_level b,\r\n " . property::getInstance()->get('db_prefix') . "_user_custom c\r\n WHERE (a.email = ? OR a.login = ?) AND a.token = ? AND a.token_ip = ? AND a.aprove = 0 AND a.access_level = b.group_id AND a.id = c.id";
$stmt = database::getInstance()->con()->prepare($query);
$stmt->bindParam(1, $personal_id, \PDO::PARAM_STR);
$stmt->bindParam(2, $personal_id, \PDO::PARAM_STR);
$stmt->bindParam(3, $token, \PDO::PARAM_STR, 32);
$stmt->bindParam(4, $user_ip, \PDO::PARAM_STR);
$stmt->execute();
if ($stmt->rowCount() == 1) {
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt = null;
if (time() - $result[0]['token_start'] < property::getInstance()->get('token_time')) {
$this->userindex = $result[0]['id'];
foreach ($result[0] as $column_index => $column_data) {
$this->userdata[$this->userindex][$column_index] = $column_data;
}
// set template variables
template::getInstance()->set(template::TYPE_USER, 'id', $this->userindex);
template::getInstance()->set(template::TYPE_USER, 'name', $this->userdata[$this->userindex]['nick']);
template::getInstance()->set(template::TYPE_USER, 'admin', permission::getInstance()->have('global/owner'));
template::getInstance()->set(template::TYPE_USER, 'admin_panel', permission::getInstance()->have('admin/main'));
template::getInstance()->set(template::TYPE_USER, 'news_add', extension::getInstance()->getConfig('enable_useradd', 'news', extension::TYPE_COMPONENT, 'bol'));
template::getInstance()->set(template::TYPE_USER, 'balance', $this->userdata[$this->userindex]['balance']);
}
}
}
}
示例3: init
/**
* Check if user is permament banned in database and display ban.tpl theme
*/
public function init()
{
$ip = system::getInstance()->getRealIp();
$time = time();
$userid = user::getInstance()->get('id');
if ($userid > 0) {
$stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_user_block WHERE (user_id = ? or ip = ?) AND (express > ? OR express = 0)");
$stmt->bindParam(1, $userid, \PDO::PARAM_INT);
$stmt->bindParam(2, $ip, \PDO::PARAM_STR);
$stmt->bindParam(3, $time, \PDO::PARAM_INT);
$stmt->execute();
} else {
$stmt = database::getInstance()->con()->prepare("SELECT COUNT(*) FROM " . property::getInstance()->get('db_prefix') . "_user_block WHERE ip = ? AND (express > ? OR express = 0)");
$stmt->bindParam(1, $ip, \PDO::PARAM_STR);
$stmt->bindParam(2, $time, \PDO::PARAM_INT);
$stmt->execute();
}
$rowFetch = $stmt->fetch();
$count = $rowFetch[0];
if ($count > 0) {
// block founded in db
$content = template::getInstance()->twigRender('ban.tpl', array('local' => array('admin_email' => property::getInstance()->get('mail_from'))));
template::getInstance()->justPrint($content);
}
}
示例4: buildToken
/**
* Get token for csrf prevention. Token is 32...128 chars. Token automatic add in cookie as 'csrf_token' and in template as {{ system.csrf_token }}
* @return string
*/
public function buildToken()
{
$now = time();
if (!isset($_SESSION['csrf_token']) || $_SESSION['csrf_token']['time'] == null || $_SESSION['csrf_token']['data'] == null || $now - $_SESSION['csrf_token']['time'] > self::SESSION_TIME) {
$_SESSION['csrf_token'] = array('time' => $now, 'data' => system::getInstance()->randomSecureString128());
}
template::getInstance()->set(template::TYPE_SYSTEM, 'csrf_token', $_SESSION['csrf_token']['data']);
}
示例5: initialize
public function initialize()
{
$this->template = template::getInstance();
$this->session = session::getInstance();
$this->album = album::getInstance();
$this->template->add(array('album'));
$this->id = $this->session->getData('album', 'id');
$this->page = $this->session->getData('album', 'page');
}
示例6: initialize
public function initialize()
{
$this->template = template::getInstance();
if ($this->ajax) {
$this->content = ajax::getInstance();
} else {
$this->content = index::getInstance();
}
$this->content->initialize();
}
示例7: compile
public function compile()
{
template::getInstance()->set(template::TYPE_META, 'description', system::getInstance()->altimplode('. ', $this->metadata['description']));
template::getInstance()->set(template::TYPE_META, 'keywords', system::getInstance()->altimplode('. ', $this->metadata['keywords']));
template::getInstance()->set(template::TYPE_META, 'global_title', $this->metadata['global_title']);
if (property::getInstance()->get('multi_title')) {
template::getInstance()->set(template::TYPE_META, 'title', system::getInstance()->altimplode(" - ", array_reverse($this->metadata['title'])));
} else {
template::getInstance()->set(template::TYPE_META, 'title', array_pop($this->metadata['title']));
}
template::getInstance()->set(template::TYPE_META, 'generator', 'FFCMS engine: ffcms.ru. Version: ' . version);
}
示例8: execute
function execute()
{
index::execute();
$tpl = template::getInstance();
if ($tpl->existValue('index', 'navigator') && $tpl->existValue('index', 'fulltitle')) {
$this->loadNavInfo();
$tpl->setVar('fulltitle', $this->getFullTitle());
$tpl->setVar('navigator', $this->navInfo);
}
$tpl->setVar('url', getMyUrlEncode('?mode=album&id=0'));
$tpl->setVar('content', $this->content->display());
}
示例9: make
public function make()
{
if (!property::getInstance()->get('maintenance')) {
// is not a maintenance mod
return;
}
if (permission::getInstance()->have('admin/main')) {
// not show for admin
return;
}
$login_form = extension::getInstance()->call(extension::TYPE_COMPONENT, 'user')->viewLogin();
// call to login view & worker
$tpl = template::getInstance()->twigRender('maintenance.tpl', array('login_form' => $login_form));
// render with login form
template::getInstance()->justPrint($tpl, array());
}
示例10: __construct
public function __construct()
{
session_start();
$this->load();
$this->validConfigBase();
headmgr::addHeaderBeforeInclude('<!--' . chr(10) . chr(9) . 'This website is powered by EYOCMS - inspiring people to share!' . chr(10) . chr(9) . 'EYOCMS is a free open source Content Management Framework initially created by Touzet David and licensed under GNU/GPL.' . chr(10) . chr(9) . 'EYOCMS is copyright 2010-2011 of Touzet David.' . chr(10) . chr(9) . 'Extensions are copyright of their respective owners.' . chr(10) . '-->');
$this->db = new db();
$this->db->connect($GLOBALS['SITECONF']['DBCONF']['SERNAME'], $GLOBALS['SITECONF']['DBCONF']['username'], $GLOBALS['SITECONF']['DBCONF']['password'], $GLOBALS['SITECONF']['DBCONF']['db']);
$this->template =& template::getInstance($this);
//new template();
$this->vars = array_merge_recursive($_POST, $_GET);
if (file_exists(PATH_TEMPLATE . 'index.html')) {
$templatePath = PATH_TEMPLATE . 'index.html';
} else {
$templatePath = PATH_MODULE . 'index.html';
}
$this->template->initByFile($templatePath);
}
示例11: __construct
public function __construct()
{
$this->session = session::getInstance();
$this->engine = engine::getInstance();
$this->template = template::getInstance();
}
示例12: viewMain
private function viewMain()
{
return template::getInstance()->twigRender('switch.tpl', array());
}
示例13: finalize
public function finalize()
{
$cv = cv::getInstance();
$template = template::getInstance();
$main = array('header' => $this->getHeader(), 'content' => $template->evaluate('content', array('content' => $cv->html)), 'footer' => $template->evaluate('footer', array()), 'job' => $cv->header['job'], 'subjob' => $cv->header['subjob'], 'fullname' => $cv->header['fullname'], 'theme' => $this->getThemeList(), 'themesel' => $this->getSwitchTheme(), 'cvsel' => $this->getSwitchCV(), 'langue' => $this->getSwitchLang());
$html = $template->evaluate('main', $main);
echo $this->translate($html);
}
示例14: getLogin
public function getLogin()
{
$session = session::getInstance();
$template = template::getInstance();
if ($session->isLogged()) {
$param = array('username' => $session->getUser('username'), 'admin_update' => '');
if ($session->getUser('right') == 'admin') {
// $param['admin_update'] = $this->template->get('admin_update',array());
}
return $template->get('index_logout', $param);
} else {
return $template->get('index_login', array());
}
}
示例15: addDownload
function addDownload($info)
{
$engine = engine::getInstance();
$template = template::getInstance();
$path = $_SERVER['DOCUMENT_ROOT'] . '/data/' . $engine->cv . '/download/';
$content = '';
if (is_dir($path)) {
$list = scandir($path);
foreach ($list as $value) {
if ($value != '..' && $value != '.') {
$content .= '<a href="data/' . $engine->cv . '/download/' . $value . '">' . $value . '</a><br/>';
}
}
$array = array('code' => $info['code'], 'title' => $info['title'], 'option' => 'style="display:' . ($info['hide'] ? 'none' : 'block') . '"', 'content' => $content);
return $template->evaluate('box', $array);
} else {
return '';
}
}