You are here

function imagecrop_deliver_page in Image javascript crop 7

Deliver the imagecrop page. By using an own deliver callback, we make sure no other modules (ex: panels everywhere) add extra stuff to the page.

1 string reference to 'imagecrop_deliver_page'
imagecrop_menu in ./imagecrop.module
Implements hook_menu().

File

./imagecrop.module, line 760
Provides a javascript toolbox through an imagecache action.

Code

function imagecrop_deliver_page($page_callback_result) {

  // Emit the correct charset HTTP header, but not if the page callback
  // result is NULL, since that likely indicates that it printed something
  // in which case, no further headers may be sent, and not if code running
  // for this page request has already set the content type header.
  if (isset($page_callback_result) && is_null(drupal_get_http_header('Content-Type'))) {
    drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
  }

  // Send appropriate HTTP-Header for browsers and search engines.
  global $language;
  drupal_add_http_header('Content-Language', $language->language);

  // Menu status constants are integers; page content is a string or array.
  if (is_int($page_callback_result)) {
    drupal_deliver_html_page($page_callback_result);
  }
  elseif (isset($page_callback_result)) {
    $main_content_display =& drupal_static('system_main_content_added', FALSE);
    drupal_set_page_content($page_callback_result);
    $page = element_info('page');

    // If no module has taken care of the main content, add it to the page now.
    // This allows the site to still be usable even if no modules that
    // control page regions (for example, the Block module) are enabled.
    if (!$main_content_display) {
      $page['content']['system_main'] = drupal_set_page_content();
    }

    // Render immediately. By not executing hooks, blocks are not added.
    print drupal_render($page);
  }

  // Perform end-of-request tasks.
  drupal_page_footer();
}