You are here

public function SiteAuditCheckAbstract::getRelativePath in Site Audit 7

Same name and namespace in other branches
  1. 8.2 Check/Abstract.php \SiteAuditCheckAbstract::getRelativePath()

Gives path relative to DRUPAL_ROOT of the path is inside Drupal.

Parameters

string $filename: Absolute path of a file or directory.

Return value

string Path relative to Drupal root path.

File

Check/Abstract.php, line 291
Contains \SiteAudit\Check\Abstract.

Class

SiteAuditCheckAbstract
Class SiteAuditCheckAbstract.

Code

public function getRelativePath($filename) {
  $pos = strpos($filename, DRUPAL_ROOT);
  if ($pos !== FALSE) {
    $filename = substr($filename, $pos + strlen(DRUPAL_ROOT) + 1);
  }
  return $filename;
}