本文整理汇总了PHP中file::multipleDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP file::multipleDelete方法的具体用法?PHP file::multipleDelete怎么用?PHP file::multipleDelete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file
的用法示例。
在下文中一共展示了file::multipleDelete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execIndex
protected function execIndex(array $prm = array()) {
$this->prepare();
$pattern = FILESROOT.$this->dir.DS.'*';
$search = http_vars::getInstance()->get('search');
if ($search) {
$pattern.= strtolower($search).'*';
$this->uri.= 'search='.$search.'&';
}
$delete = http_vars::getInstance()->get('delete');
if ($delete) {
$file = FILESROOT.urldecode($delete);
if (file::exists($file)) {
file::delete($file);
file::multipleDelete(substr($file, 0, -strlen(file::getExt($file))-1).'_*');
response::getInstance()->redirect($this->uri);
}
}
$form = $this->getForm();
if (request::isPost()) {
$form->refill();
if ($form->isValid())
response::getInstance()->sendText('ok');
}
$files = array();
foreach(file::search($pattern) as $f) {
if (strpos($f, 'nyroBrowserThumb') === false) {
$name = basename($f);
if ($this->type == 'image' && strlen($name) > 15)
$name = substr($name, 0, 15).'...'.file::getExt($f);
$files[] = array(
$f,
request::uploadedUri(str_replace(FILESROOT, '', $f), $this->myCfg['uploadedUri']),
$name,
file::humanSize($f),
utils::formatDate(filemtime($f)),
$this->uri.'delete='.urlencode(str_replace(FILESROOT, '', $f)).'&'
);
}
}
$this->setViewVars(array(
'uri'=>$this->uri,
'form'=>$form,
'config'=>$this->config,
'type'=>$this->type,
'files'=>$files,
'searchButton'=>$this->myCfg['search'],
'search'=>$search,
'imgHelper'=>$this->myCfg['imgHelper'],
'filesTitle'=>$this->myCfg['filesTitle'],
'noFiles'=>$this->myCfg['noFiles'],
'name'=>$this->myCfg['name'],
'size'=>$this->myCfg['size'],
'date'=>$this->myCfg['date'],
'delete'=>$this->myCfg['delete'],
));
}
示例2: delete
/**
* Delete the eventual thumbnail created for an image
* Used in form_fileUploaded
*
* @param string $file The image uploaded
* @param array $prm The parameter for the image
*/
public function delete($file, array $prm = null)
{
file::delete($this->addFilesRootIfNeeded($file));
file::multipleDelete($this->addFilesRootIfNeeded($this->makePath($file, '*')), '@' . str_replace('\\', '\\\\', $this->addFilesRootIfNeeded($this->makePath($file, '([^_]*)'))) . '$@i');
}