本文整理汇总了PHP中fs::clean_path方法的典型用法代码示例。如果您正苦于以下问题:PHP fs::clean_path方法的具体用法?PHP fs::clean_path怎么用?PHP fs::clean_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fs
的用法示例。
在下文中一共展示了fs::clean_path方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function &_getRecursiveFileList($directory, $file_test_function)
{
if (!is_dir($directory)) {
return array();
}
$dh = opendir($directory);
$file_list = array();
while ($file = readdir($dh)) {
$file_path = $directory . '/' . $file;
if (0 === strpos($file, '.')) {
continue;
}
if (is_dir($file_path)) {
$file_list = array_merge($file_list, $this->_getRecursiveFileList($file_path, $file_test_function));
}
if ($file_test_function[0]->{$file_test_function}[1]($file)) {
$file_list[] = fs::clean_path($file_path);
}
}
closedir($dh);
return $file_list;
}
示例2: chop
function find_subitems($dir, $types = 'dfl', $exclude_regex = '', $add_path = true, $include_hidden = false)
{
$dir = fs :: clean_path($dir);
$dir = fs :: chop($dir);
$items = array();
$separator = fs :: separator();
if ($handle = opendir($dir))
{
while(($element = readdir($handle)) !== false)
{
if ($element == '.' || $element == '..')
continue;
if (!$include_hidden && $element[0] == '.')
continue;
if ($exclude_regex && preg_match($exclude_regex, $element))
continue;
if (is_dir($dir . $separator . $element) && strpos($types, 'd') === false)
continue;
if (is_link($dir . $separator . $element) && strpos($types, 'l') === false)
continue;
if (is_file( $dir . $separator . $element ) && strpos($types, 'f') === false)
continue;
if ($add_path)
{
if (is_string($add_path))
$items[] = $add_path . $separator . $element;
else
$items[] = $dir . $separator . $element;
}
else
$items[] = $element;
}
closedir($handle);
}
return $items;
}
示例3:
function test_recursive_find()
{
$this->_create_file_system();
$res = fs :: recursive_find(TEST_DIR_ABSOLUTE_PATH . '/tmp/', 'test\d_1');
sort($res);
$this->assertEqual(
$res,
array(
fs :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/test1_1'),
fs :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/hey/test3_1'),
fs :: clean_path(TEST_DIR_ABSOLUTE_PATH . '/tmp/wow/test2_1'),
)
);
$this->_remove_file_system();
}
示例4: ActiveXObject
function _generate_debug_editor_link_html(&$code, $file_path)
{
if(!defined('WS_SCRIPT_WRITTEN'))
{
if(defined('TEMPLATE_EDITOR_PATH'))
$editor_path = TEMPLATE_EDITOR_PATH;
else
$editor_path = 'notepad.exe %s';
$code->write_html(" <SCRIPT LANGUAGE='JScript'>
function run_template_editor(path)
{
WS = new ActiveXObject('WScript.shell');
if(!WS) return;
editor = '{$editor_path}';
re = /%s/i;
editor = editor.replace(re, path);
WS.exec(editor);
}
</SCRIPT>");
define('WS_SCRIPT_WRITTEN', true);
}
$file_path = addslashes(fs :: clean_path($file_path));
$code->write_html("<a href='#'><img onclick='run_template_editor(this.title)' class='debug-info-img' src='/shared/images/i.gif' alt='i' title='{$file_path}' border='0'></a>");
}
示例5: test_flush
function test_flush()
{
$this->_write_simple_cache('f_test1', $content1 = 'test-content1');
$this->_write_simple_cache('f_test2', $content2 = 'test-content2');
$this->_write_simple_cache('not_page_file', $content3 = 'test-content3');
$cache_manager =& new full_page_cache_manager();
$cache_manager->flush();
$files = fs::find_subitems(PAGE_CACHE_DIR);
$this->assertEqual(sizeof($files), 1);
$file = reset($files);
$this->assertEqual(fs::clean_path($file), fs::clean_path(PAGE_CACHE_DIR . fs::separator() . 'not_page_file'));
$this->_clean_simple_cache('not_page_file');
}
示例6: ActiveXObject
function _generate_debug_editor_link_html(& $code, $file_path)
{
if(!defined('WS_SCRIPT_WRITTEN'))
{
$code->write_html(' <SCRIPT LANGUAGE="JScript">
function run_template_editor(path)
{
WS = new ActiveXObject("WScript.shell");
WS.exec("uedit32.exe " + path);
}
</SCRIPT>');
define('WS_SCRIPT_WRITTEN', true);
}
$file_path = addslashes(fs :: clean_path($file_path));
$code->write_html("<a href='#'><img onclick='run_template_editor(\"{$file_path}\");' src='/shared/images/i.gif' alt='{$file_path}'></a>");
}
示例7: addslashes
function _generate_debug_editor_link_html(& $code, $file_path)
{
// if(!defined('WS_SCRIPT_WRITTEN'))
// {
//
// $code->write_html(' <SCRIPT LANGUAGE="JScript">
// function run_template_editor(path)
// {
// WS = new ActiveXObject("WScript.shell");
// WS.exec("uedit32.exe " + path);
// }
// </SCRIPT>');
//
// define('WS_SCRIPT_WRITTEN', true);
// }
$file_path = addslashes(fs :: clean_path($file_path));
$code->write_html("<a href='#'><img class='debug-info-img' src='/shared/images/i.gif' alt='{$file_path}' title='{$file_path}' border='0'></a>");
}
示例8: _set_file_name
/**
* Make a file name (with path)
*
* @param string $id cache id
* @param string $group name of the group
* @access private
*/
function _set_file_name($id, $group)
{
if ($this->_file_name_protection) {
$this->_file = fs::clean_path($this->_cache_dir . '/cache_' . md5($group) . '_' . md5($id));
} else {
$this->_file = fs::clean_path($this->_cache_dir . '/cache_' . $group . '_' . $id);
}
}
示例9: HTMLTestManager
function &getTestCaseList($directory)
{
if (!file_exists($directory)) {
return '';
}
$directory = fs::clean_path($directory);
$manager =& new HTMLTestManager();
$testcases =& $manager->_getTestFileList($directory);
if (1 > count($testcases)) {
return "<p>No test cases set up!</p>";
}
$buffer = "<p>Available test cases:</p>\n<ul>";
foreach ($testcases as $testcase_file => $testcase) {
$buffer .= "<li><a href='" . $manager->getBaseURL() . "?case=" . urlencode($testcase_file) . "'>" . $testcase . "</a></li>\n";
}
return $buffer . "</ul>\n";
}