示例#1
0
 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()]);
     }
 }
示例#2
0
 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;
 }
示例#3
0
文件: PageTest.php 项目: hawkao/mew
 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());
 }