public function add() { if ($this->method == 'POST' && Input::has('name')) { $page = new Page(Input::get('name'), 'name'); return $this->redirect(['a' => 'edit', 'p' => $page->getName()]); } }
public function view() { $page = new Page(Input::get('p', Config::get('index')), 'name'); $name = urlencode($page->getName() . '.md'); header('Content-Type: text/x-markdown; charset="UTF-8"'); header("Content-Disposition: inline; filename=\"{$name}\""); echo $page->getHead()->getData(); return false; }
public function testConstructById() { $name = 'PageName'; $data = 'PageData'; $id = sha1($name); (new Page($name, 'name'))->update($data); $page = new Page($id); $this->assertEquals($id, $page->getId()); $this->assertEquals($name, $page->getName()); $this->assertEquals($data, $page->getHead()->getData()); }