Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/kure. a flat-file blogging engine
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344<?php
class Entry {
private $filename; private $title; private $content; private $timestamp;
public function __construct($title, $content, $timestamp) {
$this->filename = parse_title($title); $this->title = $title; $this->content = $content; $this->timestamp = $timestamp;
}
public function __get($variable) { $config = Engine::get_config(); if($variable == 'content' && $config->markdown) return Markdown($this->content); elseif($variable == 'raw_content') return $this->content; return $this->$variable; }
/* * Writes the constructed entry to file. */ public function write() {
$file = 'entries/' . $this->title . '.txt'; $file = str_replace(' ', '-', $file);
return file_put_contents($file, $this->content) && touch($file, $this->timestamp);
}
}
?>