CrossdomainController.php in Crossdomain 8
File
lib/Drupal/crossdomain/Controller/CrossdomainController.php
View source
<?php
namespace Drupal\crossdomain\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Response;
class CrossdomainController extends ControllerBase {
public function view() {
$xml = "<?xml version=\"1.0\"?>\n\n<cross-domain-policy>\n";
$domains = $this
->entityManager()
->getStorageController('crossdomain')
->loadMultiple();
foreach ($domains as $domain) {
$xml .= ' <allow-access-from domain="' . $domain
->label() . '" />' . "\n";
}
$xml .= '</cross-domain-policy>';
$headers = array(
'Content-Length' => strlen($xml),
'Content-Type' => 'text/xml',
);
return new Response($xml, 200, $headers);
}
}