Changeset 4260

Show
Ignore:
Timestamp:
06/09/2008 09:11:06 PM (3 months ago)
Author:
wdlee91
Message:

Context::getInstance가 전역 변수 대신 함수 static 변수를 이용하도록 변경

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • sandbox/classes/context/Context.class.php

    r4237 r4260  
    4949 
    5050        /** 
    51          * @brief Context 객체를  GLOBALS 변수에 생성 
     51         * @brief 유일한 Context 객체를 반환 (Singleton) 
    5252         * 
    53          * Context는 어디서든 객체 선언없이 사용하기 위해서 static 하게 사용\n 
    54          * php5라면 GLOBALS가 아닌 static으로 처리 가능 
     53         * Context는 어디서든 객체 선언없이 사용하기 위해서 static 하게 사용 
    5554         **/ 
    5655        function &getInstance() { 
    57             if(!$GLOBALS['__ContextInstance__']) $GLOBALS['__ContextInstance__'] = new Context(); 
    58             return $GLOBALS['__ContextInstance__']; 
     56            static $theInstance = null; 
     57            if(!$theInstance) 
     58                $theInstance = new Context(); 
     59            return $theInstance; 
    5960        } 
    6061