You are here

function hosting_js_page in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.module \hosting_js_page()
  2. 7.3 hosting.module \hosting_js_page()

Page callback for a page to be rendered in modal frame.

1 string reference to 'hosting_js_page'
hosting_menu in ./hosting.module
Implementation of hook_menu().

File

./hosting.module, line 108
Hosting module.

Code

function hosting_js_page() {
  modalframe_child_js();
  $args = func_get_args();
  $path = implode('/', $args);

  // Incase Aegir is running in a sub-directory the base_path should be stripped away here
  //    Remove the leading slash from base_path as $path doesn't have one either
  $path = str_replace(ltrim(base_path(), '/'), '', $path);
  menu_set_active_item($path);

  #  $_SERVER['REQUEST_URI'] = str_replace('/hosting/js', '', $_SERVER['REQUEST_URI']);
  if ($router_item = menu_get_item($path)) {
    if ($router_item['access']) {
      if ($router_item['file']) {
        require_once $router_item['file'];
      }
      $return = call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
    }
    else {
      $return = drupal_access_denied();
    }
  }

  // Menu status constants are integers; page content is a string.
  if (is_int($return)) {
    modalframe_close_dialog();
  }
  return $return;
}