本文整理汇总了PHP中Redirect::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::send方法的具体用法?PHP Redirect::send怎么用?PHP Redirect::send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::send方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
protected function getData()
{
switch ($this->preset) {
case 'pages':
$data = self::getNodeTree();
if (empty($data)) {
$url = 'admin/create/' . $this->type;
if ($parent_id = $this->getParentId()) {
$url .= '/' . $parent_id;
}
$url .= '?destination=CURRENT';
$r = new Redirect($url);
$r->send();
}
return $data;
default:
mcms::debug($this->ctx->get('preset'), $this->ctx);
}
}
示例2: OpenIDVerify
public static function OpenIDVerify($openid)
{
self::includeOpenID();
$consumer = self::getConsumer();
// Begin the OpenID authentication process.
// No auth request means we can't begin OpenID.
if (!($auth_request = $consumer->begin($openid))) {
throw new RuntimeException(t('Не удалось соединиться с провайдером OpenID, ' . 'попробуйте повторить попытку позже.'));
$r = new Redirect('auth/logout.rpc');
$r->send();
}
$sreg_request = Auth_OpenID_SRegRequest::build(array('nickname'), array('fullname', 'email'));
if ($sreg_request) {
$auth_request->addExtension($sreg_request);
}
$policy_uris = empty($_GET['policies']) ? null : $_GET['policies'];
$pape_request = new Auth_OpenID_PAPE_Request($policy_uris);
if ($pape_request) {
$auth_request->addExtension($pape_request);
}
// Redirect the user to the OpenID server for authentication.
// Store the token for this authentication so we can verify the
// response.
// For OpenID 1, send a redirect. For OpenID 2, use a Javascript
// form to send a POST request to the server.
if ($auth_request->shouldSendRedirect()) {
$redirect_url = $auth_request->redirectURL(self::getTrustRoot(), self::getReturnTo($openid));
if (Auth_OpenID::isFailure($redirect_url)) {
// If the redirect URL can't be built, display an error message.
Logger::log("Could not redirect to server: " . $redirect_url->message);
} else {
// Send redirect.
$r = new Redirect($redirect_url);
$r->send();
}
} else {
// Generate form markup and render it.
$form_id = 'openid_message';
$form_html = $auth_request->formMarkup(self::getTrustRoot(), self::getReturnTo($openid), false, array('id' => $form_id));
// Display an error if the form markup couldn't be generated;
// otherwise, render the HTML.
if (Auth_OpenID::isFailure($form_html)) {
Logger::log("Could not redirect to server: " . $form_html->message);
} else {
$page_contents = array("<html><head><title>", "OpenID transaction in progress", "</title></head>", "<body onload='document.getElementById(\"" . $form_id . "\").submit()'>", $form_html, "</body></html>");
print implode("\n", $page_contents);
}
}
}
示例3: redirect
/**
* Перенаправление в контексте CMS.
*
* Позволяет перенаправлять используя относительные урлы (относительно папки,
* в которой установлена CMS).
*
* @param mixed $url текст ссылки, массив или объект url.
* @return void
*/
public function redirect($url, $status = 301, Node $node = null)
{
$url1 = new url($url);
if (empty($_GET['__cleanurls'])) {
if (isset($url1->path)) {
$url1->setarg('q', $url1->path);
$url1->path = null;
}
} elseif (!isset($url1->path)) {
$url1->path = $url1->arg('q');
$url1->setarg('q', null);
}
$next = $url1->getAbsolute($this);
if (null !== $node and $node->id) {
if (!$node->published) {
$mode = 'pending';
} elseif ($node->isNew()) {
$mode = 'created';
} else {
$mode = 'updated';
}
$url = new url($next);
$url->setarg('pending', null);
$url->setarg('created', null);
$url->setarg('updated', null);
if ('%ID' == $url->arg('id')) {
$url->setarg('id', $node->id);
} else {
$url->setarg($mode, $node->id);
$url->setarg('type', $node->class);
}
$next = $url->string();
}
$r = new Redirect($next, $status);
$r->send();
}