Generates JavaScript code to redirect the
current page Shopgate mobile site

@param array $get
@param array $cookie

@return Shopgate_Helper_Redirect_Type_Js
424247
public function buildJsRedirect(array $get, array $cookie)
    {
        $settingsManager = new Shopgate_Helper_Redirect_SettingsManager($this->config, $get, $cookie);
        $templateParser  = new Shopgate_Helper_Redirect_TemplateParser();

        $linkBuilder   = new Shopgate_Helper_Redirect_LinkBuilder(
            $settingsManager,
            $templateParser
        );
        $tagsGenerator = new Shopgate_Helper_Redirect_TagsGenerator(
            $linkBuilder,
            $templateParser
        );

        $jsBuilder = new Shopgate_Helper_Redirect_JsScriptBuilder(
            $tagsGenerator,
            $settingsManager,
            $templateParser,
            dirname(__FILE__) . '/../assets/js_header.html',
            $this->config->getShopNumber()
        );

        $jsType = new Shopgate_Helper_Redirect_Type_Js($jsBuilder);

        return $jsType;
    }
505819
public function redirectTo($location) {
        $app = $GLOBALS['app'];
        $host = $_SERVER['HTTP_HOST'];
        if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
            $host = $_SERVER['HTTP_X_FORWARDED_HOST'];
        }
        $protocol = isset($_SERVER['HTTPS'])?'https://':'http://'; 
        $redirectLocation = $protocol.$host.'/'.$app->getConfiguration()->getApplicationContext().'/'.$location;
        if ($app->getSubject()->isAuthenticated()) {
            $separator = '?';
            if(strpos($redirectLocation, '?'))
                $separator = '&';
            $redirectLocation .= $separator."rand_token=".urlencode($app->getSessionManager()->getActiveSession()->getAttribute('nonce'));
        }
        if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && 
            strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
                $this->addHeader("Content-type: application/json");
                $response = array();
                $response['redirect'] = $redirectLocation;
                echo json_encode($response);
                exit;
        } else {
            $this->addHeader('Location: '.$redirectLocation);
        }
    }
79154
static function Redirect301($target, $noExit = false)
    {
        self::Redirect($target, self::REDIRECT_HEADER_301, $noExit);
    }
851357
private static function ang($cookie)
    {
        $data     = new \stdClass();
        $features = json_decode($cookie);

        var_dump($cookie, $features);exit;

        return $data;
    }
994238
public function controlPagedResultResponse($result, &$cookie)
    {
        if ($this->isPagingSupported()) {
            if ($this->suppressErrors) {
                return @ldap_control_paged_result_response($this->getConnection(), $result, $cookie);
            }

            return ldap_control_paged_result_response($this->getConnection(), $result, $cookie);
        }

        $message = 'LDAP Pagination is not supported on your current PHP installation.';

        throw new AdldapException($message);
    }
30712
protected function makeRedirection($intended = false)
    {
        $method = $intended ? 'intended' : 'to';

        $property = $this->property('redirect');

        if (!strlen($property)) {
            return;
        }

        $redirectUrl = $this->pageUrl($property) ?: $property;

        if ($redirectUrl = post('redirect', $redirectUrl)) {
            return Redirect::$method($redirectUrl);
        }
    }
437058
public static function setCookieHeaders($cookies)
    {
        if (!empty($cookies) && is_array($cookies) && false === headers_sent() && !self::isTest()) {
            foreach ($cookies as $cookie) {
                setcookie($cookie["name"],
                    $cookie["value"],
                    (array_key_exists('expire', $cookie)) ? $cookie["expire"] : NULL,
                    (array_key_exists('path', $cookie)) ? $cookie["path"] : "/",
                    (array_key_exists('domain', $cookie)) ? $cookie["domain"] : Request::getInstance()->getRootUrl(FALSE),
                    (array_key_exists('secure', $cookie)) ? $cookie["secure"] : FALSE,
                    (array_key_exists('http', $cookie)) ? $cookie["http"] : true
                );
            }
        }
    }
786743
public String getJavaScriptForRedirect(String reqUrlCookieName, String redirectUrl) throws Exception {
        return getJavaScriptForRedirect(reqUrlCookieName, redirectUrl, null);
    }
1072601
protected function get($endpoint, $get = array()) {
		if ($get !== []) {
			$endpoint .= '?' . http_build_query($get);
		}

		$uri = new \TYPO3\Flow\Http\Uri($endpoint);
		$request = \TYPO3\Flow\Http\Request::create($uri, 'GET');
		$request->setContent('');
		$request = $this->authentication->authorizeRequest($request);
		$response = $this->requestEngine->sendRequest($request);

		return $response;
	}
1360750
public function authRedirect($exit = true, $type = self::CODE_AUTH_TYPE, $state = null)
    {
        header('Location: ' . $this->getAuthUrl($type, $state));

        return $exit ? exit() : true;
    }
638207
public static function get($url, $data = [], $accepts_cookie = true, $compression = 'gzip', $proxy = '')
    {
        $self = new static($accepts_cookie, $compression, $proxy);
        return $self->sendGET($url, $data);
    }
106467
public static function input($key = '', bool $xss = true, bool $cookie = false, array $options = []) {
		// cookie first, get and post after
		$_GET = $_GET ?? $_REQUEST ?? [];
		// fix files
		$files = [];
		foreach (($_FILES ?? []) as $k => $v) {
			// we need to convert
			if (is_array($v['name'])) {
				foreach ($v['name'] as $k2 => $v2) {
					if (empty($v['tmp_name'][$k2])) continue;
					$files[$k][$k2] = [
						'name' => $v2,
						'type' => $v['type'][$k2],
						'tmp_name' => $v['tmp_name'][$k2],
						'error' => $v['error'][$k2],
						'size' => $v['size'][$k2],
					];
				}
			} else {
				if (empty($v['tmp_name'])) continue;
				$files[$k] = $v;
			}
		}
		if ($cookie) {
			$result = array_merge($_COOKIE, $_GET, $_POST, $files);
		} else {
			$result = array_merge($_GET, $_POST, $files);
		}
		// protection against XSS attacks is on by default
		if ($xss) $result = strip_tags2($result, $options);
		// we need to get rid of session id from the result
		if (!$cookie) {
			unset($result[session_name()]);
		}
		// if we are debugging
		if (Debug::$debug) {
			Debug::$data['input'][] = $result;
		}
		// returning result
		if ($key) {
			return array_key_get($result, $key);
		} else {
			return $result;
		}
	}
1192951
public function redirect() {

    if (isset($_GET['view'])) {
      $view = "view=" . $_GET['view'];
    } else {
      $view = "view=return";
    }

    $return_url = substr(BASE_URL, 0, -12) . 'index.php?' . $view . '&transactionid=' . $_GET['transactionid'];
    header("Location: " . $return_url);
  }
827371
function get($resource, $query = array(), $headers = array()) {
        $url = $this->build_url($resource, $query);
        $key = $this->buildCacheKey('get', $resource, $url, $headers, $query);
        if (($this->cacher) && ($this->cacher->has($key))) return $this->cacher->get($key);
        $result = $this->client->get($url, [
            'headers' => array_merge([
                'Authorization' => $this->getBearer()
            ], $headers)
        ])->json();
        if ($this->cacher) $this->cacher->put($key, $result);
        return $result;
    }
1159654
function UpdateCookies($cookies)
    {
        if (sizeof($this->cookies) == 0) {
            // no existing cookies: take whatever is new
            if (sizeof($cookies) > 0) {
                $this->debug('Setting new cookie(s)');
                $this->cookies = $cookies;
            }

            return TRUE;
        }
        if (sizeof($cookies) == 0) {
            // no new cookies: keep what we've got
            return TRUE;
        }
        // merge
        foreach ($cookies as $newCookie) {
            if (!is_array($newCookie)) {
                continue;
            }
            if ((!isset($newCookie['name'])) || (!isset($newCookie['value']))) {
                continue;
            }
            $newName = $newCookie['name'];

            $found = FALSE;
            for ($i = 0; $i < count($this->cookies); $i++) {
                $cookie = $this->cookies[$i];
                if (!is_array($cookie)) {
                    continue;
                }
                if (!isset($cookie['name'])) {
                    continue;
                }
                if ($newName != $cookie['name']) {
                    continue;
                }
                $newDomain = isset($newCookie['domain']) ? $newCookie['domain'] : 'NODOMAIN';
                $domain    = isset($cookie['domain']) ? $cookie['domain'] : 'NODOMAIN';
                if ($newDomain != $domain) {
                    continue;
                }
                $newPath = isset($newCookie['path']) ? $newCookie['path'] : 'NOPATH';
                $path    = isset($cookie['path']) ? $cookie['path'] : 'NOPATH';
                if ($newPath != $path) {
                    continue;
                }
                $this->cookies[$i] = $newCookie;
                $found             = TRUE;
                $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
                break;
            }
            if (!$found) {
                $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
                $this->cookies[] = $newCookie;
            }
        }

        return TRUE;
    }
395595
public function redirect($page = null, $arg = array())
    {
        $url = $this->app->url($page, $arg);

        return $this->univ()->_fn('redirect', array($url));
    }
499170
public function getSuccessPageRedirect($storeId = null)
    {
        return $this->getScopeConfig()->getValue(
            self::XML_PATH_SUCCESS_PAGE_REDIRECT,
            ScopeInterface::SCOPE_STORE,
            $storeId
        );
    }