本文整理汇总了PHP中rcube_utils::is_absolute_path方法的典型用法代码示例。如果您正苦于以下问题:PHP rcube_utils::is_absolute_path方法的具体用法?PHP rcube_utils::is_absolute_path怎么用?PHP rcube_utils::is_absolute_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rcube_utils
的用法示例。
在下文中一共展示了rcube_utils::is_absolute_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_is_absolute_path
/**
* rcube:utils::is_absolute_path()
*/
function test_is_absolute_path()
{
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$test = array('' => false, "C:\\" => true, 'some/path' => false);
} else {
$test = array('' => false, '/path' => true, 'some/path' => false);
}
foreach ($test as $input => $output) {
$result = rcube_utils::is_absolute_path($input);
$this->assertSame($output, $result);
}
}
示例2: resolve_paths
/**
* Helper method to resolve absolute paths to the given config file.
* This also takes the 'env' property into account.
*
* @param string $file Filename or absolute file path
* @param boolean $use_env Return -$env file path if exists
*
* @return array List of candidates in config dir path(s)
*/
public function resolve_paths($file, $use_env = true)
{
$files = array();
$abs_path = rcube_utils::is_absolute_path($file);
foreach ($this->paths as $basepath) {
$realpath = $abs_path ? $file : realpath($basepath . '/' . $file);
// check if <file>-env.ini exists
if ($realpath && $use_env && !empty($this->env)) {
$envfile = preg_replace('/\\.(inc.php)$/', '-' . $this->env . '.\\1', $realpath);
if (is_file($envfile)) {
$realpath = $envfile;
}
}
if ($realpath) {
$files[] = $realpath;
// no need to continue the loop if an absolute file path is given
if ($abs_path) {
break;
}
}
}
return $files;
}
示例3: foreach
echo html::tag('li', null, html::span('propname', $msg['prop']) . ': ' . $msg['explain']);
}
echo '</ul>';
}
}
?>
<h3>Check if directories are writable</h3>
<p>Roundcube may need to write/save files into these directories</p>
<?php
$dirs[] = $RCI->config['temp_dir'] ? $RCI->config['temp_dir'] : 'temp';
if ($RCI->config['log_driver'] != 'syslog') {
$dirs[] = $RCI->config['log_dir'] ? $RCI->config['log_dir'] : 'logs';
}
foreach ($dirs as $dir) {
$dirpath = rcube_utils::is_absolute_path($dir) ? $dir : INSTALL_PATH . $dir;
if (is_writable(realpath($dirpath))) {
$RCI->pass($dir);
$pass = true;
} else {
$RCI->fail($dir, 'not writeable for the webserver');
}
echo '<br />';
}
if (!$pass) {
echo '<p class="hint">Use <tt>chmod</tt> or <tt>chown</tt> to grant write privileges to the webserver</p>';
}
?>
<h3>Check DB config</h3>
<?php