本文整理汇总了PHP中Smarty::load_filter方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::load_filter方法的具体用法?PHP Smarty::load_filter怎么用?PHP Smarty::load_filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty
的用法示例。
在下文中一共展示了Smarty::load_filter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Template renderer constructor
*
* Creates a smarty instance and sets a compile directory path (this is required
* by smarty)
*/
public function __construct(Application $application)
{
$this->application = $application;
$this->tpl = $this->getSmartyInstance();
$this->tpl->load_filter('pre', 'config');
$this->tpl->assign("BASE_URL", $this->application->getRouter()->getBaseUrl());
$this->registerHelperList();
}
示例2: GetTemplate
private static function GetTemplate()
{
if (null == self::$mTemplate) {
$smarty = new Smarty();
$smarty->template_dir = TPL_TEMPLATE_DIR;
$smarty->use_sub_dirs = defined('TPL_SUB_DIRS') ? TPL_SUB_DIRS : false;
$smarty->compile_dir = TPL_COMPILED_DIR;
$smarty->plugins_dir = isset($GLOBALS['CONFIG_TPLPLUGINS_DIRS']) ? $GLOBALS['CONFIG_TPLPLUGINS_DIRS'] : array('plugins', TPL_PLUGINS_DIR);
$smarty->left_delimiter = '<{';
$smarty->right_delimiter = '}>';
$smarty->load_filter('output', 'cssholder');
/* for convenience */
// global $current_user_id, $current_user_mobile, $current_user_active, $current_user_province, $current_user_city, $carrytime_beginning, $current_user_info, $current_header_type, $https_to_http;
$current_error = $current_alert = '';
if (!isset($https_to_http) || 0 >= $https_to_http) {
$current_error = Session::GetInfo('error');
$current_alert = Session::GetInfo('alert');
}
//$system_notice = array('type'=>'', 'message'=>'');
$system_notice = 'null';
if (!empty($current_alert)) {
$system_notice = '{type:\'notice\',message:"' . $current_alert . '"}';
//$system_notice = array('type'=>'info', 'message'=>$current_alert);
} elseif (!empty($current_error)) {
$system_notice = '{type:\'error\',message:"' . $current_error . '"}';
//$system_notice = array('type'=>'error', 'message'=>$current_error);
}
if (!isset($current_header_type)) {
$current_header_type = Utility::GetHeaderTypeByUrl();
}
/* $smarty->assign('current_header_type', $current_header_type);
$smarty->assign('current_user_id', $current_user_id);
$smarty->assign('current_user_info', $current_user_info);
$smarty->assign('current_user_mobile', $current_user_mobile);
$smarty->assign('current_user_active', $current_user_active);
$smarty->assign('current_user_province', $current_user_province);
$smarty->assign('current_user_city', $current_user_city);
$smarty->assign('system_notice', $system_notice);
$smarty->assign('carrytime_beginning', $carrytime_beginning);
*/
if (isset($_REQUEST['ajax'])) {
$smarty->assign('ajax', $_REQUEST['ajax']);
}
//$smarty->assign( 'system_notice', json_encode($system_notice));
/* end */
self::$mTemplate = $smarty;
}
return self::$mTemplate;
}
示例3: GetTemplate
private static function GetTemplate()
{
if (null == self::$mTemplate) {
$smarty = new Smarty();
$smarty->template_dir = TPL_TEMPLATE_DIR;
$smarty->use_sub_dirs = defined('TPL_SUB_DIRS') ? TPL_SUB_DIRS : false;
$smarty->compile_dir = TPL_COMPILED_DIR;
$smarty->plugins_dir = isset($GLOBALS['CONFIG_TPLPLUGINS_DIRS']) ? $GLOBALS['CONFIG_TPLPLUGINS_DIRS'] : array('plugins', TPL_PLUGINS_DIR);
$smarty->left_delimiter = '<{';
$smarty->right_delimiter = '}>';
$smarty->load_filter('output', 'cssholder');
if (!isset($current_header_type)) {
$current_header_type = Utility::GetHeaderTypeByUrl();
}
if (isset($_REQUEST['ajax'])) {
$smarty->assign('ajax', $_REQUEST['ajax']);
}
self::$mTemplate = $smarty;
}
return self::$mTemplate;
}
示例4:
}
// August 2012 Zollkosten als Muster mit Group ID 15
/*
if($order->delivery['country_id'] !== STORE_COUNTRY):
if (GROUP_CHECK == 'true') {
$group_check = "and group_ids LIKE '%c_" . $_SESSION['customers_status']['customers_status_id'] . "_group%'";
}
$shop_content_query = "SELECT
content_text
FROM " . TABLE_CONTENT_MANAGER . "
WHERE content_group='15' " . $group_check . "
AND languages_id='" . $_SESSION['languages_id'] . "'";
$shop_content_query = xtc_db_query($shop_content_query);
$shop_content_data = xtc_db_fetch_array($shop_content_query);
$smarty->assign('CHECKOUT_ZOLL', $shop_content_data['content_text']);
endif;
*/
$smarty->assign('language', $_SESSION['language']);
if ($kein_versand != 1) {
$smarty->assign('SHIPPING_BLOCK', $shipping_block);
}
$payment_hidden = xtc_draw_hidden_field('payment', 'paypalexpress') . xtc_draw_hidden_field('act_payment', 'true');
$smarty->assign('PAYMENT_HIDDEN', $payment_hidden);
$smarty->caching = 0;
$main_content = $smarty->fetch(CURRENT_TEMPLATE . '/module/checkout_paypal.html');
$smarty->assign('main_content', $main_content);
if (!defined('RM')) {
$smarty->load_filter('output', 'note');
}
$smarty->display(CURRENT_TEMPLATE . '/index.html');
include 'includes/application_bottom.php';
示例5: go
//.........这里部分代码省略.........
if ($this->frontendMode != 'true' || $forceLangInclude == 'true') {
// Read default language from config-file
if ($this->authenticated) {
$user = new User(Singleton::UserMgr()->getCurrentUserID());
$langid = $user->getLanguage();
$langinfo = $this->languages->get($langid);
$lang = $langinfo["CODE"];
} else {
// Check if we have a language which matches the browser-language
$browserLanguages = array();
$tmpBrowserLanguages = explode(',', strtoupper(str_replace(' ', '', $_SERVER["HTTP_ACCEPT_LANGUAGE"])));
foreach ($tmpBrowserLanguages as $tmpBrowserLanguage) {
array_push($browserLanguages, substr($tmpBrowserLanguage, 0, 2));
}
$browserLanguages = array_values(array_unique($browserLanguages));
foreach ($browserLanguages as $browserLanguage) {
if (!$lang) {
if (file_exists($this->approot . "ui/lang/" . $browserLanguage . ".php")) {
$lang = $browserLanguage;
}
}
}
}
// When everything fails, fallback to default language
if (strlen($lang) < 1) {
$defaultLanguage = Singleton::config()->getVar('CONFIG/DEFAULT_LANGUAGE');
$lang = $defaultLanguage ? $defaultLanguage : 'DE';
}
require_once $this->approot . "ui/lang/" . $lang . ".php";
}
$this->itext =& $itext;
Singleton::register("itext", $itext);
if (!is_readable($this->page_file) || is_dir($this->page_file)) {
$this->error->raise("Page " . $this->page . "'s code (" . $this->page_file . ") not found.", ERR_DEBUG);
} else {
$this->error->raise("loading " . $this->page_file, ERR_DEBUG);
if ($this->page_template != "") {
require_once "libs/org/smarty/libs/Smarty.class.php";
$smarty = new Smarty();
$this->smarty = $smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$smarty->use_sub_dirs = false;
// FIXME move to installer
@mkdir($this->tmpdir . 'templates_compile', 0700);
@mkdir($this->tmpdir . 'templates_cache', 0700);
$smarty->compile_dir = $this->tmpdir . 'templates_compile';
$smarty->cache_dir = $this->tmpdir . 'templates_cache';
$smarty->force_compile = (string) $this->config->getVar('CONFIG/CACHE/SMARTY_FORCECOMPILE');
$smarty->caching = 0;
$smarty->load_filter('output', 'trimwhitespace');
$smarty->assign("yeager_version", $this->yeager_version);
$smarty->assign("yeager_revision", $this->yeager_revision);
//$smarty->assign("yeager_date",$this->yeager_date);
$smarty->assign("lang", $lang);
$smarty->assign("docabsolut", $this->docabsolut);
$smarty->assign("baseabsolut", $this->baseabsolut);
$smarty->assign("imgpath", $this->imgpath);
$smarty->assign("internalprefix", (string) Singleton::config()->getVar('CONFIG/REFTRACKER/INTERNALPREFIX'));
$smarty->assign("request_prefix", $this->request->prefix);
$smarty->assign("extensiondoc", $this->extensiondoc);
$smarty->assign("extensiondir", $this->extensiondir);
$smarty->assign("is_authenticated", $this->authenticated);
$smarty->assign("base", $this->base);
$smarty->assign("page", $this->page);
$smarty->assign("sid", $this->sid);
$smarty->assign("sidparam", $this->sidparam);
$smarty->assign("templatedir", $this->templatedir);
$smarty->assign("templatedoc", $this->templatedoc);
$smarty->assign("templatedirabsolut", $this->templatedirabsolut);
$smarty->assign("approot", getRealpath($this->approot));
$smarty->assign("devmode", $this->devmode);
$smarty->assign("webroot", $this->webroot);
$smarty->assign("URLRegEx1", $this->URLRegEx1);
require_once $this->approot . "libs/org/yeager/ui/smarty_modifiers.php";
}
$smarty->assign("itext", $itext);
Singleton::register("smarty", $smarty);
if ($_SERVER['HTTP_X_YEAGER_AUTHENTICATION'] == 'suppress') {
$authHeader = 'X-Yeager-Authenticated: delayed';
} else {
$authHeader = 'X-Yeager-Authenticated: ' . ($this->authenticated ? 'true' : 'false');
}
header($authHeader);
if ($this->frontendMode == "true" && $this->cached) {
// capture ob
include_once $this->page_file;
$output = ob_get_clean();
Singleton::FC()->write("output", $output);
Singleton::FC()->flush();
echo $output;
} else {
include_once $this->page_file;
}
if ($this->frontendMode != 'true') {
$koala->getQueuedCommands();
$koala->go();
}
}
}
示例6: substr
if (isset($_GET['p'])) {
$fullpath = $gitphp_conf['projectroot'] . $_GET['p'];
$realprojroot = $gitphp_conf['projectroot'];
$pathpiece = substr($fullpath, 0, strlen($realprojroot));
if (strcmp($pathpiece, $realprojroot) === 0) {
$project = str_replace(chr(0), '', $_GET['p']);
}
}
$extraoutput = FALSE;
/*
* Instantiate Smarty
*/
require_once $gitphp_conf['smarty_prefix'] . "Smarty.class.php";
$tpl = new Smarty();
if (!isset($_GET['a']) || $_GET['a'] != "commitdiff_plain" && $_GET['a'] != "blob_plain" && $_GET['a'] != "blobdiff_plain" && $_GET['a'] != "rss" && $_GET['a'] != "opml" && $_GET['a'] != "snapshot") {
$tpl->load_filter('output', 'trimwhitespace');
$extraoutput = TRUE;
}
/*
* Debug
*/
if ($gitphp_conf['debug']) {
if ($extraoutput) {
define('GITPHP_START_TIME', microtime(true));
error_reporting(E_ALL | E_STRICT);
}
}
/*
* Development
*/
if (!(isset($gitphp_conf['dev']) && $gitphp_conf['dev'])) {
示例7: R3AppInit
/**
* Handle all the active stuff that usually happens in config.php.
* This are things as opening db connections, start sessions etc.
*
* Session is started
* The folloy object are created:
* - $smarty
* - $auth
*/
function R3AppInit($type = null, array $opt = array())
{
global $smarty, $auth, $pdo, $mdb2, $dbini;
// output object
global $mdb2_dsn, $lang;
// output var
global $dsn, $sessionOpt, $mdb2_options;
// input vars
global $auth_options;
// input vars
global $scriptStartTime;
/* Default application type */
if ($type === null) {
$type = 'admin';
}
$opt = array_merge(array('session_start' => true, 'auth' => true, 'auth_manager' => false, 'dbini' => false), $opt);
/* Session */
foreach ($sessionOpt as $key => $val) {
switch ($key) {
case 'name':
session_name($val);
break;
case 'cache_limiter':
session_cache_limiter($val);
break;
case 'save_path':
session_save_path($val);
break;
case 'timeout':
session_cache_expire(ceil($val / 60));
break;
case 'warning_timeout':
// do nothing;
break;
default:
ini_set("session." . $key, $val);
}
}
if ($opt['session_start'] === true && session_id() == '') {
session_start();
}
/* Smarty */
require_once R3_SMARTY_ROOT_DIR . 'Smarty.class.php';
$smarty = new Smarty();
$smarty->config_dir = R3_SMARTY_ROOT_DIR . 'configs/';
$smarty->cache_dir = R3_SMARTY_ROOT_DIR . 'cache/';
if (defined('R3_SMARTY_PLUGIN_DIR')) {
$smarty->plugins_dir[] = R3_SMARTY_PLUGIN_DIR;
}
if ($type == 'admin') {
$smarty->template_dir = R3_SMARTY_TEMPLATE_DIR_ADMIN;
$smarty->compile_dir = R3_SMARTY_TEMPLATE_C_DIR_ADMIN;
} else {
if ($type == 'public') {
// for public sites
$smarty->template_dir = R3_SMARTY_TEMPLATE_DIR_PUBLIC;
$smarty->compile_dir = R3_SMARTY_TEMPLATE_C_DIR_PUBLIC;
} else {
if ($type == 'map') {
$smarty->template_dir = R3_SMARTY_TEMPLATE_DIR_MAP;
$smarty->compile_dir = R3_SMARTY_TEMPLATE_C_DIR_MAP;
} else {
throw new Exception("Unknown smarty specialization");
}
}
}
$smarty->load_filter('pre', 'r3quotevalue');
R3AppInitDB();
/* Authentication */
if ($opt['auth'] === true && !isset($auth_options)) {
throw new Exception('Missing $auth_options');
}
if ($opt['auth'] === true) {
if ($opt['auth_manager'] === true) {
require_once R3_LIB_DIR . 'r3auth_manager.php';
$auth = new R3AuthManager($mdb2, $auth_options, APPLICATION_CODE);
} else {
require_once R3_LIB_DIR . 'r3auth.php';
$auth = new R3Auth($mdb2, $auth_options, APPLICATION_CODE);
}
R3AuthInstance::set($auth);
}
/* DBIni */
if ($opt['dbini'] === true) {
require_once R3_LIB_DIR . 'r3dbini.php';
$domainName = R3_IS_MULTIDOMAIN ? 'SYSTEM' : DOMAIN_NAME;
$dbini = new R3DBIni($mdb2, $auth_options, $domainName, APPLICATION_CODE);
}
}
示例8: loadFilter
public function loadFilter($filter, $name)
{
$this->_smarty->load_filter($filter, $name);
}