XE index.php 파일 분석 : 주석을 제거하면 아래와 같습니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | define( '__NURI__' , TRUE); define( '__XE__' , TRUE); require dirname( __FILE__ ) . '/config/config.inc.php' ; $oContext = &Context::getInstance(); $oContext ->init(); if ( $oContext ->checkSSO()) { $oModuleHandler = new ModuleHandler(); try { if ( $oModuleHandler ->init()) { $oModule = & $oModuleHandler ->procModule(); $oModuleHandler ->displayContent( $oModule ); } } catch (Exception $e ) { htmlHeader(); echo Context::getLang( $e ->getMessage()); htmlFooter(); } } $oContext ->close(); |
$oContext = &Context::getInstance();
Context 객체의 getInstance() 함수를 $oContext에 할당합니다.
그러면 Context 객체의 getInstance() 함수를 살펴 봅니다.
1 2 3 4 5 6 7 8 | function &getInstance() { static $theInstance = null; if (! $theInstance ) { $theInstance = new Context(); } return $theInstance ; } |
$theInstance 변수에 null을 선언하고, $theInstance에 Context()함수를 실행하여 이에 대한 결과를 할당합니다.
Context() 함수 분석
1 2 3 4 5 6 7 8 9 10 11 12 | function Context() { $this ->oFrontEndFileHandler = new FrontEndFileHandler(); $this ->get_vars = new stdClass(); $this ->sslActionCacheFile = FileHandler::getRealPath( $this ->sslActionCacheFile); if ( is_readable ( $this ->sslActionCacheFile)) { require_once ( $this ->sslActionCacheFile); if (isset( $sslActions )) { $this ->ssl_actions = $sslActions ; } } } |
$this->oFrontEndFileHandler은 Context()에 FrontEndFileHandler 클래스 할당.
특별한건 없으며, classes 폴더 frontendfile 폴더에 FrontEndFileHandler.class.php 파일의 클래스 호출
아래와 같은 텅빈 배열함수만 할당된다~
var $cssMap = array();
var $jsHeadMap = array();
var $jsBodyMap = array();
var $cssMapIndex = array();
var $jsHeadMapIndex = array();
var $jsBodyMapIndex = array();
$this->get_vars = new stdClass();은 stdClass()라는게 없어서 그냥 할당됨~
index.php파일의 $oContext = &Context::getInstance(); 까지 실행된 부분을 debugPrint($oContext); 로 찍어보면 아래와 같다.
앞서 설명한대로 Context 객체에 있는 변수들을 기본적으로 $oContext에 불러오게 된다.
불러온것은 알겠는데... 아직까지 각각 정확히 어느곳에 쓰이는 지는 이후부터 나오게 되겠죠? (저도 잘 몰라요~ 지금 분석하면서 글 쓰는 겁니다. -0-)
$oContext->init(); 에 대한 추적시작~ 여기서 부터 양이 좀 많네요~ 다음 글에서...