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; } }
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; }
public function initialize() { $this->setProperty('file', $this->getProperty('path')); return parent::initialize(); }