当前位置: 首页>>代码示例>>PHP>>正文


PHP Redirect::send方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:19,代码来源:class.admintreehandler.php

示例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);
         }
     }
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:49,代码来源:class.openidmodule.php

示例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();
 }
开发者ID:umonkey,项目名称:molinos-cms,代码行数:45,代码来源:class.context.php


注:本文中的Redirect::send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。