svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/Main.php www/index.php

From: Date: Fri, 30 Oct 2009 15:34:07 +0000
Subject: svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/Main.php www/index.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9006@lists.php.net to get a copy of this message
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 +?>

« previous php.pear.core (#9006) next »