本文整理汇总了PHP中smarty_core_load_resource_plugin函数的典型用法代码示例。如果您正苦于以下问题:PHP smarty_core_load_resource_plugin函数的具体用法?PHP smarty_core_load_resource_plugin怎么用?PHP smarty_core_load_resource_plugin使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了smarty_core_load_resource_plugin函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
require_once dirname(__FILE__) . '/main_functions.php';
require_once dirname(__FILE__) . '/common_functions.php';
require_once XOOPS_TRUST_PATH . '/libs/altsys/include/altsys_functions.php';
require_once XOOPS_TRUST_PATH . '/libs/altsys/class/D3Tpl.class.php';
$myts =& MyTextSanitizer::getInstance();
$db =& Database::getInstance();
// init xoops_breadcrumbs
$xoops_breadcrumbs[0] = array('url' => XOOPS_URL . '/modules/' . $mydirname . '/index.php', 'name' => $xoopsModule->getVar('name'));
if (altsys_get_core_type() == ALTSYS_CORE_TYPE_X20S) {
// patch for XOOPS 2.0.14/15/16 (what a silly core...)
$D3Tpl = new D3Tpl();
require_once SMARTY_CORE_DIR . 'core.load_resource_plugin.php';
smarty_core_load_resource_plugin(array('type' => 'db'), $D3Tpl);
}
示例2: _parse_resource_name
/**
* parse out the type and name from the resource
*
* @param string $resource_base_path
* @param string $resource_name
* @param string $resource_type
* @param string $resource_name
* @return boolean
*/
function _parse_resource_name(&$params)
{
// split tpl_path by the first colon
$_resource_name_parts = explode(':', $params['resource_name'], 2);
if (count($_resource_name_parts) == 1) {
// no resource type given
$params['resource_type'] = $this->default_resource_type;
$params['resource_name'] = $_resource_name_parts[0];
} else {
if (strlen($_resource_name_parts[0]) == 1) {
// 1 char is not resource type, but part of filepath
$params['resource_type'] = $this->default_resource_type;
$params['resource_name'] = $params['resource_name'];
} else {
$params['resource_type'] = $_resource_name_parts[0];
$params['resource_name'] = $_resource_name_parts[1];
}
}
if ($params['resource_type'] == 'file') {
if (!preg_match('/^([\\/\\\\]|[a-zA-Z]:[\\/\\\\])/', $params['resource_name'])) {
// relative pathname to $params['resource_base_path']
// use the first directory where the file is found
foreach ((array) $params['resource_base_path'] as $_curr_path) {
$_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
if (file_exists($_fullpath) && is_file($_fullpath)) {
$params['resource_name'] = $_fullpath;
return true;
}
// didn't find the file, try include_path
$_params = array('file_path' => $_fullpath);
require_once SMARTY_CORE_DIR . 'core.get_include_path.php';
if (smarty_core_get_include_path($_params, $this)) {
$params['resource_name'] = $_params['new_file_path'];
return true;
}
}
return false;
} else {
/* absolute path */
return file_exists($params['resource_name']);
}
} elseif (empty($this->_plugins['resource'][$params['resource_type']])) {
$_params = array('type' => $params['resource_type']);
require_once SMARTY_CORE_DIR . 'core.load_resource_plugin.php';
smarty_core_load_resource_plugin($_params, $this);
}
return true;
}
示例3: _parse_resource_name
function _parse_resource_name(&$params)
{
$_resource_name_parts = explode(':',$params['resource_name'],2);
if (count($_resource_name_parts) == 1) {
$params['resource_type'] = $this->default_resource_type;
$params['resource_name'] = $_resource_name_parts[0];
}else {
if(strlen($_resource_name_parts[0]) == 1) {
$params['resource_type'] = $this->default_resource_type;
$params['resource_name'] = $params['resource_name'];
}else {
$params['resource_type'] = $_resource_name_parts[0];
$params['resource_name'] = $_resource_name_parts[1];
}
}
if ($params['resource_type'] == 'file') {
if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/',$params['resource_name'])) {
foreach ((array)$params['resource_base_path'] as $_curr_path) {
$_fullpath = $_curr_path .DIRECTORY_SEPARATOR .$params['resource_name'];
if (file_exists($_fullpath) &&is_file($_fullpath)) {
$params['resource_name'] = $_fullpath;
return true;
}
$_params = array('file_path'=>$_fullpath);
require_once(SMARTY_CORE_DIR .'core.get_include_path.php');
if(smarty_core_get_include_path($_params,$this)) {
$params['resource_name'] = $_params['new_file_path'];
return true;
}
}
return false;
}else {
return file_exists($params['resource_name']);
}
}elseif (empty($this->_plugins['resource'][$params['resource_type']])) {
$_params = array('type'=>$params['resource_type']);
require_once(SMARTY_CORE_DIR .'core.load_resource_plugin.php');
smarty_core_load_resource_plugin($_params,$this);
}
return true;
}