add an initial Horde_View_Json object that takes the variables assigned to it and...
authorChuck Hagenbuch <chuck@horde.org>
Thu, 10 Sep 2009 03:24:47 +0000 (23:24 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Thu, 10 Sep 2009 03:24:56 +0000 (23:24 -0400)
framework/View/lib/Horde/View/Json.php [new file with mode: 0644]
framework/View/package.xml

diff --git a/framework/View/lib/Horde/View/Json.php b/framework/View/lib/Horde/View/Json.php
new file mode 100644 (file)
index 0000000..33252a8
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @category Horde
+ * @package Horde_View
+ */
+
+/**
+ * Concrete class for handling views.
+ *
+ * @category Horde
+ * @package Horde_View
+ */
+class Horde_View_Json extends Horde_View_Base
+{
+    /**
+     * Processes a template and returns the output.
+     *
+     * @param string $name The template to process.
+     *
+     * @return string The template output.
+     */
+    public function render($name = '', $locals = array())
+    {
+        return json_encode((object)(array)$this);
+    }
+
+    /**
+     * Satisfy the abstract _run function in Horde_View_Base.
+     */
+    protected function _run()
+    {
+    }
+}
index 72a6ef6..3dcdb99 100644 (file)
@@ -72,6 +72,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
       <file name="Base.php" role="php" />
       <file name="Exception.php" role="php" />
       <file name="Interface.php" role="php" />
+      <file name="Json.php" role="php" />
      </dir> <!-- /lib/Horde/View -->
      <file name="View.php" role="php" />
     </dir> <!-- /lib/Horde -->
@@ -112,6 +113,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/View/Base.php" as="Horde/View/Base.php" />
    <install name="lib/Horde/View/Exception.php" as="Horde/View/Exception.php" />
    <install name="lib/Horde/View/Interface.php" as="Horde/View/Interface.php" />
+   <install name="lib/Horde/View/Json.php" as="Horde/View/Json.php" />
    <install name="lib/Horde/View.php" as="Horde/View.php" />
   </filelist>
  </phprelease>