Source for file Redirect.php

Documentation is available at Redirect.php

  1. <?php
  2. // vim: foldmethod=marker
  3. /**
  4.  *  Redirect.php
  5.  *
  6.  *  @author     Yoshinari Takaoka <takaoka@beatcraft.com>
  7.  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
  8.  *  @package    Ethna
  9.  *  @version    $Id: 36a2fd044b7271f64dec8b4e09715bb381ee0405 $
  10.  */
  11.  
  12. // {{{ Ethna_View_Redirect
  13. /**
  14.  *  別のURLへリダイレクトするためのビューの実装
  15.  *
  16.  *  @author     Yoshinari Takaoka <takaoka@beatcraft.com>
  17.  *  @access     public
  18.  *  @package    Ethna
  19.  */
  20. {
  21.     /**#@+
  22.      *  @access private
  23.      */
  24.  
  25.     /**#@-*/
  26.  
  27.     /**
  28.      *  別のURLへリダイレクトするための前処理を行う
  29.      *
  30.      *  @access public
  31.      *  @param  string  $url  リダイレクト先のURL
  32.      */
  33.     public function preforward($url NULL)
  34.     {
  35.         if (is_null($url)) {
  36.             $this->redirect($this->config->get('url'));
  37.         }
  38.         else {
  39.             if ($this->isAbsoluteUrl($url)) {
  40.                 $this->redirect($url);
  41.             }
  42.             else {
  43.                 if (substr($this->config->get('url')-1=== '/'{
  44.                     $base $this->config->get('url');
  45.                 }
  46.                 else {
  47.                     $base $this->config->get('url''/';
  48.                 }
  49.  
  50.                 if (substr($url0=== '/'{
  51.                     $suff substr($url1);
  52.                 }
  53.                 else {
  54.                     $suff $url;
  55.                 }
  56.  
  57.                 $this->redirect($base $suff);
  58.             }
  59.         }
  60.     }
  61.  
  62.     public function isAbsoluteUrl($url)
  63.     {
  64.         if (preg_match("@^(https?|ftp)://.+@"$url)) {
  65.             return true;
  66.         }
  67.         else {
  68.             return false;
  69.         }
  70.     }
  71.  
  72.     /**
  73.      *  遷移名に対応する画面を出力する
  74.      *
  75.      *  @access public
  76.      */
  77.     public function forward()
  78.     {
  79.          // do nothing.
  80.     }
  81. }
  82. // }}}

Documentation generated on Fri, 11 Nov 2011 03:58:59 +0900 by phpDocumentor 1.4.3