mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
Move parsing of .php files (sic!) to _rfile for easier refactoring
Note that this arcane code comes from v0.2.0 beta:
5f0e6b03d4
This commit is contained in:
10
src/Csv.php
10
src/Csv.php
@@ -936,10 +936,6 @@ class Csv {
|
||||
$this->file = $file;
|
||||
}
|
||||
|
||||
if (preg_match('/\.php$/i', $file) && preg_match('/<\?.*?\?>(.*)/ms', $data, $strip)) {
|
||||
$data = ltrim($strip[1]);
|
||||
}
|
||||
|
||||
if (strpos($data, "\xef\xbb\xbf") === 0) {
|
||||
// strip off BOM (UTF-8)
|
||||
$data = substr($data, 3);
|
||||
@@ -1225,6 +1221,12 @@ class Csv {
|
||||
if ($data === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (preg_match('/\.php$/i', $file) && preg_match('/<\?.*?\?>(.*)/ms', $data, $strip)) {
|
||||
// Return section behind closing tags.
|
||||
$data = ltrim($strip[1]);
|
||||
}
|
||||
|
||||
return rtrim($data, "\r\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user