当前位置: 首页>>代码示例>>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;未经允许,请勿转载。