本文整理汇总了PHP中Tools::redirectLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::redirectLink方法的具体用法?PHP Tools::redirectLink怎么用?PHP Tools::redirectLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tools
的用法示例。
在下文中一共展示了Tools::redirectLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canonicalRedirection
public function canonicalRedirection()
{
// Automatically redirect to the canonical URL if the current in is the right one
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
if (Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
if (Validate::isLoadedObject($this->cms) and $canonicalURL = self::$link->getCMSLink($this->cms)) {
if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
header('HTTP/1.0 301 Moved');
header('Cache-Control: no-cache');
if (_PS_MODE_DEV_) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
}
Tools::redirectLink($canonicalURL);
}
}
if (Validate::isLoadedObject($this->cms_category) and $canonicalURL = self::$link->getCMSCategoryLink($this->cms_category)) {
if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
header('HTTP/1.0 301 Moved');
header('Cache-Control: no-cache');
if (_PS_MODE_DEV_) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
}
Tools::redirectLink($canonicalURL);
}
}
}
}
示例2: canonicalRedirection
protected function canonicalRedirection()
{
global $link, $cookie;
if (Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
// Automatically redirect to the canonical URL if needed
if (isset($this->php_self) && !empty($this->php_self)) {
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
$canonicalURL = $link->getPageLink($this->php_self, $this->ssl, $cookie->id_lang);
if (!Tools::getValue('ajax') && !preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', ($this->ssl && _PS_SSL_ENABLED_ ? 'https://' : 'http://') . urldecode($_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']))) {
if ($_SERVER['REQUEST_URI'] == __PS_BASE_URI__) {
header('HTTP/1.0 303 See Other');
header('Cache-Control: no-cache');
} else {
header('HTTP/1.0 301 Moved Permanently');
header('Cache-Control: no-cache');
}
$params = '';
$excludedKey = array('isolang', 'id_lang');
foreach ($_GET as $key => $value) {
if (!in_array($key, $excludedKey)) {
$params .= ($params == '' ? '?' : '&') . $key . '=' . $value;
}
}
Module::hookExec('frontCanonicalRedirect');
if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_ && $_SERVER['REQUEST_URI'] != __PS_BASE_URI__) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . $params . '">' . $canonicalURL . $params . '</a>');
}
Tools::redirectLink($canonicalURL . $params);
}
}
}
}
示例3: postProcess
public function postProcess()
{
if ($this->context->cart->id_customer == 0 || $this->context->cart->id_address_delivery == 0 || $this->context->cart->id_address_invoice == 0 || !$this->module->active) {
Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
}
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
$authorized = false;
foreach (Module::getPaymentModules() as $module) {
if ($module['name'] == 'cashondelivery') {
$authorized = true;
break;
}
}
// if (!$authorized)
// die(Tools::displayError('This payment method is not available.'));
$customer = new Customer($this->context->cart->id_customer);
if (!Validate::isLoadedObject($customer)) {
Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
}
if (Tools::getValue('confirm')) {
$customer = new Customer((int) $this->context->cart->id_customer);
$total = $this->context->cart->getOrderTotal(true, Cart::BOTH);
$this->module->validateOrder((int) $this->context->cart->id, Configuration::get('PS_OS_PREPARATION'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $this->context->cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $this->module->currentOrder);
}
}
示例4: initContent
public function initContent()
{
parent::initContent();
$ordernumber = Tools::getValue('InvId');
$this->context->smarty->assign('ordernumber', $ordernumber);
if (Configuration::get('robokassa_postvalidate')) {
if (!$ordernumber) {
robokassa::validateAnsver($this->module->l('Cart number is not set'));
}
$cart = new Cart((int) $ordernumber);
if (!Validate::isLoadedObject($cart)) {
robokassa::validateAnsver($this->module->l('Cart does not exist'));
}
if (!($ordernumber = Order::getOrderByCartId($cart->id))) {
$this->setTemplate('waitingPayment.tpl');
}
}
if (!$ordernumber) {
robokassa::validateAnsver($this->module->l('Order number is not set'));
}
$order = new Order((int) $ordernumber);
if (!Validate::isLoadedObject($order)) {
robokassa::validateAnsver($this->module->l('Order does not exist'));
}
$customer = new Customer((int) $order->id_customer);
if ($customer->id != $this->context->cookie->id_customer) {
robokassa::validateAnsver($this->module->l('You are not logged in'));
}
if ($order->hasBeenPaid()) {
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $order->id_cart . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $order->id);
} else {
$this->setTemplate('waitingPayment.tpl');
}
}
示例5: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
$cart = new Cart(Tools::getValue('order_id'));
$customer = new Customer((int) $cart->id_customer);
$veritransBinPromo = new VeritransBinPromo();
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . Tools::getValue('order_id') . '&id_module=' . $veritransBinPromo->id . '&id_order=' . Tools::getValue('order_id') . '&key=' . $customer->secure_key);
}
示例6: preProcess
public function preProcess()
{
if ($id_category = (int) Tools::getValue('id_category')) {
$this->category = new Category($id_category, self::$cookie->id_lang);
}
if (!Validate::isLoadedObject($this->category)) {
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
} else {
// Automatically redirect to the canonical URL if the current in is the right one
// $_SERVER['HTTP_HOST'] must be replaced by the real canonical domain
$currentURL = self::$link->getCategoryLink($this->category);
$currentURL = preg_replace('/[?&].*$/', '', $currentURL);
if (!preg_match('/^' . Tools::pRegexp($currentURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
header('HTTP/1.0 301 Moved');
if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $currentURL . '">' . $currentURL . '</a>');
}
Tools::redirectLink($currentURL);
}
}
parent::preProcess();
if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
if ($id_category = (int) Tools::getValue('id_category')) {
$rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
$default_rewrite = array();
foreach ($rewrite_infos as $infos) {
$default_rewrite[$infos['id_lang']] = self::$link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
}
self::$smarty->assign('lang_rewrite_urls', $default_rewrite);
}
}
}
示例7: initContent
/**
* @see FrontController::initContent()
*/
public function initContent()
{
$this->display_column_left = false;
$this->display_column_center = true;
$this->display_column_right = false;
$valid_payments = array();
if (Configuration::get('PIGMBH_PAYMILL_DEBIT')) {
$valid_payments[] = 'debit';
}
if (Configuration::get('PIGMBH_PAYMILL_CREDITCARD')) {
$valid_payments[] = 'creditcard';
}
if (!in_array(Tools::getValue('payment'), $valid_payments)) {
Tools::redirectLink($this->context->link->getPageLink('order', true, null, array('step' => '1')));
}
$db_data = $this->getPaymillUserData();
$this->updatePaymillClient($db_data);
$cart = $this->context->cart;
foreach ($this->module->getCurrency((int) $cart->id_currency) as $currency) {
if ($currency['id_currency'] == $cart->id_currency) {
$iso_currency = $currency['iso_code'];
break;
}
}
$brands = array();
foreach (Tools::jsonDecode(Configuration::get('PIGMBH_PAYMILL_ACCEPTED_BRANDS'), true) as $brand_key => $brand_value) {
$brands[str_replace('-', '', $brand_key)] = $brand_value;
}
$data = array('use_backward_compatible_checkout' => _PS_VERSION_ < '1.6', 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->module->getCurrency((int) $cart->id_currency), 'currency_iso' => $iso_currency, 'total' => (int) round($cart->getOrderTotal(true, Cart::BOTH) * 100), 'displayTotal' => $cart->getOrderTotal(true, Cart::BOTH), 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/', 'public_key' => Configuration::get('PIGMBH_PAYMILL_PUBLICKEY'), 'payment' => Tools::getValue('payment'), 'paymill_debugging' => (int) Configuration::get('PIGMBH_PAYMILL_DEBUG') == 'on', 'modul_base' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/pigmbhpaymill/', 'customer' => $this->context->customer->firstname . ' ' . $this->context->customer->lastname, 'prefilledFormData' => $this->updatePaymillPayment($db_data), 'acceptedBrands' => Configuration::get('PIGMBH_PAYMILL_ACCEPTED_BRANDS'), 'acceptedBrandsDecoded' => $brands);
$this->context->smarty->assign($data);
parent::initContent();
$this->setTemplate('paymill_checkout.tpl');
}
示例8: postProcess
/**
* @see FrontController::postProcess()
*/
public function postProcess()
{
if ($this->context->cart->id_customer == 0 || $this->context->cart->id_address_delivery == 0 || $this->context->cart->id_address_invoice == 0 || !$this->module->active) {
Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
}
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
$authorized = false;
foreach (Module::getPaymentModules() as $module) {
if ($module['name'] == 'seurcashondelivery') {
$authorized = true;
break;
}
}
if (!$authorized) {
die(Tools::displayError('This payment method is not available.'));
}
$customer = new Customer((int) $this->context->cart->id_customer);
if (!Validate::isLoadedObject($customer)) {
Tools::redirectLink(__PS_BASE_URI__ . 'order.php?step=1');
}
if (Tools::getValue('confirm')) {
$customer = new Customer((int) $this->context->cart->id_customer);
$coste = (double) abs($this->context->cart->getOrderTotal(true, Cart::BOTH));
$cargo = number_format($this->module->getCargo($this->context->cart, false), 2, '.', '');
$vales = (double) abs($this->context->cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS));
$total = $coste - $vales + $cargo;
if (version_compare(_PS_VERSION_, "1.5", "<")) {
$this->module->validateOrderFORWEBS_v4((int) $this->context->cart->id, Configuration::get('REEMBOLSO_OS_CARGO'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
} else {
$this->module->validateOrderFORWEBS_v5((int) $this->context->cart->id, Configuration::get('REEMBOLSO_OS_CARGO'), $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
}
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . urlencode($customer->secure_key) . '&id_cart=' . (int) $this->context->cart->id . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $this->module->currentOrder);
}
}
示例9: renderView
public function renderView()
{
if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj)) {
$link = $this->context->link->getPageLink('attachment', true, null, 'id_attachment=' . $obj->id);
Tools::redirectLink($link);
}
return $this->displayWarning($this->trans('File not found', array(), 'Admin.Catalog.Notification'));
}
示例10: renderView
public function renderView()
{
if (($obj = $this->loadObject(true)) && Validate::isLoadedObject($obj)) {
$link = $this->context->link->getPageLink('attachment', true, NULL, 'id_attachment=' . $obj->id);
Tools::redirectLink($link);
}
return $this->displayWarning($this->l('File not found'));
}
示例11: initContent
public function initContent()
{
parent::initContent();
$log_on = Configuration::get('YA_ORG_LOGGING_ON');
if (Tools::getValue('label')) {
$data = explode('_', Tools::getValue('label'));
} else {
$data = explode('_', Tools::getValue('customerNumber'));
}
if (!empty($data) && isset($data[1])) {
$ordernumber = $data['1'];
$this->context->smarty->assign('ordernumber', $ordernumber);
$this->context->smarty->assign('time', date('Y-m-d H:i:s '));
if (!$ordernumber) {
if ($log_on) {
$this->module->logSave('yakassa_success: Error ' . $this->module->l('Cart number is not specified'));
}
$this->setTemplate('error.tpl');
} else {
$cart = new Cart((int) $ordernumber);
$qty = $cart->nbProducts();
$this->context->smarty->assign('nbProducts', $qty);
if (!Validate::isLoadedObject($cart) || $qty < 1) {
if ($log_on) {
$this->module->logSave('yakassa_success: Error ' . $this->module->l('Shopping cart does not exist'));
}
$this->setTemplate('error.tpl');
} else {
$ordernumber = (int) $cart->id;
if (!$ordernumber) {
if ($log_on) {
$this->module->logSave('yakassa_success: Error ' . $this->module->l('Order number is not specified'));
}
$this->setTemplate('error.tpl');
} else {
$order = new Order((int) Order::getOrderByCartId($cart->id));
$customer = new Customer((int) $order->id_customer);
if ($order->hasBeenPaid()) {
if ($log_on) {
$this->module->logSave('yakassa_success: #' . $order->id . ' ' . $this->module->l('Order paid'));
}
Tools::redirectLink(__PS_BASE_URI__ . 'order-confirmation.php?key=' . $customer->secure_key . '&id_cart=' . (int) $order->id_cart . '&id_module=' . (int) $this->module->id . '&id_order=' . (int) $order->id);
} else {
if ($log_on) {
$this->module->logSave('yakassa_success: #' . $order->id . ' ' . $this->module->l('Order wait payment'));
}
$this->setTemplate('waitingPayment.tpl');
}
}
}
}
} else {
if ($log_on) {
$this->module->logSave('yakassa_success: Error ' . $this->module->l('Cart number is not specified'));
}
$this->setTemplate('error.tpl');
}
}
示例12: initContent
public function initContent()
{
parent::initContent();
if (Tools::getIsset('collection_id') && Tools::getValue('collection_id') != 'null') {
// payment variables
$payment_statuses = array();
$payment_ids = array();
$payment_types = array();
$payment_method_ids = array();
$card_holder_names = array();
$four_digits_arr = array();
$statement_descriptors = array();
$status_details = array();
$transaction_amounts = 0;
$collection_ids = split(',', Tools::getValue('collection_id'));
foreach ($collection_ids as $collection_id) {
$mercadopago = $this->module;
$mercadopago_sdk = $mercadopago->mercadopago;
$result = $mercadopago_sdk->getPayment($collection_id);
$payment_info = $result['response']['collection'];
$id_cart = $payment_info['external_reference'];
$cart = new Cart($id_cart);
$payment_statuses[] = $payment_info['status'];
$payment_ids[] = $payment_info['id'];
$payment_types[] = $payment_info['payment_type'];
$payment_method_ids[] = $payment_info['payment_method_id'];
$transaction_amounts += $payment_info['transaction_amount'];
if ($payment_info['payment_type'] == 'credit_card') {
$card_holder_names[] = $payment_info['cardholder']['name'];
$four_digits_arr[] = '**** **** **** ' . $payment_info['last_four_digits'];
$statement_descriptors[] = $payment_info['statement_descriptor'];
$status_details[] = $payment_info['status_detail'];
}
}
if (Validate::isLoadedObject($cart)) {
$order_id = Order::getOrderByCartId($cart->id);
$order = new Order($order_id);
$uri = __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . $order->id_cart . '&id_module=' . $mercadopago->id . '&id_order=' . $order->id . '&key=' . $order->secure_key;
$uri .= '&payment_status=' . $payment_statuses[0];
$uri .= '&payment_id=' . join(" / ", $payment_ids);
$uri .= '&payment_type=' . join(" / ", $payment_types);
$uri .= '&payment_method_id=' . join(" / ", $payment_method_ids);
$uri .= '&amount=' . $transaction_amounts;
if ($payment_info['payment_type'] == 'credit_card') {
$uri .= '&card_holder_name=' . join(" / ", $card_holder_names);
$uri .= '&four_digits=' . join(" / ", $four_digits_arr);
$uri .= '&statement_descriptor=' . $statement_descriptors[0];
$uri .= '&status_detail=' . $status_details[0];
}
Tools::redirectLink($uri);
}
} else {
error_log('External reference is not set. Order placement has failed.');
}
}
示例13: canonicalRedirection
public function canonicalRedirection()
{
if (Validate::isLoadedObject($this->manufacturer) && Configuration::get('PS_CANONICAL_REDIRECT') && strtoupper($_SERVER['REQUEST_METHOD']) == 'GET') {
$canonicalURL = self::$link->getManufacturerLink($this->manufacturer);
if (!preg_match('/^' . Tools::pRegexp($canonicalURL, '/') . '([&?].*)?$/', Tools::getProtocol() . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'])) {
header('HTTP/1.0 301 Moved');
if (defined('_PS_MODE_DEV_') and _PS_MODE_DEV_) {
die('[Debug] This page has moved<br />Please use the following URL instead: <a href="' . $canonicalURL . '">' . $canonicalURL . '</a>');
}
Tools::redirectLink($canonicalURL);
}
}
}
示例14: display
/**
* Executes a request to the PaynetEasy server
* to start the payment process.
*
* If the request is successful, redirects the
* customer to the PaynetEasy payment form.
*
* If the request is made with an error,
* displays an error message.
*/
public function display()
{
$payment_aggregate = new PaymentAggregate($this->module);
$prestashop_cart = $this->context->cart;
$return_url = $this->context->link->getModuleLink('payneteasy', 'finishsale', array('id_cart' => $prestashop_cart->id), true);
try {
$paynet_response = $payment_aggregate->startSale($prestashop_cart, $return_url);
$this->savePaynetPayment($paynet_response, $prestashop_cart);
} catch (Exception $ex) {
$this->createOrderWithErrorPayment($prestashop_cart, $ex->getMessage());
return $this->displayTechnicalError($ex);
}
Tools::redirectLink($paynet_response->getRedirectUrl());
}
示例15: initContent
public function initContent()
{
$this->be_gateway = new beGateway();
if ($this->be_gateway->active && isset($_REQUEST['action'])) {
$action = $_REQUEST['action'];
if ($action == 'callback') {
$this->_processWebhook();
} elseif ($action == 'success') {
$this->_processReturn();
} else {
$this->_processReturn(true);
}
}
Tools::redirectLink(__PS_BASE_URI__ . 'index.php');
}