svn: /pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ Main.php
| From: | Brett Bieber | Date: | Fri, 04 Dec 2009 20:07:00 +0000 |
| Subject: | svn: /pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/ Main.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9073@lists.php.net to get a copy of this message | ||
saltybeagle Fri, 04 Dec 2009 20:07:00 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291714
Log:
Use reflection class to get default view. Don't append default view to the URL.
Changed paths:
U pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php 2009-12-04 19:48:02
UTC (rev 291713)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php 2009-12-04 20:07:00
UTC (rev 291714)
@@ -127,6 +127,14 @@
*/
public static function getURL($class = null)
{
+ static $default_view;
+
+ if (empty($default_view)) {
+ $main = new \ReflectionClass(__CLASS__);
+ $properties = $main->getDefaultProperties();
+ $default_view = $properties['options']['view'];
+ }
+
$url = static::$url;
if ($class) {
if (is_object($class)) {
@@ -136,7 +144,11 @@
if (!count($route)) {
throw new UnregisteredViewException('The view for that object is not
registered');
}
- $url .= '?view=' . $route[0];
+
+ if ($route[0] != $default_view) {
+ $url .= '?view=' . $route[0];
+ }
+
}
return $url;
}