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


PHP files::tidyFileName方法代碼示例

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


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

示例1: name

 /**
 Creates a file from binary content.
 
 @param	name		<b>string</b>		File name (relative to working directory)
 @param	bits		<b>string</b>		Binary file content
 */
 public function uploadBits($name, $bits)
 {
     if (!$this->core->auth->check('media,media_admin', $this->core->blog->id)) {
         throw new Exception(__('Permission denied.'));
     }
     $name = files::tidyFileName($name);
     parent::uploadBits($name, $bits);
     return $this->createFile($name, null, null);
 }
開發者ID:HackerMajor,項目名稱:root,代碼行數:15,代碼來源:class.dc.media.php

示例2: newMediaObject

 private function newMediaObject($blog_id, $user, $pwd, $file)
 {
     if (empty($file['name'])) {
         throw new Exception('No file name');
     }
     if (empty($file['bits'])) {
         throw new Exception('No file content');
     }
     $file_name = $file['name'];
     $file_bits = base64_decode($file['bits']);
     $this->setUser($user, $pwd);
     $this->setBlog();
     $media = new dcMedia($this->core);
     $dir_name = path::clean(dirname($file_name));
     $file_name = basename($file_name);
     $dir_name = preg_replace('!^/!', '', $dir_name);
     if ($dir_name != '') {
         $dir = explode('/', $dir_name);
         $cwd = './';
         foreach ($dir as $v) {
             $v = files::tidyFileName($v);
             $cwd .= $v . '/';
             $media->makeDir($v);
             $media->chdir($cwd);
         }
     }
     $media_id = $media->uploadBits($file_name, $file_bits);
     $f = $media->getFile($media_id);
     return array('file' => $file_name, 'url' => $f->file_url, 'type' => files::getMimeType($file_name));
 }
開發者ID:nikrou,項目名稱:dotclear,代碼行數:30,代碼來源:class.dc.xmlrpc.php

示例3: name

 /**
 Creates a file from binary content.
 
 @param	name		<b>string</b>		File name (relative to working directory)
 @param	bits		<b>string</b>		Binary file content
 */
 public function uploadBits($name, $bits)
 {
     if (!$this->okt->checkPerm('media') && !$this->okt->checkPerm('media_admin')) {
         throw new Exception(__('Permission denied.'));
     }
     $name = files::tidyFileName($name);
     parent::uploadBits($name, $bits);
     return $this->createFile($name, null, null);
 }
開發者ID:jewelhuq,項目名稱:okatea,代碼行數:15,代碼來源:class.oktMedia.php


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