All pastes #675103 Raw Edit

Anonymous

public php v1 · immutable
#675103 ·published 2007-08-29 20:38 UTC
rendered paste body
    public function fetch($spec = null)    {        if ($spec instanceof Solar_Uri_Action) {            // a URI was passed directly            $uri = $spec;        } else {            // user spec is a URI string; if empty, is the current URI            $uri = Solar::factory('Solar_Uri_Action', array(                'uri' => (string) $spec,            ));        }                // take the page name off the top of the path and try to get a        // controller class from it.        $page = array_shift($uri->path);                if (empty($page)) {        	array_unshift($uri->path, $page);        	$class = $this->_getPageClass($this->_default);        } else {        	$class = $this->_getPageClass($page);        }		        // did we get a class from it?        /*        if (! $class) {            // put the original segment back on top.            array_unshift($uri->path, $page);            // try to get a controller class from the default page name            $class = $this->_getPageClass($this->_default);        }        */                // last chance: do we have a class yet?        if (! $class) {            return $this->_notFound($page);        }                // instantiate the controller class and fetch its content        $obj = Solar::factory($class);        $obj->setFrontController($this);        return $obj->fetch($uri);    }