You are here

function boost_transform_url in Boost 7

Given a URL give back eveything we know.

Parameters

$url: Full URL

$b_path: Base Path

6 calls to boost_transform_url()
boost_block_flush_form_submit in ./boost.blocks.inc
boost_block_view_status in ./boost.blocks.inc
@file Prints the cache status of the currently displayed page.
boost_cron in ./boost.module
Implements hook_cron(). Performs periodic actions.
boost_expire_cache in ./boost.module
Implements hook_expire_cache (from the 'expire' module)
boost_flush_caches in ./boost.module
Implements hook_flush_caches(). Deletes all static files.

... See full list

File

./boost.module, line 483
Caches generated output as a static file to be served directly from the webserver.

Code

function boost_transform_url($url = NULL, $b_path = NULL) {
  global $base_root, $base_path;
  $items =& drupal_static(__FUNCTION__);

  // Set defaults if none passed in.
  if ($url === NULL) {
    $url = $base_root . request_uri();
  }
  if ($b_path == NULL) {
    $b_path = $base_path;
  }
  $hash = $url . ' ' . $b_path;
  if (!isset($items[$hash])) {
    $parts = boost_parse_url($url, $b_path);
    if (!$parts) {
      $items[$hash] = array(
        'cache_this' => FALSE,
      );
      return $items[$hash];
    }
    $parts['base_dir'] = boost_get_normal_cache_dir() . '/' . $parts['host'] . $b_path;
    $parts['filename'] = $parts['base_dir'] . $parts['full_path'] . variable_get('boost_char', BOOST_CHAR) . $parts['query'];
    $parts['directory'] = dirname($parts['filename']);

    // Get the internal path (node/8).
    if (drupal_is_front_page()) {
      $parts['normal_path'] = variable_get('site_frontpage', 'node');
    }
    else {
      $parts['normal_path'] = drupal_get_normal_path($parts['path']);
    }

    // Get the alias (content/about-us).
    $parts['path_alias'] = drupal_get_path_alias($parts['normal_path']);

    // Get all args.
    $args = arg(NULL, $parts['normal_path']);

    // Prevent array warnings.
    $args[0] = empty($args[0]) ? '' : $args[0];
    $args[1] = empty($args[1]) ? '' : $args[1];
    $args[2] = empty($args[2]) ? '' : $args[2];
    $parts['args'] = $args;

    // Get content type.
    if (!empty($parts['normal_path'])) {
      $parts = _boost_get_menu_router($parts);
    }

    // See if url is cacheable.
    $parts = boost_is_cacheable($parts);
    $items[$hash] = $parts;
  }
  return $items[$hash];
}