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


PHP modMediaSource::removeObject方法代碼示例

本文整理匯總了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();
 }
開發者ID:rosstimson,項目名稱:revolution,代碼行數:21,代碼來源:remove.class.php

示例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();
 }
開發者ID:ChrstnMgcn,項目名稱:revolution,代碼行數:21,代碼來源:remove.class.php

示例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);
 }
開發者ID:bendasvadim,項目名稱:modx-uploadify,代碼行數:21,代碼來源:ufile.class.php


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