本文整理汇总了PHP中modMediaSource::removeObject方法的典型用法代码示例。如果您正苦于以下问题:PHP modMediaSource::removeObject方法的具体用法?PHP modMediaSource::removeObject怎么用?PHP modMediaSource::removeObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modMediaSource
的用法示例。
在下文中一共展示了modMediaSource::removeObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
$file = $this->getProperty('file');
if (empty($file)) {
return $this->modx->error->failure($this->modx->lexicon('file_err_ns'));
}
$loaded = $this->getSource();
if (!$this->source instanceof modMediaSource) {
return $loaded;
}
$success = $this->source->removeObject($file);
if (empty($success)) {
$msg = '';
$errors = $this->source->getErrors();
foreach ($errors as $k => $msg) {
$this->addFieldError($k, $msg);
}
return $this->failure();
}
return $this->success();
}
示例2: process
public function process()
{
$file = $this->getProperty('file');
if (empty($file)) {
return $this->modx->error->failure($this->modx->lexicon('file_err_ns'));
}
$loaded = $this->getSource();
if (!$this->source instanceof modMediaSource) {
return $loaded;
}
if (!$this->source->checkPolicy('remove')) {
return $this->failure($this->modx->lexicon('permission_denied'));
}
$success = $this->source->removeObject($file);
if (empty($success)) {
$errors = $this->source->getErrors();
$msg = implode("\n", $errors);
return $this->failure($msg);
}
return $this->success();
}
示例3: remove
/**
* @param array $ancestors
*
* @return bool
*/
public function remove(array $ancestors = array())
{
$filename = $this->get('path') . $this->get('file');
if ($this->prepareSource()) {
$this->mediaSource->removeObject($filename);
if (!empty($this->mediaSource->errors['file'])) {
$this->xpdo->log(xPDO::LOG_LEVEL_ERROR, '[Uploadify] Could not remove file at "' . $filename . '": ' . $this->mediaSource->errors['file']);
}
}
$children = $this->xpdo->getIterator('uFile', array('parent' => $this->get('id')));
/** @var uFile $child */
foreach ($children as $child) {
$child->remove();
}
return parent::remove($ancestors);
}