You are here

function stage_file_proxy_init in Stage File Proxy 7

Same name and namespace in other branches
  1. 6 stage_file_proxy.module \stage_file_proxy_init()

Implements hook_init().

Intercepts some requests and hotlinks/downloads the remote version.

File

./stage_file_proxy.module, line 13
Stage File Proxy Module.

Code

function stage_file_proxy_init() {
  if (drupal_is_cli()) {
    return;
  }
  if ($uri = _stage_file_proxy_get_current_file_uri()) {
    if ($new_uri = stage_file_proxy_process_file_uri($uri)) {
      header("Location: " . file_create_url($new_uri));
      exit;
    }
  }
}