*/ class ArticleGenerator { function newArticle($directory, $articlefile, $blog) { $article = file_get_contents($directory . $articlefile); echo "
"; if(substr($article, 0, 6) == "%TITLE"){ $title = substr($article, 8, strpos($article, "\n") - 8); if($blog == ""){ $link = "./?article=" . substr($articlefile, 0, -3); } else { $link = "./?blog=$blog&article=" . substr($articlefile, 0, -3); } echo "

$title

"; $article = substr($article, strpos($article, "\n") + 1); } if(substr($article, 0, 5) == "%DATE"){ $date = substr($article, 7, strpos($article, "\n") - 7); echo "$date"; $article = substr($article, strpos($article, "\n") + 1); } if(substr($article, 0, 7) == "%AUTHOR"){ $author = substr($article, 9, strpos($article, "\n") - 9); $article = substr($article, strpos($article, "\n") + 1); } //TODO Code detection echo Parsedown::instance() ->setBreaksEnabled(true) ->text($article); echo "$author"; echo "
" . "\n"; } }