public static function find($filepath, $app = null) { $env = $app->environment; $root_path = $env['PAGES_ROOT_PATH']; $filepath = str_replace('.html', '', $filepath); $subdirs = explode('/', $filepath); for ($i = 0; $i < count($subdirs) - 1; $i++) { $root_path .= '/' . $subdirs[$i]; } $filename = $subdirs[count($subdirs) - 1]; if (substr($filepath, -1, 1) == '/') { $filename .= 'index'; } $file = PhybridLib::find_file($root_path, $filename); if (!$file) { return null; } $page = new PhybridPage($file, $app); return $page; }
public static function months($app = null) { $env = $app->environment; $dirs = PhybridLib::get_dir_list($env['ARTICLES_ROOT_PATH'] . '/*', 0, 1); rsort($dirs); $archives = array(); foreach ($dirs as $dir) { $ym = explode('/', substr($dir, -7)); $archives[] = array('y' => $ym[0], 'm' => $ym[1]); } return $archives; }