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:
Fonata
2021-04-02 21:06:15 +02:00
committed by Fonata
parent 8277b9682d
commit 6a54a6a509

View File

@@ -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");
}