You are here

function services_crossdomain_xml in Services 6.2

Same name and namespace in other branches
  1. 5 services.module \services_crossdomain_xml()
  2. 6 services.module \services_crossdomain_xml()
  3. 7 services.module \services_crossdomain_xml()

Callback for crossdomain.xml

1 string reference to 'services_crossdomain_xml'
services_menu in ./services.module
Implementation of hook_menu().

File

./services.module, line 152
Provides a generic but powerful API for exposing web services.

Code

function services_crossdomain_xml() {
  global $base_url;
  $output = '<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">' . "\n";
  $output .= '<cross-domain-policy>' . "\n";
  $output .= '  <allow-access-from domain="' . check_plain($_SERVER['HTTP_HOST']) . '" />' . "\n";
  $output .= '  <allow-access-from domain="*.' . check_plain($_SERVER['HTTP_HOST']) . '" />' . "\n";
  $keys = function_exists('services_keyauth_get_keys') ? services_keyauth_get_keys() : array();
  foreach ($keys as $key) {
    if (!empty($key->domain)) {
      $output .= '  <allow-access-from domain="' . check_plain($key->domain) . '" />' . "\n";
      $output .= '  <allow-access-from domain="*.' . check_plain($key->domain) . '" />' . "\n";
    }
  }
  $output .= '</cross-domain-policy>';
  services_xml_output($output);
}