本文整理汇总了PHP中OC_Filesystem::is_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Filesystem::is_dir方法的具体用法?PHP OC_Filesystem::is_dir怎么用?PHP OC_Filesystem::is_dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Filesystem
的用法示例。
在下文中一共展示了OC_Filesystem::is_dir方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scanFolder
/**
* scan a folder for music
* @param string $path
* @return int the number of songs found
*/
public static function scanFolder($path)
{
if (OC_Filesystem::is_dir($path)) {
$songs = 0;
if ($dh = OC_Filesystem::opendir($path)) {
while (($filename = readdir($dh)) !== false) {
if ($filename != '.' and $filename != '..' and substr($filename, 0, 1) != '.') {
$file = $path . '/' . $filename;
if (OC_Filesystem::is_dir($file)) {
$songs += self::scanFolder($file);
} elseif (OC_Filesystem::is_file($file)) {
$data = self::scanFile($file);
if ($data) {
$songs++;
}
}
}
}
}
} elseif (OC_Filesystem::is_file($path)) {
$songs = 1;
self::scanFile($path);
} else {
$songs = 0;
}
return $songs;
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:32,代码来源:owncloud_apps_media_lib_scanner.php
示例2: search
function search($query)
{
$files = OC_Filesystem::search($query);
$results = array();
foreach ($files as $file) {
if (OC_Filesystem::is_dir($file)) {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'index.php?dir=' . $file), 'Files');
} else {
$mime = OC_Filesystem::getMimeType($file);
$mimeBase = substr($mime, 0, strpos($mime, '/'));
switch ($mimeBase) {
case 'audio':
break;
case 'text':
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php?file=' . $file), 'Text');
break;
case 'image':
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php?file=' . $file), 'Images');
break;
default:
if ($mime == 'application/xml') {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php?file=' . $file), 'Text');
} else {
$results[] = new OC_Search_Result(basename($file), '', OC_Helper::linkTo('files', 'download.php?file=' . $file), 'Files');
}
}
}
}
return $results;
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:30,代码来源:owncloud_lib_search_provider_file.php
示例3: __construct
public function __construct($arguments)
{
$this->datadir = $arguments['datadir'];
if (OC_Share::getItemsInFolder($this->datadir)) {
if (!OC_Filesystem::is_dir($this->datadir)) {
OC_Filesystem::mkdir($this->datadir);
}
} else {
if (OC_Filesystem::is_dir($this->datadir)) {
OC_Filesystem::rmdir($this->datadir);
}
}
$this->datadir .= "/";
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:14,代码来源:owncloud_apps_files_sharing_sharedstorage.php
示例4: getChildren
/**
* Returns an array with all the child nodes
*
* @return Sabre_DAV_INode[]
*/
public function getChildren()
{
$nodes = array();
// foreach(scandir($this->path) as $node) if($node!='.' && $node!='..') $nodes[] = $this->getChild($node);
if (OC_Filesystem::is_dir($this->path . '/')) {
$dh = OC_Filesystem::opendir($this->path . '/');
while (($node = readdir($dh)) !== false) {
if ($node != '.' && $node != '..') {
$nodes[] = $this->getChild($node);
}
}
}
return $nodes;
}
示例5: handleStoreSettings
function handleStoreSettings($root, $order)
{
if (!OC_Filesystem::file_exists($root)) {
OCP\JSON::error(array('cause' => 'No such file or directory'));
return;
}
if (!OC_Filesystem::is_dir($root)) {
OCP\JSON::error(array('cause' => $root . ' is not a directory'));
return;
}
$current_root = OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '/');
$root = trim($root);
$root = rtrim($root, '/') . '/';
$rescan = $current_root == $root ? 'no' : 'yes';
OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'root', $root);
OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'order', $order);
OCP\JSON::success(array('rescan' => $rescan));
}
示例6: zipAddDir
public static function zipAddDir($dir, $zip, $internalDir = '')
{
$dirname = basename($dir);
$zip->addEmptyDir($internalDir . $dirname);
$internalDir .= $dirname .= '/';
$files = OC_Files::getdirectorycontent($dir);
foreach ($files as $file) {
$filename = $file['name'];
$file = $dir . '/' . $filename;
if (OC_Filesystem::is_file($file)) {
$tmpFile = OC_Filesystem::toTmpFile($file);
OC_Files::$tmpFiles[] = $tmpFile;
$zip->addFile($tmpFile, $internalDir . $filename);
} elseif (OC_Filesystem::is_dir($file)) {
self::zipAddDir($file, $zip, $internalDir);
}
}
}
示例7: isset
require_once '../lib/base.php';
// Check if we are a user
OC_Util::checkLoggedIn();
// Load the files we need
OC_Util::addStyle("files", "files");
OC_Util::addScript("files", "files");
OC_Util::addScript('files', 'filelist');
OC_Util::addScript('files', 'fileactions');
if (!isset($_SESSION['timezone'])) {
OC_Util::addScript('files', 'timezone');
}
OC_App::setActiveNavigationEntry("files_index");
// Load the files
$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
// Redirect if directory does not exist
if (!OC_Filesystem::is_dir($dir . '/')) {
header("Location: " . $_SERVER['PHP_SELF'] . "");
}
$files = array();
foreach (OC_Files::getdirectorycontent($dir) as $i) {
$i["date"] = OC_Util::formatDate($i["mtime"]);
if ($i['type'] == 'file') {
$fileinfo = pathinfo($i['name']);
$i['basename'] = $fileinfo['filename'];
if (!empty($fileinfo['extension'])) {
$i['extention'] = '.' . $fileinfo['extension'];
} else {
$i['extention'] = '';
}
}
if ($i['directory'] == '/') {
示例8: array
// download the whole shared directory
OC_Files::get($path, '', $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
}
}
} else {
// download a single shared file
OC_Files::get("", $path, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
}
} else {
OCP\Util::addStyle('files_sharing', 'public');
OCP\Util::addScript('files_sharing', 'public');
OCP\Util::addScript('files', 'fileactions');
$tmpl = new OCP\Template('files_sharing', 'public', 'base');
$tmpl->assign('owner', $uidOwner);
// Show file list
if (OC_Filesystem::is_dir($path)) {
OCP\Util::addStyle('files', 'files');
OCP\Util::addScript('files', 'files');
OCP\Util::addScript('files', 'filelist');
$files = array();
$rootLength = strlen($baseDir) + 1;
foreach (OC_Files::getDirectoryContent($path) as $i) {
$i['date'] = OCP\Util::formatDate($i['mtime']);
if ($i['type'] == 'file') {
$fileinfo = pathinfo($i['name']);
$i['basename'] = $fileinfo['filename'];
$i['extension'] = isset($fileinfo['extension']) ? '.' . $fileinfo['extension'] : '';
}
$i['directory'] = '/' . substr('/' . $uidOwner . '/files' . $i['directory'], $rootLength);
if ($i['directory'] == '/') {
$i['directory'] = '';
示例9: dirname
$base = $query;
} else {
$base = dirname($query);
}
$query = substr($query, strlen($base));
if ($base != '/') {
$query = substr($query, 1);
}
$queryLen = strlen($query);
$query = strtolower($query);
// echo "$base - $query";
$files = array();
if (OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)) {
$dh = OC_Filesystem::opendir($base);
if ($dh) {
if (substr($base, -1, 1) != '/') {
$base = $base . '/';
}
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != "..") {
if (substr(strtolower($file), 0, $queryLen) == $query) {
$item = $base . $file;
if (!$dirOnly or OC_Filesystem::is_dir($item)) {
$files[] = (object) array('id' => $item, 'label' => $item, 'name' => $item);
}
}
}
}
}
}
OC_JSON::encodedPrint($files);
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_files_ajax_autocomplete.php
示例10: substr
if ($source !== false) {
// TODO Manipulating the string may not be the best choice. Is there an alternative?
$user = substr($source, 1, strpos($source, "/", 1) - 1);
OC_Util::setupFS($user);
$source = substr($source, strlen("/" . $user . "/files"));
$subPath = isset($_GET['path']) ? $_GET['path'] : '';
$root = $source;
$source .= $subPath;
if (!OC_Filesystem::file_exists($source)) {
header("HTTP/1.0 404 Not Found");
$tmpl = new OC_Template("", "404", "guest");
$tmpl->assign("file", $subPath);
$tmpl->printPage();
exit;
}
if (OC_Filesystem::is_dir($source)) {
$files = array();
$rootLength = strlen($root);
foreach (OC_Files::getdirectorycontent($source) as $i) {
$i['date'] = OC_Util::formatDate($i['mtime']);
if ($i['type'] == 'file') {
$fileinfo = pathinfo($i['name']);
$i['basename'] = $fileinfo['filename'];
$i['extention'] = isset($fileinfo['extension']) ? '.' . $fileinfo['extension'] : '';
}
$i['directory'] = substr($i['directory'], $rootLength);
if ($i['directory'] == "/") {
$i['directory'] = "";
}
$files[] = $i;
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_files_sharing_get.php
示例11: findMusic
function findMusic($path = '')
{
$music = array();
$dh = OC_Filesystem::opendir($path);
if ($dh) {
while ($filename = readdir($dh)) {
if ($filename[0] != '.') {
$file = $path . '/' . $filename;
if (OC_Filesystem::is_dir($file)) {
$music = array_merge($music, findMusic($file));
} else {
if (OC_MEDIA_SCANNER::isMusic($filename)) {
$music[] = $file;
}
}
}
}
}
return $music;
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:20,代码来源:owncloud_apps_media_ajax_api.php
示例12: strtolower
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once '../../../../lib/base.php';
OC_JSON::checkAppEnabled('ocdownloader');
OC_JSON::checkLoggedIn();
if (!OC_Filesystem::is_dir('/Downloads')) {
OC_Filesystem::mkdir('/Downloads');
}
$pr = $_POST['pr'];
switch ($pr) {
case 'web':
$k = OC_ocDownloaderFile::getHttpFile($_POST['url']);
break;
default:
if (preg_match('/^pr_([0-9]{1,4})$/', $pr, $m)) {
$pr_name = OC_ocDownloader::getProvider($m[1]);
$user_info = OC_ocDownloader::getUserProviderInfo($m[1]);
$pr_name = strtolower($pr_name['pr_name']);
if (file_exists(OC::$SERVERROOT . '/apps/ocdownloader/providers/' . $pr_name . '.php')) {
require_once OC::$SERVERROOT . '/apps/ocdownloader/providers/' . $pr_name . '.php';
}
示例13: is_valid_casestudy
function is_valid_casestudy($dir)
{
$musthavedirs = array("/data", "/pipeline", "/results");
foreach ($musthavedirs as $subdir) {
if (!OC_Filesystem::is_dir($dir . $subdir)) {
return "Missing subdir {$subdir}";
}
}
return null;
}