Same name in other branches
  1. 6.0.x src/Asset/AssetOptimizer.php \Drupal\advagg\Asset\AssetOptimizer::convertPathProtocolRelative()
  2. 8.x-3.x src/Asset/AssetOptimizer.php \Drupal\advagg\Asset\AssetOptimizer::convertPathProtocolRelative()
  3. 8.x-4.x 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;
}