| 1 | <?php |
||
| 11 | class Page |
||
| 12 | { |
||
| 13 | use LoggedClassTrait; |
||
| 14 | |||
| 15 | protected $contents; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Sets the Page's contents to the contents of a file |
||
| 19 | * |
||
| 20 | * @param string $contents The path to the file containing the page's contents |
||
| 21 | * @return bool Returns true if the file exists |
||
| 22 | * Returns false if the file does not exist |
||
| 23 | */ |
||
| 24 | 3 | public function setContents($contents) |
|
| 25 | { |
||
| 26 | 3 | $contents_exist = file_exists($contents); |
|
| 27 | |||
| 28 | 3 | if ($contents_exist) { |
|
| 29 | 2 | $this->contents = file_get_contents($contents); |
|
| 30 | |||
| 31 | 2 | $this->updateLog("info", "Page contents set from {$contents}"); |
|
| 32 | 2 | } else { |
|
| 33 | 1 | $this->contents = false; |
|
| 34 | |||
| 35 | 1 | $this->updateLog("alert", "File {$contents} not found"); |
|
| 36 | } |
||
| 37 | |||
| 38 | 3 | return $contents_exist; |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Echos the contents of a supplied page file |
||
| 43 | * |
||
| 44 | * @return void |
||
| 45 | */ |
||
| 46 | 1 | public function displayPage() |
|
| 50 | } |
||
| 51 |