Exemplo n.º 1
0
 public function process()
 {
     $props = $this->getProperties();
     if (is_dir($props['dirPath'])) {
         $props['dir'] = $props['dirPath'];
         $dirRemove = $this->modx->runProcessor('browser/directory/remove', $props);
         if ($dirRemove) {
             $response = $dirRemove->getResponse();
             return $response;
         }
     } else {
         $response = parent::process();
         return $response;
     }
 }
Exemplo n.º 2
0
 public function process()
 {
     $props = $this->getProperties();
     $paths = @explode(',', $props['paths']);
     $responses = array();
     $errors = array();
     foreach ($paths as $path) {
         if (is_dir($path)) {
             $props['dir'] = $path;
             $dirRemove = $this->modx->runProcessor('browser/directory/remove', $props);
             if ($dirRemove) {
                 $responses[] = $dirRemove->getResponse();
             } else {
                 $errors[] = $dirRemove->getMessage();
             }
         } else {
             $path = str_replace(MODX_BASE_PATH, '', $path);
             $this->setProperty('file', $path);
             $fileRemove = parent::process();
             if ($fileRemove) {
                 $responses[] = $fileRemove;
             } else {
                 $errors[] = $dirRemove->getMessage();
             }
         }
     }
     $output = array('success' => '', 'message' => '', 'total' => 0, 'errors' => array(), 'object' => array());
     if (!empty($responses) || !empty($errors)) {
         $output['success'] = 1;
         $output['total'] = count($responses);
         foreach ($responses as $res) {
             $output['object'][] = $res;
         }
         foreach ($errors as $err) {
             $output['errors'][] = $err;
         }
     }
     return $output;
 }
Exemplo n.º 3
0
 public function initialize()
 {
     $this->setProperty('file', $this->getProperty('path'));
     return parent::initialize();
 }