public static function getAll() { // TODO - read from folder (seperate out), or index file $tags = array(); $dir = CACHE_ROOT . '/tags'; if (is_dir($dir)) { //echo 'is a dir'; if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { //echo "filename: $file : filetype: " . filetype($dir.'/' . $file) . "\n"; if (filetype($dir . '/' . $file) == 'file' && substr($file, 0, 1) != ".") { // for each file found $arr = explode(".", $file); $ext = end($arr); $ext = strtolower($ext); //die($ext); if ($ext == 'json') { //try { $tag = new eatStaticTag(); $tag->file_name = $file; $tag->loadFromFileName(); $tags[] = $tag; //} catch (Exception $e) { //} } } else { //die('not file or started with a dot?'); } } closedir($dh); } } return $tags; }
break; case "feed": // category RSS $stub = "category_rss.php"; break; default: // if this is numeric, setup pagination and return appropriate page if (is_numeric($path[2])) { $page = $path[2] - 1; $show_prev_next = false; require EATSTATIC_ROOT . '/eatStaticBlog.class.php'; require EATSTATIC_ROOT . '/eatStaticTag.class.php'; $tag = new eatStaticTag(); $tag->file_name = $slug . '.json'; // TODO: security validation of slug $tag->loadFromFileName(); $page_title = BLOG_TITLE . ' :: ' . $tag->name; $all_items = array_reverse($tag->items); $items = array_slice($all_items, POSTS_PER_PAGE * $page, POSTS_PER_PAGE); $paginator = new eatStaticPaginator(); $paginator->current = $path[2]; $paginator->total = sizeof($all_items); $paginator->pagination_root = 'category/' . $path[1] . '/'; $stub = "category_page.php"; } break; } break; } break; /**