Source for file Router.class.php
Documentation is available at Router.class.php
* Gumbo Library Framework
* This library is being released under the terms of the New BSD License. A
* copy of the license is packaged with the software (LICENSE.txt). If no
* copy is found, a copy of the license template can be found at:
* http://www.opensource.org/licenses/bsd-license.php
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
* @copyright Copyright (c) 2007, iBayou, Michael Luster
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @author Michael Luster <mluster79@yahoo.com>
* @link http://sourceforge.net/projects/phpgumbo
gumbo_load ("Interface_Router");
/** @var string $_url url to jump to */
/** @var bool $_active if the Router is active */
/** @var int $_delay time, in seconds, to delay the jump */
private $_delay =
GUMBO_ROUTER_DELAY;
/** @var bool $_flush flushes the buffer before routing */
private $_flush =
GUMBO_ROUTER_FLUSH;
* @postcondition $this->activate()
* @param int $delay time, in seconds, before routing
* @param bool $flush flushes the buffer before routing
public function __construct ($url=
null, $delay=
null, $flush=
null) {
* Jumps to the supplied URL
* @precondition isActive ()
* @throws Gumbo_Exception
// check if headers have been sent
// write javascript to the browser
$txt =
"<script language=\"Javascript\" type=\"text/javascript\">";
$txt .=
"window.location=\"" .
$this->getUrl () .
"\";";
$e->setFunction (__METHOD__
);
* @postcondition isActive()
if (!$this->getUrl ()) { return; }
* @postcondition !isActive()
* Sets the URL to jump to
* @precondition Valid::isUrl ()
* @throws Gumbo_Exception
public function setUrl ($url) {
gumbo_load ("Valid_Web");
if (!$valid->isUrl ($url)) {
$e->setFunction (__METHOD__
);
* Sets the delay time, in seconds, before routing
* @precondition $delay >= 0
* @precondition $delay <= 30
* @throws Gumbo_Exception
if ($delay <
0 ||
$delay >
30) {
$e->setFunction (__METHOD__
);
* Sets the program to flush the buffer before routing
* @throws Gumbo_Exception
$e->setFunction (__METHOD__
);
* Returns the delay time, in seconds
* Returns if the buffer should be flushed
* Returns if the Router is active