Generates a login url to redirect to

@param *string $query Query string to include in the URL

@return string
964453
protected function generateLoginUrl($query)
    {
        //if there is a scope
        if (!is_null($this->scope)) {
            //if scope is in array
            if (is_array($this->scope)) {
                $this->scope = implode(' ', $this->scope);
            }
            //add scope to the query
            $query['scope'] = $this->scope;
        }
        //if there is state
        if (!is_null($this->state)) {
            //add state to the query
            $query['state'] = $this->state;
        }
        //if there is display
        if (!is_null($this->display)) {
            //add state to the query
            $query['display'] = $this->display;
        }
        //generate a login url
        return $this->requestUrl.'?'.http_build_query($query);
    }
14814
private function filterQuery(string $query): string
    {
        if ($query !== '' && $query[0] === '?') {
            $query = \substr($query, 1);
        }

        $parts = \explode('&', $query);
        foreach ($parts as $index => $part) {
            [$key, $value] = $this->splitQueryValue($part);
            if ($value === null) {
                $parts[$index] = $this->filterQueryOrFragment($key);
                continue;
            }

            $parts[$index] = $this->filterQueryOrFragment($key) . '=' . $this->filterQueryOrFragment($value);
        }

        return implode('&', $parts);
    }
1035678
protected function filterQuery($query)
    {
        $queryStr    = $this->filterString($query);
        $queryDecode = rawurldecode($queryStr);

        return $this->rawurldecodeValue(ltrim($queryDecode, '?'));
    }
400607
public function highlightQuery($query)
    {
        $newlineKeywords = '#\b(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND|CASE)\b#i';

        $query = htmlspecialchars($query, ENT_QUOTES);

        $query = preg_replace($newlineKeywords, '<br />&#160;&#160;\\0', $query);

        $regex = [
            '/(=)/'
            => '<strong class="text-error">$1</strong>',

            // All uppercase words have a special meaning.
            '/(?<!\w|>)([A-Z_]{2,})(?!\w)/x'
            => '<span class="text-info">$1</span>',
        ];

        $query = preg_replace(array_keys($regex), array_values($regex), $query);

        $query = str_replace('*', '<strong style="color: red;">*</strong>', $query);

        return $query;
    }
389819
public function getResponse(array $query = array())
    {
        $headers = $this->headers;
        $json = null;
        
        if ($this->json) {
            $json   = json_encode($query);
            $query  = array();
        }
        
        //get the authorization parameters as an array
        $signature = $this->getSignature($query);
        $authorization  = $this->getAuthorization($signature, false);
        
        //if we should use the authrization
        if ($this->useAuthorization) {
            //add the string to headers
            $headers[] = sprintf(self::AUTH_HEADER, $this->buildQuery($authorization, ',', false));
        } else {
            //merge authorization and query
            $query = array_merge($authorization, $query);
        }
        
        $query = $this->buildQuery($query);
        $url = $this->url;
        
        //set curl
        $curl = Curl::i()->verifyHost(false)->verifyPeer(false);
        
        //if post
        if ($this->method == self::POST) {
            $headers[] = self::POST_HEADER;
            
            if (!is_null($json)) {
                $query = $json;
            }
            
            //get the response
            $response = $curl->setUrl($url)
                ->setPost(true)
                ->setPostFields($query)
                ->setHeaders($headers)
                ->getResponse();
        } else {
            if (trim($query)) {
                //determine the conector
                $connector = null;
                
                //if there is no question mark
                if (strpos($url, '?') === false) {
                    $connector = '?';
                //if the redirect doesn't end with a question mark
                } else if (substr($url, -1) != '?') {
                    $connector = '&';
                }
                
                //now add the secret to the redirect
                $url .= $connector.$query;
            }
            
            //get the response
            $response = $curl->setUrl($url)->setHeaders($headers)->getResponse();
        }
        
        $this->meta = $curl->getMeta();
        $this->meta['url'] = $url;
        $this->meta['authorization'] = $authorization;
        $this->meta['headers'] = $headers;
        $this->meta['query'] = $query;
        $this->meta['response'] = $response;
        
        return $response;
    }
573454
public function uri($query = false)
    {
        return rtrim($this->baseName(), '/') . '/' . ltrim($this->path($query), '/');
    }
621224
public function link($node, $query = '')
    {
        if (is_array($node)) {
            $links = array();
            $nodes = $node;
            foreach ($nodes as $node) {
                $links[] = $this->link($node, $query);
            }

            return implode(', ', $links);
        }

        return '<a href="'.route($node->getURL()).$query.'">'.$node->getName().'</a>';
    }
1164199
protected function getQueryString($query)
    {
        $wrapper = ($query instanceof AbstractQuery) ? array('query' => $query->toArray()) : $query->toArray();

        return json_encode($wrapper);
    }
449924
protected function _renderQuery($query, $key = '')
    {
        $input = '';
        foreach ($query as $name => $value) {
            $name = $key ? $key.'['.$name.']' : $name;
            if (is_array($value)) {
                $input .= $this->_renderQuery($value, $name);
            } else {
                $input .= PHP_EOL.'<input type="hidden" name="'.$name.'" value="'.$value.'" />';
            }
        }
        
        return $input;
    }
260091
public function query( $query ): string {

		global $wpdb;

		if ( empty( $this->query_starts ) && ! empty( $wpdb->queries ) ) {
			/** @var array $wpdb->queries */
			$this->query_starts[ count( $wpdb->queries ) ] = microtime( true );
		} else {
			$this->query_starts[] = microtime( true );
		}

		return $query;
	}
1095085
private function generateUrl($queryParams) {
        $params = $this->getRequest()->getQuery();
        //Remove htaccess mod rewrite query
        if(array_key_exists('_url', $params)) {
            unset($params['_url']);
        }
        //Override with the new parameters
        foreach($queryParams as $name => $value) {
            $params[$name] = $value;
        }
        $url = new Url();
        return 'https://' . $this->getRequest()->getHttpHost() . substr($url->get($this->getRequest()->getQuery('_url'), $params), 1);
    }
979661
public function fullUrlWithQuery(array $query)
    {
        parse_str($this->getUri()->getQuery(), $queryParts);

        return (string) $this->getUri()
            ->withQuery(http_build_query($query + $queryParts));
    }
553619
public static function executeSingleton1(string $query)
  {
    self::logQuery($query);

    return self::$dl->executeSingleton1($query);
  }
1275531
protected function _getRoute($query, $escape)
    {
        $current = JFactory::getApplication();

        if ($current->getName() !== $this->getApplication())
        {
            $application = JApplicationCms::getInstance($this->getConfig()->application);

            // Force route application during route build.
            JFactory::$application = $application;

            // Get the router.
            $router = $application->getRouter();

            $url = 'index.php?'.http_build_query($query, '', '&');

            // Build route.
            $route = $router->build($url);

            // Revert application change.
            JFactory::$application = $current;

            $route = $route->toString(array('path', 'query', 'fragment'));

            // Check if we need to remove "administrator" from the path
            if ($current->isAdmin() && $application->getName() == 'site')
            {
                $base = JUri::base('true');

                $replacement = explode('/', $base);

                array_pop($replacement);

                $replacement = implode('/', $replacement);

                $base = str_replace('/', '\/', $base);

                $route = preg_replace('/^' . $base . '/', $replacement, $route);
            }

            // Replace spaces.
            $route = preg_replace('/\s/u', '%20', $route);

            if ($escape) {
                $route = htmlspecialchars($route, ENT_COMPAT, 'UTF-8');
            }
        }
        else $route = JRoute::_('index.php?'.http_build_query($query, '', '&'), $escape);

        return $route;
    }
515996
public function search($query)
  {
    $content = $query->getBridgeJson($this->clientKey);

    return $this->query($this->bridgeUrl, $content, self::RESULTS_CLASS);
  }
1006240
public function getLine(SqlQuery $query)
    {
        $replace = [
            '[origin]' => $this->originLine(),
            '[query_nr]' => $query->number(),
            '[datetime]' => Carbon::now()->toDateTimeString(),
            '[query_time]' => $this->time($query->time()),
            '[query]' => $this->queryLine($query),
            '[separator]' => $this->separatorLine(),
            '\n' => PHP_EOL,
        ];

        return str_replace(array_keys($replace), array_values($replace), $this->config->entryFormat());
    }
1131504
public function generate($redirectUrl)
    {
        return (string) $this->queryHelper
            ->setValue('url', $redirectUrl)
            ->applyToUri($this->uri);
    }