mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11508] Change separator parameter to a simple true|false $is_amp.
PHPBB3-11508
This commit is contained in:
parent
3163388f63
commit
8987fc95f9
2 changed files with 10 additions and 9 deletions
|
@ -2373,7 +2373,7 @@ function build_url($strip_vars = false)
|
||||||
|
|
||||||
if ($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;
|
return $redirect;
|
||||||
|
|
|
@ -238,11 +238,12 @@ class path_helper
|
||||||
* Get the base and parameters of a URL
|
* Get the base and parameters of a URL
|
||||||
*
|
*
|
||||||
* @param string $url URL to break apart
|
* @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))
|
* @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();
|
$params = array();
|
||||||
|
|
||||||
if (strpos($url, '?') !== false)
|
if (strpos($url, '?') !== false)
|
||||||
|
@ -281,12 +282,12 @@ class path_helper
|
||||||
*
|
*
|
||||||
* @param string $url URL to strip parameters from
|
* @param string $url URL to strip parameters from
|
||||||
* @param array|string $strip Parameters to strip.
|
* @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.
|
* @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'];
|
$params = $url_parts['params'];
|
||||||
|
|
||||||
if (!is_array($strip))
|
if (!is_array($strip))
|
||||||
|
@ -314,12 +315,12 @@ class path_helper
|
||||||
*
|
*
|
||||||
* @param string $url URL to append parameters to
|
* @param string $url URL to append parameters to
|
||||||
* @param array $new_params Parameters to add in the form of array(name => value)
|
* @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.
|
* @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);
|
$params = array_merge($url_parts['params'], $new_params);
|
||||||
|
|
||||||
// Move the sid to the end if it's set
|
// Move the sid to the end if it's set
|
||||||
|
|
Loading…
Add table
Reference in a new issue