if ($type == "user") { echo $user->getName(); } else { if ($type == "date") { echo \DateTime::createFromFormat("!m", $_GET['m'])->format("F") . " " . $_GET['y']; } else { if ($type == "category") { echo $category->getName(); } } } ?> </h2> <?php $list = new BzdList(); foreach (Post::getList() as $post) { // Ignore comments if ($post->getParent() != null) { continue; } if ($type == "user" && $post->getUser()->getID() == $user->getID()) { $list->add($post); } if ($type == "date" && $post->getDate()->format("Y") == $_GET['y'] && $post->getDate()->format("m") == $_GET['m']) { $list->add($post); } if ($type == "category" && $post->getCategory()->getID() == $_GET['c']) { $list->add($post); } }
/** * @codeCoverageIgnore */ public static function getList() { $list = new BzdList(); $sql = mysqli_query(Database::connect(), "SELECT ID, Name FROM " . Database::PREFIX() . "Category"); while ($fetch = mysqli_fetch_array($sql)) { $id = $fetch['ID']; $name = $fetch['Name']; $list->add(new Category($id, $name)); } return $list; }