本文整理汇总了PHP中RainTPL::configure方法的典型用法代码示例。如果您正苦于以下问题:PHP RainTPL::configure方法的具体用法?PHP RainTPL::configure怎么用?PHP RainTPL::configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RainTPL
的用法示例。
在下文中一共展示了RainTPL::configure方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
/**
* Configuramos RainTPL.
*/
private static function configure()
{
// Defino constantes para URL's relativas.
if (!defined('THEME_URL')) {
define('THEME_URL', SITE_URL . 'theme/' . THEME);
}
// No usarmos las URL's de RainTPL.
RainTPL::configure('base_url', '');
RainTPL::configure('path_replace', FALSE);
// Configuramos directorio de los template's. Seteamos base para que nuestra
// extensión se encarge.
RainTPL::configure('tpl_dir', APP_BASE . DS);
// Directorio de cache de raintpl ( se usa subdirectorio por la cache de otros
// elementos).
RainTPL::configure('cache_dir', CACHE_PATH . DS . 'raintpl' . DS . THEME . DS);
// Extension de los templates iguales que los archivos generales. Evitamos su
// descarga.
RainTPL::configure('tpl_ext', FILE_EXT);
// Los templates por razones de seguridad no pueden usar variables globales.
RainTPL::configure('black_list', array('_SESSION', '_POST', '_GET', '_SERVER', '_ENV', '_REQUEST', '\\$this', 'raintpl::', 'self::', 'eval', 'exec', 'unlink', 'rmdir'));
RainTPL::configure('check_template_update', TRUE);
// Por defecto no permitimos etiquetas PHP.
// Es por seguridad y para mantener el patrón MVC.
RainTPL::configure('php_enabled', FALSE);
RainTPL::configure('debug', FALSE);
}
示例2: getData
public function getData($url_path = '/teams', $extra = NULL, $template_file = NULL, $useCache = true)
{
$wn_current = ltrim(date('W'), '0');
$wn_previous = ltrim(date('W', strtotime('-7 days')), '0');
$wn_next = ltrim(date('W', strtotime('+7 days')), '0');
$extra = str_replace(array('weeknummer=C', 'weeknummer=P', 'weeknummer=N'), array('weeknummer=' . $wn_current, 'weeknummer=' . $wn_previous, 'weeknummer=' . $wn_next), $extra);
$pluginFolder = dirname(__FILE__);
if (!isset($template_file) || $template_file == 'template') {
$template_file = basename($url_path);
if (strpos($extra, 'slider=1') > -1) {
// logica voor de slider: 'slider=1'
$template_file = $template_file . '_slider';
}
}
RainTPL::configure('base_url', NULL);
RainTPL::configure('tpl_dir', $pluginFolder . '/templates/');
RainTPL::configure('cache_dir', $pluginFolder . '/cache/');
RainTPL::configure('path_replace', false);
$tpl = new RainTPL();
// standaard 15 minuten cache
$cache_key = sanitize_file_name($url_path . '_' . $extra);
if ($useCache && ($cache = $tpl->cache($template_file, $expire_time = 900, $cache_id = $cache_key))) {
return $cache;
} else {
$list = $this->doRequest($url_path, $extra);
$tpl->assign('logo', strpos($extra, 'logo=1') > -1);
$tpl->assign('thuisonly', strpos($extra, 'thuisonly=1') > -1);
$tpl->assign('uitonly', strpos($extra, 'uitonly=1') > -1);
if (isset($list) && strpos($extra, 'thuis=1') > -1) {
// logica voor thuisclub eerst in overzichten als 'thuis=1' in $extra zit
if (strpos($extra, 'uitonly=1') === false) {
$thuis = array_filter($list, function ($row) {
$length = strlen($this->clubName);
return isset($row->ThuisClub) && substr($row->ThuisClub, 0, $length) === $this->clubName;
});
if (count($thuis) > 0) {
$tpl->assign('thuis', $thuis);
}
}
if (strpos($extra, 'thuisonly=1') === false) {
$uit = array_filter($list, function ($row) {
$length = strlen($this->clubName);
return isset($row->ThuisClub) && substr($row->UitClub, 0, $length) === $this->clubName;
});
if (count($uit) > 0) {
$tpl->assign('uit', $uit);
}
}
} else {
$tpl->assign('data', $list);
}
return $tpl->draw($template_file, $return_string = true);
}
}
示例3: init
public function init()
{
if ($this->engine === 'smarty') {
require_once "resources/templates/engine/smarty/Smarty.class.php";
$this->object = new Smarty();
$this->object->setTemplateDir($this->template_dir);
$this->object->setCompileDir($this->cache_dir);
$this->object->setCacheDir($this->cache_dir);
}
if ($this->engine === 'raintpl') {
require_once "resources/templates/engine/raintpl/rain.tpl.class.php";
$this->object = new RainTPL();
RainTPL::configure('tpl_dir', realpath($this->template_dir) . "/");
RainTPL::configure('cache_dir', realpath($this->cache_dir) . "/");
}
if ($this->engine === 'twig') {
require_once "resources/templates/engine/Twig/Autoloader.php";
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem($this->template_dir);
$this->object = new Twig_Environment($loader);
$lexer = new Twig_Lexer($this->object, array('tag_comment' => array('{*', '*}'), 'tag_block' => array('{', '}'), 'tag_variable' => array('{$', '}')));
$this->object->setLexer($lexer);
}
}
示例4: array
require_once "../../../classes/simple_html_dom.php";
require_once '../../../classes/rain.tpl.class.php';
require_once '../../../functions/functions.php';
require_once '../../../functions/rewrite_functions.php';
require_once '../../../functions/form.php';
require_once '../../../functions/date_functions.php';
require_once "../../../functions/file_functions.php";
require_once "../../../functions/cron_news_functions.php";
require_once 'functions.php';
require_once 'grid.php';
require_once 'functions_1.php';
require_once 'security_function_security.php';
RainTpl::configure("base_url", null);
RainTpl::configure("tpl_dir", "../../resources/templates/");
RainTpl::configure("cache_dir", "../../resources/caches/");
RainTPL::configure("path_replace_list", array());
$admin_id = getValue("user_id", "int", "SESSION");
$isAdmin = getValue("isAdmin", "int", "SESSION", 0);
$css_global = '';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/css/bootstrap.min.css" media="screen"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/js/bootstrap-tagsinput.css" media="screen"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/css/font-awesome.min.css" media="screen"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/js/enscroll.css" media="print"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/css/common.css" media="screen"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/css/template.css" media="screen"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/js/datepicker/datepicker.css" media="screen"/>';
/* khai báo css cho máy in */
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/css/bootstrap.min.css" media="print"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/css/font-awesome.min.css" media="screen"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/js/enscroll.css" media="print"/>';
$css_global .= '<link rel="stylesheet" type="text/css" href="../../resources/css/common.css" media="print"/>';
示例5: ob_start
if (!isset($version_number)) {
$version_number = 1;
}
if ($version_number > 1) {
$_version = '_v' . $version_number;
} else {
$_version = '';
}
include "initsession.php";
ob_start();
require_once '../classes/database.php';
require_once '../classes/user.php';
require_once '../classes/sphinx/sphinx_keyword.php';
require_once '../classes/generate_form.php';
require_once '../classes/rain.tpl.class.php';
require_once '../functions/functions.php';
require_once '../functions/mobile_custom_function.php';
require_once '../functions/function_translate.php';
require_once '../functions/rewrite_functions.php';
require_once '../functions/date_functions.php';
require_once '../includes/mobile/inc_config_mobile.php';
$is_pjax = isset($_SERVER["HTTP_X_PJAX"]) && strtolower($_SERVER["HTTP_X_PJAX"]) == 'true';
$pjax_container = $is_pjax && isset($_SERVER['HTTP_X_PJAX_CONTAINER']) ? $_SERVER['HTTP_X_PJAX_CONTAINER'] : '';
$tpl_constants = isset($tpl_constants) ? $tpl_constants : array();
RainTpl::configure("base_url", null);
RainTpl::configure("tpl_dir", "../templates" . $_version . "/mobile/");
RainTpl::configure("cache_dir", "../caches/");
RainTPL::configure("path_replace_list", array());
RainTPL::configure("tpl_constants", $tpl_constants);
$rainTpl = new RainTPL();
示例6: define
use Otaku\Framework\Http;
use Otaku\Framework\Session;
use Otaku\Framework\Query;
use Otaku\Art\Module\Main as Module;
include_once 'framework/init.php';
define('API', ROOT_DIR . SL . 'api' . SL);
define('API_LIBS', API . 'libs' . SL);
define('API_IMAGES', API . 'images' . SL);
new Autoload(array('Art' => LIBS, 'Api' => API_LIBS, 'Framework' => FRAMEWORK_LIBS), FRAMEWORK_EXTERNAL);
mb_internal_encoding('UTF-8');
$config = Config::getInstance();
$config->parse(CONFIG . SL . 'define.ini', true);
$config->parse(CONFIG . SL . 'settings.ini');
$config->add(['safe' => ['mode' => $safeMode]], true);
$domain = $config->get('site', 'domain');
if ($domain && $domain != $_SERVER['SERVER_NAME']) {
$url = 'http://' . $domain . $_SERVER['REQUEST_URI'];
Http::redirect($url, true);
}
$session = Session::getInstance();
$session->init();
$config->add($session->get_data());
$query = new Query($_SERVER['REQUEST_URI'], array_replace($_POST, $_GET));
unset($_GET, $_POST);
\RainTPL::configure('tpl_dir', TPL . SL);
\RainTPL::configure('cache_dir', CACHE . SL . 'tpl' . SL);
\RainTPL::configure('path_replace', false);
$module = new Module($query);
$request = $module->gather_request();
$request->perform();
$module->dispatch();
示例7: array
require_once '../../../functions/rewrite_functions.php';
require_once '../../../functions/form.php';
require_once '../../../functions/date_functions.php';
require_once "../../../functions/file_functions.php";
require_once 'functions.php';
require_once 'grid.php';
require_once 'AbstractAjax.php';
require_once 'AjaxCommon.php';
require_once 'functions_1.php';
require_once 'functions_local.php';
require_once 'inc_config_security.php';
RainTpl::configure("base_url", null);
RainTpl::configure("tpl_dir", "../../resources/templates/");
RainTpl::configure("cache_dir", "../../resources/caches/");
RainTPL::configure("path_replace_list", array());
RainTPL::configure('tpl_constants', array('DEVELOPER_ENVIRONMENT' => DEVELOPER_ENVIRONMENT));
$admin_id = getValue("user_id", "int", "SESSION");
$user_config = getValue('user_config', 'int', 'SESSION');
$isAdmin = getValue("isAdmin", "int", "SESSION", 0);
$isSuperAdmin = getValue('isSuperAdmin', 'int', 'SESSION', 0);
$isAjaxRequest = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
//Lấy ra config nhà hàng
if ($isAdmin) {
$sql_configuration = 'SELECT * FROM configurations WHERE con_admin_id = ' . $admin_id . ' LIMIT 1';
} else {
$sql_configuration = 'SELECT *
FROM configurations
LEFT JOIN admin_users ON adm_id
WHERE con_admin_id = ' . $user_config . ' LIMIT 1';
}
$db_con = new db_query($sql_configuration);
示例8: configureRainTpl
private function configureRainTpl()
{
RainTPL::configure('base_url', TIPPSPIEL_CONF_PROTO . '://' . TIPPSPIEL_CONF_DOMAIN . TIPPSPIEL_CONF_PATH);
RainTPL::configure('path_replace_list', array('img', 'link', 'script'));
}