Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Generate full url from Router::reverse() #45

Closed
wants to merge 1 commit into from

2 participants

@joeytrapp

Added a flag to Router::reverse that is passed on to the Router::url call to generate a full url. Defaults to false in Router::reverse().

@markstory markstory referenced this pull request from a commit
@markstory markstory Revert "Merge pull request #45 from joeytrapp/router-reverse"
This reverts commit eb1e040, reversing
changes made to e53407c.
f65cf55
@markstory
Owner

I buggered that up and accidentally applied the change to 1.3. I've reverted that change, and will apply the patch to 2.0 instead.

@markstory
Owner

Merged in [3675e73], thanks again :)

@markstory markstory closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 4, 2011
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 2 deletions.
  1. +2 −2 cake/libs/router.php
  2. +11 −0 cake/tests/cases/libs/router.test.php
View
4 cake/libs/router.php
@@ -1060,7 +1060,7 @@ function queryString($q, $extra = array(), $escape = false) {
* @access public
* @static
*/
- function reverse($params) {
+ function reverse($params, $full = false) {
$pass = $params['pass'];
$named = $params['named'];
$url = $params['url'];
@@ -1072,7 +1072,7 @@ function reverse($params) {
if (!empty($url)) {
$params['?'] = $url;
}
- return Router::url($params);
+ return Router::url($params, $full);
}
/**
View
11 cake/tests/cases/libs/router.test.php
@@ -2147,6 +2147,17 @@ function testRouterReverse() {
);
$result = Router::reverse($params);
$this->assertEqual($result, '/eng/posts/view/1?foo=bar&baz=quu');
+
+ $params = array(
+ 'lang' => 'eng',
+ 'controller' => 'posts',
+ 'action' => 'view',
+ 'pass' => array(1),
+ 'named' => array(),
+ 'url' => array('url' => 'eng/posts/view/1')
+ );
+ $result = Router::reverse($params, true);
+ $this->assertPattern('/^http(s)?:\/\//', $result);
}
}
Something went wrong with that request. Please try again.