Changeset 19705


Ignore:
Timestamp:
2010/12/02 18:14:39 (13 years ago)
Author:
nanasess
bzr:base-revision:
svn-v4:1e3b908f-19a9-db11-a64c-001125224ba8:branches/version-2_5-dev:19704
bzr:committer:
Kentaro Ohkouchi <ohkouchi@loop-az.jp>
bzr:file-ids:

data/class/SC_Display.php 18986@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcamp%2Fcamp-2_5-E%2Fdata%2Fclass%2FSC_Display.php
data/class/SC_Response.php 18986@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcamp%2Fcamp-2_5-E%2Fdata%2Fclass%2FSC_Response.php
data/class/SC_SmartphoneUserAgent.php 19029@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Fcamp%2Fcamp-2_5-E%2Fdata%2Fclass%2FSC_SmartphoneUserAgent.php
data/class/pages/LC_Page.php 15078@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2FLC_Page.php
data/class/pages/admin/LC_Page_Admin.php 15280@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fadmin%2FLC_Page_Admin.php
bzr:mapping-version:
v4
bzr:repository-uuid:
1e3b908f-19a9-db11-a64c-001125224ba8
bzr:revision-id:
ohkouchi@loop-az.jp-20101202091436-vcp9ha97310kgcx0
bzr:revno:
2434
bzr:revprop:branch-nick:
branches/version-2_5-dev
bzr:root:
branches/version-2_5-dev
bzr:timestamp:
2010-12-02 18:14:36.931999922 +0900
bzr:user-agent:
bzr2.2.1+bzr-svn1.0.4
svn:original-date:
2010-12-02T09:14:36.932000Z
Message:

#627(ソース整形・ソースコメントの改善)

  • 仮定義の関数名を修正
  • フォーマットを修正
Location:
branches/version-2_5-dev/data/class
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/class/SC_Display.php

    r19683 r19705  
    11<?php 
    2 // TODO GPLのあれ 
     2/* 
     3 * This file is part of EC-CUBE 
     4 * 
     5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. 
     6 * 
     7 * http://www.lockon.co.jp/ 
     8 * 
     9 * This program is free software; you can redistribute it and/or 
     10 * modify it under the terms of the GNU General Public License 
     11 * as published by the Free Software Foundation; either version 2 
     12 * of the License, or (at your option) any later version. 
     13 * 
     14 * This program is distributed in the hope that it will be useful, 
     15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     17 * GNU General Public License for more details. 
     18 * 
     19 * You should have received a copy of the GNU General Public License 
     20 * along with this program; if not, write to the Free Software 
     21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     22 */ 
     23 
     24/** 
     25 * Http コンテンツ出力を制御するクラス. 
     26 * 
     27 * @author Ryuichi Tokugami 
     28 * @version $Id$ 
     29 */ 
    330class SC_Display{ 
    431 
     
    936    var $autoSet; 
    1037 
    11     /** 
    12      * 
    13      * @var SC_View 
     38    /** SC_View インスタンス */ 
     39    var $view; 
     40 
     41    var $deviceSeted = false; 
     42 
     43    /* 
     44     * TODO php4を捨てたときに ここのコメントアウトを外してね。 
     45     * const('MOBILE',1); 
     46     * const('SMARTPHONE',2); 
     47     * const('PC',4); 
     48     * const('ADMIN',8); 
    1449     */ 
    15     var $view; 
    16          
    17     var $deviceSeted = false; 
    18      
    19     // TODO php4を捨てたときに ここのコメントアウトを外してね。 
    20     /* 
    21     * const('MOBILE',1); 
    22     * const('SMARTPHONE',2); 
    23     * const('PC',4); 
    24     * const('ADMIN',8); 
    25     */ 
    26     function SC_Display($setPrevURL=true,$autoGenerateHttpHeaders = true){ 
    27         require_once(CLASS_EX_PATH."/SC_Response_Ex.php"); 
     50 
     51    function SC_Display($hasPrevURL = true, $autoGenerateHttpHeaders = true) { 
     52        require_once(CLASS_EX_PATH . "SC_Response_Ex.php"); 
    2853        $this->response = new SC_Response_Ex(); 
    2954        $this->autoSet = $autoGenerateHttpHeaders; 
    30         if ($setPrevURL) { 
     55        if ($hasPrevURL) { 
    3156            $this->setPrevURL(); 
    3257        } 
    3358    } 
    34      
     59 
    3560    function setPrevURL(){ 
     61        // TODO SC_SiteSession で実装した方が良さげ 
    3662        $objCartSess = new SC_CartSession(); 
    3763        $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 
    38  
    3964    } 
    4065 
    41  
    42     // TODO このメソッドは、レスポンスを返すためのメソッドです。名前を絶対に変えましょう。 
    4366    /** 
    44     * 
    45     * @param $page LC_Page 
    46     */ 
    47     function hoge($page, $is_admin = false){ 
     67     * LC_Page のパラメータを, テンプレートに設定し, 出力の準備を行う. 
     68     * 
     69     * @param LC_Page $page LC_Page インスタンス 
     70     * @param $is_admin boolean 管理画面を扱う場合 true 
     71     */ 
     72    function prepare($page, $is_admin = false){ 
    4873        if(!$this->deviceSeted || !is_null($this->view)){ 
    4974            $device = ($is_admin) ? 8 : $this->detectDevice(); 
     
    5378        $this->response->setResposeBody($this->view->getResponse($page->getTemplate())); 
    5479    } 
    55      
     80 
     81    /** 
     82     * リダイレクトを行う. 
     83     * 
     84     * SC_Response::sendRedirect() のラッパーです. 
     85     */ 
    5686    function redirect($location){ 
    5787        $this->response->sendRedirect($location); 
    5888    } 
    59      
     89 
     90    /** 
     91     * リロードを行う. 
     92     * 
     93     * SC_Response::reload() のラッパーです. 
     94     */ 
    6095    function reload($queryString = array(), $removeQueryString = false){ 
    6196        $this->response->reload($queryString, $removeQueryString); 
    6297    } 
    63      
    64     function noAction(){     
     98 
     99    function noAction(){ 
    65100        return; 
    66101    } 
    67      
     102 
     103    /** 
     104     * ヘッダを追加する. 
     105     */ 
    68106    function addHeader($name, $value){ 
    69107        $this->response->addHeader($name, $value); 
     
    75113     */ 
    76114    function setDevice($device=4){ 
    77          
     115 
    78116        switch ($device){ 
    79117            case 1: 
     
    92130        $this->deviceSeted = true; 
    93131    } 
    94      
     132 
     133    /** 
     134     * SC_View インスタンスを設定する. 
     135     */ 
    95136    function setView($view){ 
    96          
    97137        $this->view = $view; 
    98138    } 
     
    135175        $this->view->assignarray($array); 
    136176    } 
    137  
    138  
    139177} 
  • branches/version-2_5-dev/data/class/SC_Response.php

    r19675 r19705  
    11<?php 
    2 // TODO GPLのあれ 
     2/* 
     3 * This file is part of EC-CUBE 
     4 * 
     5 * Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved. 
     6 * 
     7 * http://www.lockon.co.jp/ 
     8 * 
     9 * This program is free software; you can redistribute it and/or 
     10 * modify it under the terms of the GNU General Public License 
     11 * as published by the Free Software Foundation; either version 2 
     12 * of the License, or (at your option) any later version. 
     13 * 
     14 * This program is distributed in the hope that it will be useful, 
     15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     17 * GNU General Public License for more details. 
     18 * 
     19 * You should have received a copy of the GNU General Public License 
     20 * along with this program; if not, write to the Free Software 
     21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
     22 */ 
     23 
     24/** 
     25 * HttpResponse を扱うクラス. 
     26 * 
     27 * @author Ryuichi Tokugami 
     28 * @version $Id$ 
     29 */ 
    330class SC_Response{ 
    431 
    532    /** 
    6      * 
    7      * @var HTTP_Response 
    8      */ 
    9     var $http; 
    10     /** 
    11      * コンテンツタイプ 
     33     * コンテンツタイプ 
    1234     * Enter description here ... 
    1335     * @var unknown_type 
     
    1941 
    2042    var $statusTexts = array( 
    21     '100' => 'Continue', 
    22     '101' => 'Switching Protocols', 
    23     '200' => 'OK', 
    24     '201' => 'Created', 
    25     '202' => 'Accepted', 
    26     '203' => 'Non-Authoritative Information', 
    27     '204' => 'No Content', 
    28     '205' => 'Reset Content', 
    29     '206' => 'Partial Content', 
    30     '300' => 'Multiple Choices', 
    31     '301' => 'Moved Permanently', 
    32     '302' => 'Found', 
    33     '303' => 'See Other', 
    34     '304' => 'Not Modified', 
    35     '305' => 'Use Proxy', 
    36     '306' => '(Unused)', 
    37     '307' => 'Temporary Redirect', 
    38     '400' => 'Bad Request', 
    39     '401' => 'Unauthorized', 
    40     '402' => 'Payment Required', 
    41     '403' => 'Forbidden', 
    42     '404' => 'Not Found', 
    43     '405' => 'Method Not Allowed', 
    44     '406' => 'Not Acceptable', 
    45     '407' => 'Proxy Authentication Required', 
    46     '408' => 'Request Timeout', 
    47     '409' => 'Conflict', 
    48     '410' => 'Gone', 
    49     '411' => 'Length Required', 
    50     '412' => 'Precondition Failed', 
    51     '413' => 'Request Entity Too Large', 
    52     '414' => 'Request-URI Too Long', 
    53     '415' => 'Unsupported Media Type', 
    54     '416' => 'Requested Range Not Satisfiable', 
    55     '417' => 'Expectation Failed', 
    56     '500' => 'Internal Server Error', 
    57     '501' => 'Not Implemented', 
    58     '502' => 'Bad Gateway', 
    59     '503' => 'Service Unavailable', 
    60     '504' => 'Gateway Timeout', 
    61     '505' => 'HTTP Version Not Supported', 
    62     ); 
     43            '100' => 'Continue', 
     44            '101' => 'Switching Protocols', 
     45            '200' => 'OK', 
     46            '201' => 'Created', 
     47            '202' => 'Accepted', 
     48            '203' => 'Non-Authoritative Information', 
     49            '204' => 'No Content', 
     50            '205' => 'Reset Content', 
     51            '206' => 'Partial Content', 
     52            '300' => 'Multiple Choices', 
     53            '301' => 'Moved Permanently', 
     54            '302' => 'Found', 
     55            '303' => 'See Other', 
     56            '304' => 'Not Modified', 
     57            '305' => 'Use Proxy', 
     58            '306' => '(Unused)', 
     59            '307' => 'Temporary Redirect', 
     60            '400' => 'Bad Request', 
     61            '401' => 'Unauthorized', 
     62            '402' => 'Payment Required', 
     63            '403' => 'Forbidden', 
     64            '404' => 'Not Found', 
     65            '405' => 'Method Not Allowed', 
     66            '406' => 'Not Acceptable', 
     67            '407' => 'Proxy Authentication Required', 
     68            '408' => 'Request Timeout', 
     69            '409' => 'Conflict', 
     70            '410' => 'Gone', 
     71            '411' => 'Length Required', 
     72            '412' => 'Precondition Failed', 
     73            '413' => 'Request Entity Too Large', 
     74            '414' => 'Request-URI Too Long', 
     75            '415' => 'Unsupported Media Type', 
     76            '416' => 'Requested Range Not Satisfiable', 
     77            '417' => 'Expectation Failed', 
     78            '500' => 'Internal Server Error', 
     79            '501' => 'Not Implemented', 
     80            '502' => 'Bad Gateway', 
     81            '503' => 'Service Unavailable', 
     82            '504' => 'Gateway Timeout', 
     83            '505' => 'HTTP Version Not Supported', 
     84        ); 
    6385 
    6486 
     
    6991    var $encoding; 
    7092 
    71     function SC_Response(){ 
     93    function SC_Response() { 
    7294    } 
    7395 
    74     function response(){ 
     96    /** 
     97     * レスポンス出力を書き込む. 
     98     */ 
     99    function write() { 
    75100        $this->sendHeader(); 
    76                  
    77101        echo $this->body; 
    78102    } 
    79103 
    80     function sendHeader(){ 
    81         // HTTPのヘッダ 
     104    function sendHeader() { 
     105        // HTTPのヘッ 
    82106        //        header('HTTP/1.1 '.$this->statuscode.' '.$this->statusTexts[$this->statuscode]); 
    83107        foreach ($this->header as $name => $head){ 
     
    87111 
    88112 
    89     function setContentType($contentType){ 
     113    function setContentType($contentType) { 
    90114        $this->header['Content-Type'] = $contentType; 
    91115    } 
     
    95119    } 
    96120 
    97     /* function addDateHdeader($name, $date){ 
    98      * 
    99      * } 
    100      */ 
    101  
    102     function addHeader($name, $value){ 
     121    function addHeader($name, $value) { 
    103122        $this->header[$name] = $value; 
    104123    } 
    105124 
    106     function containsHeader($name){ 
     125    function containsHeader($name) { 
    107126        return isset($this->header[$name]); 
    108127    } 
    109128 
    110     function sendError($errorcode){ 
     129    function sendError($errorcode) { 
    111130        header('HTTP/1.1 '.$errorcode.' '.$this->statusTexts[$errorcode]); 
    112131    } 
    113132 
    114     function sendRedirect($location){ 
     133    function sendRedirect($location) { 
    115134        if (preg_match("/(" . preg_quote(SITE_URL, '/') 
    116135                          . "|" . preg_quote(SSL_URL, '/') . ")/", $location)) { 
     
    152171    } 
    153172 
    154     function setHeader($headers){ 
     173    function setHeader($headers) { 
    155174        $this->header = $headers; 
    156175    } 
    157176 
    158     function setStatus($sc = 202){ 
     177    function setStatus($sc = 202) { 
    159178        $this->statuscode = $sc; 
    160179    } 
  • branches/version-2_5-dev/data/class/SC_SmartphoneUserAgent.php

    r19670 r19705  
    2424 
    2525/** 
    26  * スマートフォンの情報を扱うクラス 
     26 * スマートフォンの情報を扱うクラス. 
    2727 * 
     28 * @auther Yu Nobira 
    2829 */ 
    2930class SC_SmartphoneUserAgent { 
     
    8990        ; 
    9091 
     92        // XXX サニタイズ必要? 
    9193        $url .= (preg_match('|^' . URL_DIR . '(.*)$|', $_SERVER['REQUEST_URI'], $matches)) 
    9294            ? $matches[1] 
  • branches/version-2_5-dev/data/class/pages/LC_Page.php

    r19670 r19705  
    126126        //$this->objPlugin->process($this); 
    127127 
    128         $this->objDisplay->hoge($this); 
    129         $this->objDisplay->response->response(); 
     128        $this->objDisplay->prepare($this); 
     129        $this->objDisplay->response->write(); 
    130130    } 
    131131 
     
    136136     */ 
    137137    function sendResponseCSV($file_name, $data) { 
    138         $this->objDisplay->hoge($this); 
     138        $this->objDisplay->prepare($this); 
    139139        $this->objDisplay->addHeader("Content-disposition", "attachment; filename=${file_name}"); 
    140140        $this->objDisplay->addHeader("Content-type", "application/octet-stream; name=${file_name}"); 
     
    143143 
    144144        $this->objDisplay->response->body = $data; 
    145         $this->objDisplay->response->response(); 
     145        $this->objDisplay->response->write(); 
    146146        exit; 
    147147    } 
  • branches/version-2_5-dev/data/class/pages/admin/LC_Page_Admin.php

    r19670 r19705  
    4949 
    5050        // プラグインクラス生成 
    51         #$this->objPlagin = new SC_Helper_Plugin_Ex(); 
    52         #$this->objPlagin->preProcess($this); 
     51        // $this->objPlagin = new SC_Helper_Plugin_Ex(); 
     52        // $this->objPlagin->preProcess($this); 
    5353    } 
    5454 
     
    6767     */ 
    6868    function sendResponse() { 
    69         $this->objDisplay->hoge($this, true); 
    70         $this->objDisplay->response->response(); 
     69        $this->objDisplay->prepare($this, true); 
     70        $this->objDisplay->response->write(); 
    7171    } 
    72  
    7372 
    7473    /** 
Note: See TracChangeset for help on using the changeset viewer.