當前位置: 首頁>>代碼示例>>PHP>>正文


PHP OC_Filesystem::is_writeable方法代碼示例

本文整理匯總了PHP中OC_Filesystem::is_writeable方法的典型用法代碼示例。如果您正苦於以下問題:PHP OC_Filesystem::is_writeable方法的具體用法?PHP OC_Filesystem::is_writeable怎麽用?PHP OC_Filesystem::is_writeable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OC_Filesystem的用法示例。


在下文中一共展示了OC_Filesystem::is_writeable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getDirectoryContent

 /**
  * get the content of a directory
  * @param dir $directory
  */
 public static function getDirectoryContent($directory)
 {
     if (strpos($directory, OC::$CONFIG_DATADIRECTORY) === 0) {
         $directory = substr($directory, strlen(OC::$CONFIG_DATADIRECTORY));
     }
     $filesfound = true;
     $content = array();
     $dirs = array();
     $file = array();
     $files = array();
     if (OC_Filesystem::is_dir($directory)) {
         if ($dh = OC_Filesystem::opendir($directory)) {
             while (($filename = readdir($dh)) !== false) {
                 if ($filename != '.' and $filename != '..' and substr($filename, 0, 1) != '.') {
                     $file = array();
                     $filesfound = true;
                     $file['name'] = $filename;
                     $file['directory'] = $directory;
                     $stat = OC_Filesystem::stat($directory . '/' . $filename);
                     $file = array_merge($file, $stat);
                     $file['size'] = OC_Filesystem::filesize($directory . '/' . $filename);
                     $file['mime'] = OC_Files::getMimeType($directory . '/' . $filename);
                     $file['readable'] = OC_Filesystem::is_readable($directory . '/' . $filename);
                     $file['writeable'] = OC_Filesystem::is_writeable($directory . '/' . $filename);
                     $file['type'] = OC_Filesystem::filetype($directory . '/' . $filename);
                     if ($file['type'] == 'dir') {
                         $dirs[$file['name']] = $file;
                     } else {
                         $files[$file['name']] = $file;
                     }
                 }
             }
             closedir($dh);
         }
     }
     uksort($dirs, "strnatcasecmp");
     uksort($files, "strnatcasecmp");
     $content = array_merge($dirs, $files);
     if ($filesfound) {
         return $content;
     } else {
         return false;
     }
 }
開發者ID:Teino1978-Corp,項目名稱:Teino1978-Corp-owncloud_.htaccess-,代碼行數:48,代碼來源:owncloud_lib_files.php

示例2:

// load required style sheets:
OC_Util::addStyle('files_svgedit', 'ocsvg');
// load required javascripts:
OC_Util::addScript('files_svgedit', 'svg-edit/embedapi');
OC_Util::addScript('files_svgedit', 'ocsvgEditor');
OC_Util::addScript('files_svgedit', 'canvg/canvg');
OC_Util::addScript('files_svgedit', 'canvg/rgbcolor');
OC_Util::addScript('files_svgedit', 'base64');
//OC_Util::addScript('files_svgedit', 'jsPDF/libs/sprintf');
//OC_Util::addScript('files_svgedit', 'jsPDF/jspdf');
OC_Util::addScript('files_svgedit', 'jsPDF/jspdf.min');
OC_Util::addScript('files_svgedit', 'svgToPdf');
OC_App::setActiveNavigationEntry('files_index');
$path = $_GET['file'];
if (method_exists('OC_Filesystem', 'is_writable')) {
    $writable = OC_Filesystem::is_writable($path);
} else {
    $writable = OC_Filesystem::is_writeable($path);
}
if (isset($_GET['file']) and $writable) {
    $filecontents = OC_Filesystem::file_get_contents($path);
    $filemtime = OC_Filesystem::filemtime($path);
} else {
    $filecontents = "";
    $filemtime = 0;
}
$tmpl = new OC_TEMPLATE("files_svgedit", "editor", "user");
$tmpl->assign('fileContents', json_encode($filecontents));
$tmpl->assign('filemTime', $filemtime);
$tmpl->assign('filePath', json_encode($path));
$tmpl->printPage();
開發者ID:blablubli,項目名稱:owncloudapps,代碼行數:31,代碼來源:index.php


注:本文中的OC_Filesystem::is_writeable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。