You are here

protected function PHPExcel_Reader_SYLK::_isValidFormat in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/SYLK.php \PHPExcel_Reader_SYLK::_isValidFormat()

* Validate that the current file is a SYLK file * *

Return value

boolean

2 calls to PHPExcel_Reader_SYLK::_isValidFormat()
PHPExcel_Reader_SYLK::listWorksheetInfo in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/SYLK.php
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns) * *
PHPExcel_Reader_SYLK::loadIntoExisting in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/SYLK.php
* Loads PHPExcel from file into PHPExcel instance * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/SYLK.php, line 87

Class

PHPExcel_Reader_SYLK
PHPExcel_Reader_SYLK

Code

protected function _isValidFormat() {

  // Read sample data (first 2 KB will do)
  $data = fread($this->_fileHandle, 2048);

  // Count delimiters in file
  $delimiterCount = substr_count($data, ';');
  if ($delimiterCount < 1) {
    return FALSE;
  }

  // Analyze first line looking for ID; signature
  $lines = explode("\n", $data);
  if (substr($lines[0], 0, 4) != 'ID;P') {
    return FALSE;
  }
  return TRUE;
}