[prev in list] [next in list] [prev in thread] [next in thread]
List: pear-cvs
Subject: [PEAR-CVS] svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/Main.php www/i
From: Brett_Bieber <saltybeagle () php ! net>
Date: 2009-10-30 15:34:07
Message-ID: svn-saltybeagle-1256916847-290079-1253234133 () svn ! php ! net
[Download RAW message or body]
saltybeagle Fri, 30 Oct 2009 15:34:07 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=290079
Log:
Add some docs, prep for post-render filtering
Changed paths:
U pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php
U pear2/sandbox/SimpleChannelFrontend/trunk/www/index.php
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php 2009-10-30 \
14:59:33 UTC (rev 290078)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php 2009-10-30 \
15:34:07 UTC (rev 290079) @@ -40,6 +40,12 @@
'packages' => \
'pear2\SimpleChannelFrontend\PackageList',
'package' => \
'pear2\SimpleChannelFrontend\Package');
+ /**
+ * Constructor
+ *
+ * @param \pear2\Pyrus\ChannelFile $channel The channel object
+ * @param array $options Associative array of options
+ */
function __construct(\pear2\Pyrus\IChannelFile $channel, $options = array())
{
static::setChannel($channel);
@@ -51,6 +57,13 @@
}
}
+ /**
+ * Set the channel file for this frontend.
+ *
+ * @param \pear2\Pyrus\IChanelFile $channel The channel object
+ *
+ * @return void
+ */
public static function setChannel(\pear2\Pyrus\IChannelFile $channel)
{
\pear2\Pyrus\Main::$downloadClass = __NAMESPACE__ . '\\Internet';
@@ -71,6 +84,11 @@
static::$channel->fromArray($channel->getArray());
}
+ /**
+ * Determine which view to instantiate and set as the page content
+ *
+ * @return mixed
+ */
function run()
{
if (!array_key_exists($this->options['view'], static::$view_map)) {
@@ -95,6 +113,13 @@
return $this;
}
+ /**
+ * Get the URL to a specific view
+ *
+ * @param mixed $class What class to return a route for
+ *
+ * @return string The url
+ */
public static function getURL($class = null)
{
$url = '';
@@ -110,4 +135,16 @@
}
return $url;
}
+
+ /**
+ * Called after the page is rendered to perform any necessary replacements.
+ *
+ * @param string $html The rendered template.
+ *
+ * @return string Filtered html
+ */
+ public function postRender($html)
+ {
+ return $html;
+ }
}
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/index.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/index.php 2009-10-30 14:59:33 UTC \
(rev 290078)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/index.php 2009-10-30 15:34:07 UTC \
(rev 290079) @@ -7,5 +7,6 @@
$savant->setClassToTemplateMapper(new pear2\SimpleChannelFrontend\TemplateMapper);
$savant->setTemplatePath(array(__DIR__ . '/templates'));
$savant->setEscape('htmlspecialchars');
+$savant->addFilters(array($frontend, 'postRender'));
echo $savant->render($frontend);
-?>
\ No newline at end of file
+?>
--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic