本文整理汇总了PHP中kFile::dirListExtended方法的典型用法代码示例。如果您正苦于以下问题:PHP kFile::dirListExtended方法的具体用法?PHP kFile::dirListExtended怎么用?PHP kFile::dirListExtended使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFile
的用法示例。
在下文中一共展示了kFile::dirListExtended方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$this->forceSystemAuthentication();
$this->basePath = "/content/dynamic/";
$dynamicRoot = myContentStorage::getFSContentRootPath() . $this->basePath;
if ($this->getRequest()->getMethod() == sfRequest::POST) {
$origFilename = basename($_FILES['Filedata']['name']);
$fullPath = $dynamicRoot . $origFilename;
move_uploaded_file($_FILES['Filedata']['tmp_name'], $fullPath);
chmod($fullPath, 0777);
return $this->renderText("ok");
} else {
if ($this->getRequest()->getMethod() == sfRequest::DELETE) {
$filename = basename($_REQUEST['fileName']);
kFile::deleteFile($dynamicRoot . $filename);
return $this->renderText("ok");
}
}
$this->files = kFile::dirListExtended($dynamicRoot, false);
$this->extraHead = <<<EOT
\t\t<style type="text/css">
\t\t\ttable{ font-size:1.2em; width:100%; margin:40px 0 0 0; }
\t\t\ttable thead{ font-size:1.4em; }
\t\t\t\ttable thead td{ border-bottom:1px solid #444; margin-bottom:20px; }
\t\t\ttable tbody td{ padding:2px 0; color:#ccc; }
\t\t\t\ttable tbody td b{ font-weight:normal; cursor:default; }
\t\t\t\ttable tbody td span.btn{ margin-right:12px;}
\t\t\tdiv#helper{ display:none; position:absolute; left:0; width:250px; }
\t\t\tdiv#helper img{ float:right; max-width:250px; }
\t\t</style>
EOT;
}
示例2: getAllVersions_deprecated
public static function getAllVersions_deprecated($entityName, $int_id, $id, $fileName)
{
$c = strstr($fileName, '^') ? '^' : '&';
$parts = explode($c, $fileName);
if (count($parts) == 2 && strlen($parts[1])) {
// a template has no versions
$dir = '/content/templates/' . $entityName . '/';
$file_base = "";
//$parts[1];
return $dir . $file_base;
} else {
// $dir = '/content/'.$entityName.'/'.
// (intval($id / 1048576)).'/'.
// (intval($id / 1024) % 1024).'/';
//
$dir = '/content/' . $entityName . '/' . self::dirForId($int_id, $id, "");
$file_base = $id . '_';
//.$fileName;
}
$id_len = strlen($id . "_");
// iterate the directory and find all the files that start with $file_base
// the result will be tuples where the first element is the file's name, second is the file size
// TODO - use glob rather than dirListExtended
//$pattern = "|" . self::getFSContentRootPath(). "/" . $dir . "/^{$file_base}.*\.xml$";
$files = kFile::dirListExtended(self::getFSContentRootPath() . "/" . $dir, false, false, '/^' . $file_base . ".*\\.xml\$/");
if ($files == null) {
return null;
}
// from each file - strip the id and the file extension
// use the refernce to file_tuple - it will be modified
foreach ($files as &$file_tuple) {
// the file_name includes the id and the _, then the verson and finally the file extension
$file_version = substr(kFile::getFileNameNoExtension($file_tuple[0]), $id_len);
$file_tuple[] = $file_version;
// set the version in the forth place of the tuple.
}
if ($files == null) {
return null;
}
sort($files);
return $files;
}