Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Request extends Kohana_Request {
- /**
- * Creates a new request object for the given URI. This differs from
- * [Request::instance] in that it does not automatically detect the URI
- * and should only be used for creating HMVC requests.
- * @param string URI of the request
- * @param array $params An array of various paramaters that should be set when using an HMVC request
- * @return Request
- */
- public static function factory($uri, Kohana_Cache $cache = NULL, array $params = NULL)
- {
- if ($params)
- {
- foreach ($params as $key => $value)
- {
- if ($key === 'server')
- {
- array_unshift($value, '--uri='.$uri);
- array_unshift($value, DOCROOT.'index'.EXT);
- $_SERVER['argv'] = $value;
- $_SERVER['argc'] = count($value);
- }
- elseif ($key === 'get')
- {
- $_GET = $value;
- }
- elseif ($key === 'post')
- {
- $_POST = $value;
- }
- }
- }
- return new Request($uri);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement