You are here

function cdn_exit in CDN 6.2

Same name and namespace in other branches
  1. 5 cdn.module \cdn_exit()
  2. 6 cdn.module \cdn_exit()
  3. 7.2 cdn.module \cdn_exit()

Implementation of hook_exit().

File

./cdn.module, line 425

Code

function cdn_exit($destination = NULL) {

  // When the _cdn_devel_page_stats() function does not exist, there are no
  // stats to show, hence we can return immediately.
  // This can happen when the stats are disabled (for the current user or
  // entirely), or when a cached page is being served.
  if (!function_exists('_cdn_devel_page_stats')) {
    return;
  }

  // Try not to break non-HTML pages.
  if (function_exists('drupal_get_headers') && !strstr(drupal_get_headers(), 'html')) {
    return;
  }
  if (!$destination && variable_get(CDN_STATUS_VARIABLE, CDN_DISABLED) != CDN_DISABLED && variable_get(CDN_STATS_VARIABLE, FALSE) && user_access(CDN_PERM_ACCESS_STATS)) {
    list($file_count, $cdn_file_count, $synced_files_per_server_count, $total_time, $synced_files, $unsynced_files, ) = _cdn_devel_page_stats();
    print theme('cdn_page_stats', $file_count, $cdn_file_count, $synced_files_per_server_count, $total_time, $synced_files, $unsynced_files);
  }
}