You are here

function boost_file_path in Boost 5

Same name and namespace in other branches
  1. 6 boost.module \boost_file_path()

Returns the static file path for a Drupal page.

4 calls to boost_file_path()
boost_cache_expire in ./boost.api.inc
Expires the static file cache for a given page, or multiple pages matching a wildcard.
boost_cache_get in ./boost.api.inc
Returns the cached contents of the specified page, if available.
boost_cache_set in ./boost.api.inc
Replaces the cached contents of the specified page, if stale.
boost_is_cached in ./boost.api.inc
Determines whether a given Drupal page is currently cached or not.
1 string reference to 'boost_file_path'
boost_init in ./boost.module
Implementation of hook_init(). Performs page setup tasks.

File

./boost.api.inc, line 174
Implements the Boost API for static page caching.

Code

function boost_file_path($path) {
  if (empty($path) || $path == BOOST_FRONTPAGE) {
    $path = 'index';

    // special handling for Drupal's front page
  }

  // Under no circumstances should the incoming path contain '..' or null
  // bytes; we also limit the maximum directory nesting depth of the path
  if (strpos($path, '..') !== FALSE || strpos($path, "\0") !== FALSE || count(explode('/', $path)) > BOOST_MAX_PATH_DEPTH) {
    return FALSE;
  }

  // Convert any other undesirable characters in the path to underscores
  $path = preg_replace('@[^/a-z0-9_-]@i', '_', $path);
  return boost_cache_directory() . '/' . $path . BOOST_FILE_EXTENSION;
}