You are here

protected function AssetOptimizer::convertPathProtocolRelative in Advanced CSS/JS Aggregation 8.4

Same name and namespace in other branches
  1. 8.3 src/Asset/AssetOptimizer.php \Drupal\advagg\Asset\AssetOptimizer::convertPathProtocolRelative()

Converts absolute paths to be protocol relative paths.

Parameters

string $path: Path to check.

Return value

string The converted path or the original path if already protocol relative.

1 call to AssetOptimizer::convertPathProtocolRelative()
AssetOptimizer::processAssetArray in src/Asset/AssetOptimizer.php
Process a core asset array.

File

src/Asset/AssetOptimizer.php, line 399

Class

AssetOptimizer
Defines the base AdvAgg optimizer.

Namespace

Drupal\advagg\Asset

Code

protected function convertPathProtocolRelative($path) {
  if (strpos($path, 'https://') === 0) {
    $path = substr($path, 6);
  }
  elseif (strpos($path, 'http://') === 0) {
    $path = substr($path, 5);
  }
  return $path;
}