summaryrefslogtreecommitdiff
path: root/src/frontend_blog/blog_lib.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend_blog/blog_lib.php')
-rw-r--r--src/frontend_blog/blog_lib.php75
1 files changed, 35 insertions, 40 deletions
diff --git a/src/frontend_blog/blog_lib.php b/src/frontend_blog/blog_lib.php
index e48d540c..d7e6c513 100644
--- a/src/frontend_blog/blog_lib.php
+++ b/src/frontend_blog/blog_lib.php
@@ -1,42 +1,37 @@
<?php
-
-/**
- * Take a (article's) filename and return its
- * teaser. It has the articles folder hardcoded
- */
-function get_title($name){
- $content = file_get_contents("articles/$name.html");
- $doc = new DOMDocument();
- $doc->loadHTML($content);
- $finder = new DOMXPath($doc);
- $query_set = $finder->query("//h1[@class='chapter' or @class='unnumbered']");
- if (1 != $query_set->length)
- return "No title for this item";
- // assuming all the articles are well-formed..
- return $query_set->item(0)->nodeValue;
-}
-
-/**
- * Take a (article's) filename and return its
- * DOM. It has the articles folder hardcoded
- */
-function get_article($name){
- $raw_content = file_get_contents("articles/$name.html");
- return $raw_content;
- /*$doc = new DOMDocument();
- $doc->loadHTML($content);
- return $doc;*/
-}
-
-/**
- * Fetch the page $page and return its
- * DOM.
- */
-function get_page($page){
- $content = file_get_contents($page);
- $doc = new DOMDocument();
- $doc->loadHTML($content);
- return $doc;
-}
-
+ /**
+ * Take a (article's) filename and return its
+ * teaser. It has the articles folder hardcoded
+ */
+ function get_title($name){
+ $content = file_get_contents("articles/$name.html");
+ $doc = new DOMDocument();
+ $doc->loadHTML($content);
+ $finder = new DOMXPath($doc);
+ $query_set = $finder->query("//h1[@class='chapter' or @class='unnumbered']");
+ if (1 != $query_set->length)
+ return "No title for this item";
+ // assuming all the articles are well-formed..
+ return $query_set->item(0)->nodeValue;
+ }
+
+ /**
+ * Take a (article's) filename and return its
+ * DOM. It has the articles folder hardcoded
+ */
+ function get_article($name){
+ $raw_content = file_get_contents("articles/$name.html");
+ return $raw_content;
+ }
+
+ /**
+ * Fetch the page $page and return its
+ * DOM.
+ */
+ function get_page($page){
+ $content = file_get_contents($page);
+ $doc = new DOMDocument();
+ $doc->loadHTML($content);
+ return $doc;
+ }
?>