本文整理汇总了PHP中KTUtil::isAbsolutePath方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::isAbsolutePath方法的具体用法?PHP KTUtil::isAbsolutePath怎么用?PHP KTUtil::isAbsolutePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KTUtil
的用法示例。
在下文中一共展示了KTUtil::isAbsolutePath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _findTemplate
function _findTemplate($templatename)
{
$aPossibilities = array();
foreach ($this->aLocationRegistry as $loc => $path) {
if (KTUtil::isAbsolutePath($path)) {
$fulldirectory = $path . "/";
foreach (array_keys($this->aTemplateRegistry) as $suffix) {
$fullpath = $fulldirectory . $templatename . "." . $suffix;
if (file_exists($fullpath)) {
$aPossibilities[$loc] = array($suffix, $fullpath);
}
}
}
$fulldirectory = KT_DIR . "/" . $path . "/";
foreach (array_keys($this->aTemplateRegistry) as $suffix) {
$fullpath = $fulldirectory . $templatename . "." . $suffix;
if (file_exists($fullpath)) {
$aPossibilities[$loc] = array($suffix, $fullpath);
}
}
}
if (count($aPossibilities) === 0) {
return PEAR::raiseError(_kt("No template found"));
}
return $this->_chooseTemplate($templatename, $aPossibilities);
}
示例2: writablePath
function writablePath($name, $path)
{
$ret = sprintf('<tr><td>%s (%s)</td><td>', $name, $path);
// Ensure the path is a full/absolute path
$path = KTUtil::isAbsolutePath($path) ? $path : KT_DIR . $path;
// Check if the directory exists and create it if it doesn't
if (!file_exists($path)) {
mkdir($path, 0755);
}
// Check if directory is writable
if (is_writable($path)) {
$ret .= sprintf('<font color="green"><b>Writeable</b></font>');
} else {
$ret .= sprintf('<font color="red"><b>Unwriteable</b></font>');
}
return $ret;
}
示例3:
function &getPlugin($sNamespace)
{
if (array_key_exists($sNamespace, $this->_aPlugins)) {
return $this->_aPlugins[$sNamespace];
}
$aDetails = KTUtil::arrayGet($this->_aPluginDetails, $sNamespace);
if (empty($aDetails)) {
return null;
}
$sFilename = KTUtil::isAbsolutePath($aDetails[2]) ? $aDetails[2] : KT_DIR . '/' . $aDetails[2];
if (!empty($sFilename)) {
require_once $sFilename;
}
$sClassName = $aDetails[0];
$oPlugin = new $sClassName($sFilename);
$this->_aPlugins[$sNamespace] =& $oPlugin;
return $oPlugin;
}
示例4: getTriggers
function getTriggers($action, $slot)
{
$ret = array();
if (array_key_exists($action, $this->triggers)) {
if (array_key_exists($slot, $this->triggers[$action])) {
$ret = $this->triggers[$action][$slot];
}
}
if (empty($ret)) {
return array();
}
foreach ($ret as $trigger) {
if (!class_exists($trigger[0])) {
$sPath = KTUtil::isAbsolutePath($trigger[1]) ? $trigger[1] : KT_DIR . '/' . $trigger[1];
require_once $sPath;
if (!class_exists($trigger[0])) {
global $default;
$default->log->error(sprintf(_kt('Cannot locate trigger class \'%s\' for action \'%s\' slot \'%s\'.'), $trigger[0], $action, $slot));
}
}
}
return $ret;
}
示例5: getConfigFilename
/**
* Return the location of the config.ini
*
* @return string
*/
static function getConfigFilename()
{
$pathFile = KT_DIR . '/config/config-path';
$configFile = trim(file_get_contents($pathFile));
$configFile = !KTUtil::isAbsolutePath($configFile) ? sprintf('%s/%s', KT_DIR, $configFile) : $configFile;
// Remove any double slashes
$configFile = str_replace('//', '/', $configFile);
$configFile = str_replace('\\\\', '\\', $configFile);
if (file_exists($configFile)) {
return $configFile;
} else {
return KT_DIR . DIRECTORY_SEPARATOR . $configFile;
}
}
示例6:
function &getAuthenticationProvider($nsname)
{
$oProvider =& KTUtil::arrayGet($this->_aAuthenticationProviders, $nsname);
if ($oProvider) {
return $oProvider;
}
$aInfo = $this->_aAuthenticationProvidersInfo[$nsname];
$sClass = $aInfo[1];
$sPath = $aInfo[3];
if ($sPath) {
$sPath = KTUtil::isAbsolutePath($sPath) ? $sPath : KT_DIR . '/' . $sPath;
include_once $sPath;
}
if (!class_exists($sClass)) {
return PEAR::raiseError(_kt('Authentication provider class does not exist. ' . $sClass));
}
$oProvider = new $sClass();
$this->_aAuthenticationProviders[$nsname] =& $oProvider;
return $oProvider;
}
示例7: initTesting
function initTesting()
{
$oKTConfig =& KTConfig::getSingleton();
$sConfigFile = trim(@file_get_contents(KT_DIR . '/config/test-config-path'));
if (empty($sConfigFile)) {
$sConfigFile = 'config/test.ini';
}
if (!KTUtil::isAbsolutePath($sConfigFile)) {
$sConfigFile = sprintf('%s/%s', KT_DIR, $sConfigFile);
}
if (!file_exists($sConfigFile)) {
$this->handleInitError(PEAR::raiseError('Test infrastructure not configured'));
exit(0);
}
$res = $oKTConfig->loadFile($sConfigFile);
if (PEAR::isError($res)) {
return $res;
}
$_SESSION['userID'] = 1;
}
示例8: loadProcessors
private function loadProcessors()
{
// Get list of registered processors (plugins)
$query = 'SELECT h.* FROM plugin_helper h
INNER JOIN plugins p ON (p.namespace = h.plugin)
WHERE p.disabled = 0 AND h.classtype = "processor"';
$results = DBUtil::getResultArray($query);
if (PEAR::isError($results)) {
global $default;
$default->log->debug('documentProcessor: error loading processors') . ' - ' . $results->getMessage();
return false;
}
if (empty($results)) {
return false;
}
$processors = array();
foreach ($results as $item) {
$path = KTUtil::isAbsolutePath($item['pathname']) ? $item['pathname'] : KT_DIR . DIRECTORY_SEPARATOR . $item['pathname'];
require_once $path;
$processors[] = new $item['classname']();
}
usort($processors, 'orderProcessors');
return $processors;
}
示例9: _fixFilename
function _fixFilename($sFilename)
{
if (empty($sFilename)) {
$sFilename = $this->sFilename;
}
if (!KTUtil::isAbsolutePath($sFilename)) {
if ($this->sFilename) {
$sDirPath = dirname($this->sFilename);
$sFilename = sprintf("%s/%s", $sDirPath, $sFilename);
}
}
$sKtDir = str_replace('\\', '/', KT_DIR);
$sFilename = realpath($sFilename);
$sFilename = str_replace('\\', '/', $sFilename);
$sFilename = str_replace($sKtDir . '/', '', $sFilename);
return $sFilename;
}
示例10: doPluginRegistration
/**
* Read the plugins directory and register all plugins in the database.
*/
function doPluginRegistration()
{
global $default;
KTPluginUtil::_deleteSmartyFiles();
require_once KT_LIB_DIR . '/cache/cache.inc.php';
$oCache =& KTCache::getSingleton();
$oCache->deleteAllCaches();
// Remove all entries from the plugin_helper table and refresh it.
$query = "DELETE FROM plugin_helper";
$res = DBUtil::runQuery($query);
$files = array();
$plugins = array();
KTPluginUtil::_walk(KT_DIR . '/plugins', $files);
foreach ($files as $sFile) {
$plugin_ending = "Plugin.php";
if (substr($sFile, -strlen($plugin_ending)) === $plugin_ending) {
/* Set default priority */
$plugins[$sFile] = KTPluginUtil::getPluginPriority($sFile);
}
}
/* Sort the plugins by priority */
asort($plugins);
/*
Add a check to indicate that plugin registration is occuring.
This check has been put in place to prevent the plugin being registered on every page load.
*/
$_SESSION['plugins_registerplugins'] = true;
foreach ($plugins as $sFile => $priority) {
require_once $sFile;
}
$_SESSION['plugins_registerplugins'] = false;
$oRegistry =& KTPluginRegistry::getSingleton();
$aRegistryList = $oRegistry->getPlugins();
foreach ($aRegistryList as $oPlugin) {
$res = $oPlugin->register();
if (PEAR::isError($res)) {
//var_dump($res);
$default->log->debug('Register of plugin failed: ' . $res->getMessage());
}
}
$aPluginList = KTPluginEntity::getList();
foreach ($aPluginList as $oPluginEntity) {
$sPath = $oPluginEntity->getPath();
if (!KTUtil::isAbsolutePath($sPath)) {
$sPath = sprintf("%s/%s", KT_DIR, $sPath);
}
if (!file_exists($sPath)) {
$oPluginEntity->setUnavailable(true);
$oPluginEntity->setDisabled(true);
$res = $oPluginEntity->update();
}
}
KTPluginEntity::clearAllCaches();
KTPluginUtil::_deleteSmartyFiles();
require_once KT_LIB_DIR . '/cache/cache.inc.php';
$oCache =& KTCache::getSingleton();
$oCache->deleteAllCaches();
//KTPluginUtil::removePluginCache();
}