Modifica una URL agregando o quitando variables
@param array $add [Opcional] la URL a agregar
@param array $remove [Opcional] la URL a remover
@return string
500965
public function modify(array $add = [], array $remove = [], $controller = NULL, $action = NULL) {
        $url_splitted = explode('?', $this->_config['request_path']);
        $path = array_filter(explode('/', reset($url_splitted)));

        $gets_remove = key_exists('query', $remove) ? $remove['query'] : [];
        if (key_exists('query', $remove)) {
            unset($remove['query']);
        }
        
        $url = array_filter(array_diff_key($path, array_fill_keys($remove, FALSE), $add) + $add, function ($var) {
            return ($var !== NULL && $var !== FALSE && $var !== '');
        });
        
        $gets_request = key_exists('query', $url) ? $url['query'] : [];
        
        if (key_exists('query', $url)) {
            unset($url['query']);
        }

        ksort($url);
        array_walk($url, function(&$v, $k) {
            $v = (is_string($k) ? $k . '-' : '') . $v;
        });
        
        $url_controller = $controller ? $controller : $this->_config['request_controller'];
        $url_action = $action ? $action : $this->_config['request_action'];

        $last_url = ($this->_config['root_dir'] ? '/' . $this->_config['root_dir'] : '') . 
            '/' . ( ($url_action == $this->_config['default_action'] && 
                $url_controller == $this->_config['default_controller'] && !$url)
                || ($this->_config['request_controller'] === NULL && $this->_config['request_action'] === NULL) ? '' : $url_controller . '/' ) .
            ( ($url_action == $this->_config['default_action'] && $url) || $url_action
                != $this->_config['default_action'] ? $url_action . '/' : '' ) . 
            implode('/', $url);
        
        $queries = array_filter(explode('&', $this->_config['request_queries']));
        $queries_keys = array_map(function($v){ $e = explode('=', $v); return $e[0]; }, $queries);
        $queries_vals = array_map(function($v){ $e = explode('=', $v); return $e[1]; }, $queries);
        
        $gets = $gets_request + array_combine($queries_keys, $queries_vals);
        foreach ($gets_remove as $gr) {
            if (key_exists($gr, $gets)) {
                unset($gets[$gr]);
            }
        } 
        array_walk($gets, function(&$v, $k, $path) {
            $v = $k . '=' . ($k == 'return' ? base64_encode($path) : $v);
        }, $this->_config['request_path']);
        
        return $last_url . ($gets ? (substr($last_url, -1) == '/' ? '' : '/') . '?' . implode('&', $gets) : '');
    }
1246360
public function removeFirst($remove)
	{
		$newArr = [];
		$found = false;

		foreach( $this->attributes as $key => $value)
		{
			if( $found === false && $value != $remove )
			{
				$found = true;
				$newArr[$key] = $value;
			}
		}

		return new static($newArr);
	}
166196
public static function prepareUrl($url)
    {
        // $url = urlencode($url);

        $replacement = [
            '&' => '&amp;',
            "'" => '&apos;',
            '"' => '&quot;',
            '>' => '&gt;',
            '<' => '&lt;',
        ];

        $url = str_replace(array_keys($replacement), array_values($replacement), $url);

        return $url;
    }
1242586
public function addRssFeed($title, $url, $key = null)
    {
        if (!is_array($this->_aRssLinks)) {
            $this->_aRssLinks = [];
        }

        $url = \OxidEsales\Eshop\Core\Registry::getUtilsUrl()->prepareUrlForNoSession($url);

        if ($key === null) {
            $this->_aRssLinks[] = ['title' => $title, 'link' => $url];
        } else {
            $this->_aRssLinks[$key] = ['title' => $title, 'link' => $url];
        }
    }
451867
public static function removeUrlParams($url,$removeKeys)
    {
        if(empty($removeKeys)){
            return $url;
        }
        $pos=strpos($url, "?");
        if($pos>0 || $pos===0){
            $baseUrl=substr($url, 0,$pos);
            $paramStr=substr($url, $pos+1);
            if(empty($paramStr)){
                return $url;
            }
            $params=explode("&", $paramStr);
            $paramStr="";
            foreach ($params as $param){
                $kv=explode("=", $param);
                if(!in_array($kv[0], $removeKeys)){
                    $paramStr.="&".$kv[0]."=".(count($kv)>1?$kv[1]:"");
                }
            }
            if(!empty($paramStr)){
                $paramStr=substr($paramStr, 1);
            }
            if(!empty($paramStr)){
                $baseUrl=$baseUrl."?".$paramStr;
            }
            return $baseUrl;
        }else{
            return $url;
        }
    }
576608
public function getActionLink($controller, $action = 'index', $remove = false)
    {
        $key = $this->_getKey($controller, $action);

        if ($this->offsetExists($key)) {

            $result = $this->toActionLink($key);

            if ($remove) {
                $this->offsetUnset($key);
            }

            return $result;
        }
    }
317663
public static function replaceInArray($search = '', $replace = '', $array = false, $isKeys = true)
    {
        if (!is_array($array)) {
            return str_replace($search, $replace, $array);
        }

        $newArr = array();
        foreach ($array as $key => $value) {
            $addKey = $key;
            if ($isKeys) { //Replace keys
                $addKey = str_replace($search, $replace, $key);
            }

            // Recurse
            $newArr[$addKey] = static::replaceInArray($search, $replace, $value, $isKeys);
        }

        return $newArr;
    }
461631
public function change(
		User $user,
		$add = [],
		$remove = [],
		array $extraParams = []
	) {
		$result = $this->api->postRequest(
			new SimpleRequest(
				'query', [
				'list' => 'users',
				'ustoken' => 'userrights',
				'ususers' => $user->getName(),
			]
			)
		);

		$params = [
			'user' => $user->getName(),
			'token' => $result['query']['users'][0]['userrightstoken'],
		];
		if ( !empty( $add ) ) {
			$params['add'] = implode( '|', $add );
		}
		if ( !empty( $remove ) ) {
			$params['remove'] = implode( '|', $remove );
		}

		$this->api->postRequest(
			new SimpleRequest( 'userrights', array_merge( $extraParams, $params ) )
		);

		return true;
	}
94947
public static function addParameter($url, $params)
    {
        if (!$url) {
            return $url;
        }
        if ($params) {
            if (is_array($params)) {
                $newParams = [];
                foreach ($params as $key => $item) {
                    $newParams[] = $key . '=' . $item;
                }
                $params = join('&', $newParams);
            }
            return $url . (strstr($url, '?') ? '&' : '?') . $params;
        }
        return $url;
    }
639295
public function indexNodeTranslation(NodeTranslation $nodeTranslation, $add = false)
    {
        $event = new NodeTranslationEvent($nodeTranslation);

        $this->eventDispatcher->dispatch(NodeTranslationEvent::NODE_TRANSLATION_INDEX_BEFORE, $event);

        if ($event->isIndexable()) {
            return parent::indexNodeTranslation($nodeTranslation, $add);
        } else {
            $this->deleteNodeTranslation($nodeTranslation);

            return false;
        }
    }
335277
public function removeDir($key, $recursive = false)
    {
        $query = ['dir' => 'true'];

        if ($recursive === true) {
            $query['recursive'] = 'true';
        }

        return $this->httpDelete($this->server . $this->getKeyPath($key), $query);
    }
1005866
public function getActionLinks($remove, $contr1, $action1 = null, $contr2 = null, $action2 = null)
    {
        $args    = func_get_args();
        $count   = func_num_args();
        $results = new \MUtil_Html_Sequence();
        $results->setGlue($this->getGlue());

        for ($i = 1; $i < $count; $i += 2) {
            $controller = $args[$i];
            $action     = $args[$i + 1];
            $result     = $this->getActionLink($controller, $action, $remove);
            if ($result) {
                $results[$this->_getKey($controller, $action)] = $result;
            }
        }

        return $results;
    }
498004
public function url($params = array())
	{
		if ($this->isStatic())
		{
			return $this->pattern;
		}

		$url = $this->pattern;

		foreach ($this->getSegments($url) as $segment)
		{
			$func = $segment['optional'] === true ? 'replaceOptional' : 'replaceRequired';
			$url = $this->{$func}($url, $segment['name'], $segment['token'], $params);
		}

		return $url;
	}
218783
public static function get_current_url($remove_query = false)
    {
        global $wp;

        if ($remove_query === true) {
            return \trailingslashit(\home_url($wp->request));
        }

        return \home_url(\add_query_arg(null, null));
    }
1103223
protected function prepareUrlForKey($urlKey, array $replacements = [])
    {
        $url = $this->getUrlForKey($urlKey);
        foreach ($replacements as $parameter => $value) {
            $url = $this->prepareUrlSingle($parameter, $value, $url);
        }

        return $url;
    }
1183211
public static function getCurrentUrl($exceptedArgs = array(), $addedArgs = array(), $anchor = null)
  {
    self::initialize();

    return Url::getCurrentUrl(null, $addedArgs, $exceptedArgs, true, $anchor);
  }
130788
public static function path($path, $param = [], $add = '')
    {
        Deprecated::method(3.0, UrlGeneratorInterface::class . '::generate');

        $app = AppSingleton::get();

        if (!empty($add) && $add[0] != '?') {
            $add = '?' . $add;
        }

        if (empty($param)) {
            $param = [];
        }

        return $app['url_generator']->generate($path, $param) . $add;
    }