API:mapPath

From MODx Wiki
Jump to: navigation, search

Overview

Returns the physical path from the supplied virtual path.

This function has been removed from the API as of version 0.9.6.2 RC2.

Use the contstants instead:

MODX_BASE_PATH

MODX_BASE_URL

MODX_SITE_URL

MODX_MANAGER_PATH

MODX_MANAGER_URL


Source Code

File: manager/includes/document.parser.class.inc.php
Line: 1910
  1. function mapPath($path, $filename= "") {
  2. if (!$path)
  3. $path= ".";
  4. if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
  5. // only on windows?
  6. $absPath= str_replace("\\", "/", realpath($path));
  7. return $absPath . ($absPath && $filename ? "/$filename" : "$filename");
  8. } else {
  9. // determine base path
  10. if (substr($path, 0, 1) == "/")
  11. $basePath= $_SERVER['DOCUMENT_ROOT'];
  12. else
  13. $basePath= dirname($_SERVER['SCRIPT_FILENAME']);
  14. // return absolute path
  15. $absPath= realpath("$basePath/$path");
  16. return $absPath . ($absPath && $filename ? "/$filename" : "$filename");
  17. }
  18. }
Personal tools