Skip to content

Commit

Permalink
MDL-26964 URL returned by moodle_url::out_omit_querystring() may cont…
Browse files Browse the repository at this point in the history
…ain the anchor part
  • Loading branch information
mudrd8mz committed Mar 24, 2011
1 parent 92a387b commit 4927443
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/weblib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -541,14 +541,21 @@ public function out($escaped = true, array $overrideparams = null) {


/** /**
* Returns url without parameters, everything before '?'. * Returns url without parameters, everything before '?'.
*
* @param bool $includeanchor if {@link self::anchor} is defined, should it be returned?
* @return string * @return string
*/ */
public function out_omit_querystring() { public function out_omit_querystring($includeanchor = false) {

$uri = $this->scheme ? $this->scheme.':'.((strtolower($this->scheme) == 'mailto') ? '':'//'): ''; $uri = $this->scheme ? $this->scheme.':'.((strtolower($this->scheme) == 'mailto') ? '':'//'): '';
$uri .= $this->user ? $this->user.($this->pass? ':'.$this->pass:'').'@':''; $uri .= $this->user ? $this->user.($this->pass? ':'.$this->pass:'').'@':'';
$uri .= $this->host ? $this->host : ''; $uri .= $this->host ? $this->host : '';
$uri .= $this->port ? ':'.$this->port : ''; $uri .= $this->port ? ':'.$this->port : '';
$uri .= $this->path ? $this->path : ''; $uri .= $this->path ? $this->path : '';
if ($includeanchor and !is_null($this->anchor)) {
$uri .= '#' . $this->anchor;
}

return $uri; return $uri;
} }


Expand Down

0 comments on commit 4927443

Please sign in to comment.