本文整理汇总了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);
}
示例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));
}
示例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);
}