1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-05 23:25:30 +02:00

[ticket/11508] Change separator parameter to a simple true|false $is_amp.

PHPBB3-11508
This commit is contained in:
Cesar G 2014-02-07 09:20:49 -08:00
parent 3163388f63
commit 8987fc95f9
2 changed files with 10 additions and 9 deletions

View File

@ -2373,7 +2373,7 @@ function build_url($strip_vars = false)
if ($strip_vars !== false)
{
$redirect = $path_helper->strip_url_params($redirect, $strip_vars, '&');
$redirect = $path_helper->strip_url_params($redirect, $strip_vars, false);
}
return $redirect;

View File

@ -238,11 +238,12 @@ class path_helper
* Get the base and parameters of a URL
*
* @param string $url URL to break apart
* @param string $separator Parameter separator. Defaults to &
* @param bool $is_amp Is the parameter separator &. Defaults to true.
* @return array Returns the base and parameters in the form of array('base' => string, 'params' => array(name => value))
*/
public function get_url_parts($url, $separator = '&')
public function get_url_parts($url, $is_amp = true)
{
$separator = ($is_amp) ? '&' : '&';
$params = array();
if (strpos($url, '?') !== false)
@ -281,12 +282,12 @@ class path_helper
*
* @param string $url URL to strip parameters from
* @param array|string $strip Parameters to strip.
* @param string $separator Parameter separator. Defaults to &
* @param bool $is_amp Is the parameter separator &. Defaults to true.
* @return string Returns the new URL.
*/
public function strip_url_params($url, $strip, $separator = '&')
public function strip_url_params($url, $strip, $is_amp = true)
{
$url_parts = $this->get_url_parts($url, $separator);
$url_parts = $this->get_url_parts($url, $is_amp);
$params = $url_parts['params'];
if (!is_array($strip))
@ -314,12 +315,12 @@ class path_helper
*
* @param string $url URL to append parameters to
* @param array $new_params Parameters to add in the form of array(name => value)
* @param string $separator Parameter separator. Defaults to &
* @param string $is_amp Is the parameter separator &. Defaults to true.
* @return string Returns the new URL.
*/
public function append_url_params($url, $new_params, $separator = '&')
public function append_url_params($url, $new_params, $is_amp = true)
{
$url_parts = $this->get_url_parts($url, $separator);
$url_parts = $this->get_url_parts($url, $is_amp);
$params = array_merge($url_parts['params'], $new_params);
// Move the sid to the end if it's set