web text renderer
authorChristian Weiske <cweiske@cweiske.de>
Thu, 23 Jan 2014 16:11:30 +0000 (17:11 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 23 Jan 2014 16:11:30 +0000 (17:11 +0100)
src/bdrem/Cli.php
src/bdrem/Web.php
src/bdrem/WebText.php [new file with mode: 0644]
www/text.php [new file with mode: 0644]

index 196ca18..807f336 100644 (file)
@@ -14,7 +14,11 @@ class Cli
             date('Y-m-d'), $cfg->daysBefore, $cfg->daysAfter
         );
         usort($arEvents, '\\bdrem\\Event::compare');
+        $this->render($arEvents);
+    }
 
+    public function render($arEvents)
+    {
         $r = new Renderer_Console();
         echo $r->render($arEvents);
     }
index 4222551..ac619ce 100644 (file)
@@ -14,7 +14,11 @@ class Web
             date('Y-m-d'), $cfg->daysBefore, $cfg->daysAfter
         );
         usort($arEvents, '\\bdrem\\Event::compare');
+        $this->render($arEvents);
+    }
 
+    public function render($arEvents)
+    {
         $r = new Renderer_Html();
         echo $r->render($arEvents);
     }
diff --git a/src/bdrem/WebText.php b/src/bdrem/WebText.php
new file mode 100644 (file)
index 0000000..8f3ff8a
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+namespace bdrem;
+
+class WebText extends Web
+{
+    public function render($arEvents)
+    {
+        header('Content-type: text/plain; charset=utf-8');
+        $r = new Renderer_Console();
+        echo $r->render($arEvents);
+    }
+}
+?>
diff --git a/www/text.php b/www/text.php
new file mode 100644 (file)
index 0000000..ffe530a
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+namespace bdrem;
+
+if (file_exists(__DIR__ . '/../src/bdrem/Autoloader.php')) {
+    require_once __DIR__ . '/../src/bdrem/Autoloader.php';
+    Autoloader::register();
+}
+$web = new WebText();
+$web->run();
+?>