You are here

protected function StaticGenerator::sanitizePath in Tome 8

Sanitizes a given path by removing hashes, get params, and extra slashes.

Parameters

string $path: The path.

Return value

string The sanitized path.

3 calls to StaticGenerator::sanitizePath()
StaticGenerator::exportPaths in modules/tome_static/src/StaticGenerator.php
Exports multiple paths.
StaticGenerator::getDestination in modules/tome_static/src/StaticGenerator.php
Returns a destination for saving a given path.
StaticGenerator::getRealPaths in modules/tome_static/src/StaticGenerator.php
Turns relative paths into absolute paths.

File

modules/tome_static/src/StaticGenerator.php, line 504

Class

StaticGenerator
Handles static site generation.

Namespace

Drupal\tome_static

Code

protected function sanitizePath($path) {
  $path = preg_replace([
    '/\\?.*/',
    '/#.*/',
  ], '', $path);
  return ltrim($path, '/');
}