예제 #1
0
파일: Page.php 프로젝트: kangkot/Scribe-1
 public static function view($page = 'index')
 {
     $sanitized = preg_replace('/[^\\w-]+/i', '', $page);
     if ($sanitized !== $page) {
         Scribe_Router::redirect('/' . $sanitized);
     }
     $converter = null;
     $path = Scribe::$path . '/pages/' . $page;
     if (file_exists($path . '.md')) {
         $converter = new Scribe_Bargain();
         $converter->relative_prefix = Scribe::$url;
         $path = $path . '.md';
     }
     if (!file_exists($path)) {
         throw new Scribe_Response_404('Page does not exist');
     }
     $content = file($path);
     $content = implode('', $content);
     $content = $converter->transform($content);
     $headings = self::get_toc($converter->headings);
     self::render($content, $headings);
 }
예제 #2
0
파일: Scribe.php 프로젝트: kangkot/Scribe-1
 public static function bootstrap()
 {
     Scribe::$path = dirname(dirname(__FILE__));
     require_once Scribe::$path . '/config.php';
     Scribe_Router::route();
 }