request->urlParams; //$targetInfo = $this->request->post['target']; $response = new JSONResponse(); $prefix = "backend_ldap_"; $suffix = "_connector.xml"; $path = __DIR__ . "/../../formats/"; $files = scandir($path); $formats = array(); foreach ($files as $file) { if (!strncmp($file, $prefix, strlen($prefix)) && substr($file, - strlen($suffix)) === $suffix) { if (file_exists($path.$file)) { $format = simplexml_load_file ( $path.$file ); if ($format) { if (isset($format['name'])) { $formatId = substr($file, strlen($prefix), - strlen($suffix)); $formats[$formatId] = array('id' => $formatId, 'name' => (string)$format['name'], 'xml' => $format->asXML()); } } } } } return $response->setData($formats); } }