You are here

function boost_file_path in Boost 6

Same name and namespace in other branches
  1. 5 boost.api.inc \boost_file_path()

Returns the static file path for a Drupal page.

Parameters

$path: path to convert to boost's file naming convention

$query: add query to path

$extension: add extension to end of filename

$file_path: Optional: BOOST_FILE_PATH

$path = $GLOBALS['_boost_path'] most of the time

13 calls to boost_file_path()
boost_block in ./boost.module
Implementation of hook_block().
boost_block_flush_form in ./boost.module
boost_cache_expire_by_db in ./boost.module
Expires the static file cache for the given paths via database.
boost_cache_expire_by_filename in ./boost.module
Expires the static file cache for paths matching a wildcard via filesystem.
boost_cache_get in ./boost.module
Returns the cached contents of the specified page, if available.

... See full list

2 string references to 'boost_file_path'
boost_admin_boost_performance_page_validate in ./boost.admin.inc
validate boost_admin_boost_performance_page form submissions.
boost_cache_directory in ./boost.module
Returns the full directory path to the static file cache directory.

File

./boost.module, line 4536
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_file_path($path, $query = TRUE, $extension = BOOST_FILE_EXTENSION, $file_path = NULL) {

  //handling of url variables
  if ($GLOBALS['_boost_query'] != BOOST_CHAR) {
    if ($query) {
      $path .= $GLOBALS['_boost_query'];
    }
    else {
      $path .= BOOST_CHAR;
    }
  }
  else {
    $path .= $GLOBALS['_boost_query'];
  }

  // 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;
  }
  $file_path = is_null($file_path) ? BOOST_FILE_PATH : $file_path;
  return implode('/', array(
    $file_path,
    $path . (is_null($extension) ? '' : $extension),
  ));
}