Last change
on this file since 7642 was 7640, checked in by Pieter Naber, 15 years ago |
KMLFile can read from the node location file provided. It parses the file into nodes.
|
File size:
1.1 KB
|
Rev | Line | |
---|
[7620] | 1 | <?
|
---|
| 2 | /*
|
---|
| 3 | * Project: NodeMap2.0
|
---|
| 4 | * File: FileHandler.class.php
|
---|
| 5 | * Purpose: Checking and reading node files from the server
|
---|
| 6 | */
|
---|
| 7 |
|
---|
| 8 | class FileHandler {
|
---|
[7621] | 9 | private $file;
|
---|
| 10 |
|
---|
| 11 | /*
|
---|
| 12 | * Function: __construct (constructor)
|
---|
| 13 | * Parameters: string $filename
|
---|
| 14 | * Function: Handling with a node file
|
---|
| 15 | */
|
---|
[7631] | 16 | public function __construct($filename) {
|
---|
[7621] | 17 | try {
|
---|
[7637] | 18 | trigger_log(SYSLOG_DEBUG, 'Opening the file "' . $filename . '"', __FILE__, __LINE__);
|
---|
[7631] | 19 | $handle = fopen($filename, 'r');
|
---|
[7637] | 20 |
|
---|
| 21 | trigger_log(SYSLOG_DEBUG, 'Reading from file "' . $filename . '"', __FILE__, __LINE__);
|
---|
[7631] | 22 | $this->file = '';
|
---|
| 23 | while (!feof($handle)) {
|
---|
| 24 | $this->file .= fread($handle, 8192);
|
---|
| 25 | }
|
---|
[7637] | 26 |
|
---|
| 27 | trigger_log(SYSLOG_DEBUG, 'Closing file "' . $filename . '"', __FILE__, __LINE__);
|
---|
[7631] | 28 | fclose($handle);
|
---|
[7637] | 29 |
|
---|
| 30 | trigger_log(SYSLOG_INFO, 'Reading from file "' . $filename . '" is done', __FILE__, __LINE__);
|
---|
[7621] | 31 | } catch (Exception $err) {
|
---|
[7637] | 32 | trigger_log(SYSLOG_ERR, 'Reading from file "' . $filename . '" failed', __FILE__, __LINE__);
|
---|
[7621] | 33 | }
|
---|
[7631] | 34 | }
|
---|
[7622] | 35 |
|
---|
[7631] | 36 | public function getFile() {
|
---|
| 37 | return $this->file;
|
---|
[7621] | 38 | }
|
---|
[7620] | 39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.