2008-11-25 16:26:03 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2008-12-02 00:32:30 +00:00
|
|
|
* e107 website system
|
|
|
|
*
|
2012-05-11 09:54:12 +00:00
|
|
|
* Copyright (C) 2008-2012 e107 Inc (e107.org)
|
2008-12-02 00:32:30 +00:00
|
|
|
* Released under the terms and conditions of the
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
|
|
*
|
|
|
|
* URL Handler
|
|
|
|
*
|
2011-11-25 17:31:54 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2008-11-25 16:26:03 +00:00
|
|
|
*/
|
|
|
|
|
2011-06-17 01:13:05 +00:00
|
|
|
|
2009-09-14 18:19:17 +00:00
|
|
|
if (!defined('e107_INIT')) { exit; }
|
|
|
|
|
2022-04-04 10:54:24 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
2011-11-25 17:31:54 +00:00
|
|
|
class eUrl
|
2008-11-25 16:26:03 +00:00
|
|
|
{
|
2011-11-25 17:31:54 +00:00
|
|
|
protected $_front;
|
2009-09-14 18:19:17 +00:00
|
|
|
|
2011-11-25 17:31:54 +00:00
|
|
|
public function __construct()
|
2008-11-25 16:26:03 +00:00
|
|
|
{
|
2011-11-25 17:31:54 +00:00
|
|
|
$front = eFront::instance();
|
|
|
|
if(null === $front->getRequest())
|
2008-11-25 16:26:03 +00:00
|
|
|
{
|
2011-11-25 17:31:54 +00:00
|
|
|
// init
|
|
|
|
$request = new eRequest();
|
|
|
|
$front->setRequest($request);
|
|
|
|
|
|
|
|
$dispatcher = new eDispatcher();
|
|
|
|
$front->setDispatcher($dispatcher);
|
|
|
|
|
|
|
|
$router = new eRouter();
|
|
|
|
$front->setRouter($router);
|
|
|
|
|
|
|
|
$response = new eResponse();
|
|
|
|
$front->setResponse($response);
|
|
|
|
|
2008-11-25 16:26:03 +00:00
|
|
|
}
|
2011-11-25 17:31:54 +00:00
|
|
|
$this->_front = $front;
|
2009-09-25 20:17:48 +00:00
|
|
|
}
|
2022-04-04 10:54:24 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $route
|
|
|
|
* @param $params
|
|
|
|
* @param $options
|
|
|
|
* @return string
|
|
|
|
*/
|
2011-11-25 17:31:54 +00:00
|
|
|
public function create($route, $params = array(), $options = array())
|
2008-12-02 00:32:30 +00:00
|
|
|
{
|
2011-11-25 17:31:54 +00:00
|
|
|
return $this->router()->assemble($route, $params, $options);
|
2008-11-25 16:26:03 +00:00
|
|
|
}
|
2022-04-04 10:54:24 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $route
|
|
|
|
* @param $params
|
|
|
|
* @param $options
|
|
|
|
* @return string
|
|
|
|
*/
|
2011-12-07 21:07:21 +00:00
|
|
|
public function sc($route, $params = array(), $options = array())
|
|
|
|
{
|
|
|
|
return $this->router()->assembleSc($route, $params, $options);
|
|
|
|
}
|
|
|
|
|
2009-09-25 20:17:48 +00:00
|
|
|
/**
|
2011-11-25 17:31:54 +00:00
|
|
|
* @return eRouter
|
2009-09-25 20:17:48 +00:00
|
|
|
*/
|
2011-11-25 17:31:54 +00:00
|
|
|
public function router()
|
2009-09-25 20:17:48 +00:00
|
|
|
{
|
2011-11-25 17:31:54 +00:00
|
|
|
return $this->_front->getRouter();
|
2009-09-25 20:17:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-11-25 17:31:54 +00:00
|
|
|
* @return eDispatcher
|
2009-09-25 20:17:48 +00:00
|
|
|
*/
|
2011-11-25 17:31:54 +00:00
|
|
|
public function dispatcher()
|
2009-09-25 20:17:48 +00:00
|
|
|
{
|
2011-11-25 17:31:54 +00:00
|
|
|
return $this->_front->getDispatcher();
|
2009-09-25 20:17:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-11-25 17:31:54 +00:00
|
|
|
* @return eFront
|
2009-09-25 20:17:48 +00:00
|
|
|
*/
|
2011-11-25 17:31:54 +00:00
|
|
|
public function front()
|
2009-09-25 20:17:48 +00:00
|
|
|
{
|
2011-11-25 17:31:54 +00:00
|
|
|
return $this->_front;
|
2008-11-25 16:26:03 +00:00
|
|
|
}
|
2012-05-11 09:54:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return eResponse
|
|
|
|
*/
|
|
|
|
public function response()
|
|
|
|
{
|
|
|
|
return $this->_front->getResponse();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return eRequest
|
|
|
|
*/
|
|
|
|
public function request()
|
|
|
|
{
|
|
|
|
return $this->_front->getRequest();
|
|
|
|
}
|
2008-11-25 16:26:03 +00:00
|
|
|
}
|
2011-06-17 01:13:05 +00:00
|
|
|
|