You are here

public function LeafletService::fileExists in Leaflet 2.0.x

Same name and namespace in other branches
  1. 2.1.x src/LeafletService.php \Drupal\leaflet\LeafletService::fileExists()

Check if a file exists.

Parameters

string $fileUrl: The file url.

Return value

bool The bool result.

1 call to LeafletService::fileExists()
LeafletService::setFeatureIconSizesIfEmptyOrInvalid in src/LeafletService.php
Set Feature Icon Size & Shadow Size If Empty or Invalid.

File

src/LeafletService.php, line 368

Class

LeafletService
Provides a LeafletService class.

Namespace

Drupal\leaflet

Code

public function fileExists($fileUrl) {
  $file_headers = @get_headers($fileUrl);
  if (stripos($file_headers[0], "404 Not Found") == 0 && (stripos($file_headers[0], "302 Found") == 0 && stripos($file_headers[7], "404 Not Found") == 0)) {
    return TRUE;
  }
  return FALSE;
}