/** * Recursive files search * * @param string $path dir path * @param string $q search string * @param array $mimes * @return array * @author Naoki Sawada **/ protected function doSearch($path, $q, $mimes) { $result = array(); try { if ($path === '/') { $path = ''; } $res = $this->dropbox->search($q, null, $path); } catch (Dropbox_Exception $e) { return $this->setError('Dropbox error: ' . $e->getMessage()); } if ($res) { foreach ($res as $raw) { if ($stat = $this->parseRaw($raw)) { if ($stat['mime'] === 'directory' || !$this->mimeAccepted($stat['mime'], $mimes)) { continue; } $result[] = $this->stat($raw['path']); } } } return $result; }