fix r8189.

Compatibility with PHP4
1. Use is_a function instead of 'instanceof' operator.
2. Use reference operator &.


git-svn-id: http://xe-core.googlecode.com/svn/sandbox@8195 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-03-21 04:52:21 +00:00
parent 029f07428e
commit e112ad0481

View file

@ -205,7 +205,7 @@ class Context {
* @return none * @return none
**/ **/
function loadDBInfo() { function loadDBInfo() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
if(!$self->isInstalled()) return; if(!$self->isInstalled()) return;
@ -224,7 +224,7 @@ class Context {
if($db_info->http_port) $self->set('_http_port', $db_info->http_port); if($db_info->http_port) $self->set('_http_port', $db_info->http_port);
if($db_info->https_port) $self->set('_https_port', $db_info->https_port); if($db_info->https_port) $self->set('_https_port', $db_info->https_port);
$this->setDBInfo($db_info); $self->setDBInfo($db_info);
} }
/** /**
@ -232,7 +232,7 @@ class Context {
* @return DB's db_type string * @return DB's db_type string
**/ **/
function getDBType() { function getDBType() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->db_info->db_type; return $self->db_info->db_type;
} }
@ -242,7 +242,7 @@ class Context {
* @return none * @return none
**/ **/
function setDBInfo($db_info) { function setDBInfo($db_info) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->db_info = $db_info; $self->db_info = $db_info;
} }
@ -251,7 +251,7 @@ class Context {
* @return DB information object * @return DB information object
**/ **/
function getDBInfo() { function getDBInfo() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->db_info; return $self->db_info;
} }
@ -372,7 +372,7 @@ class Context {
* @return FTP information object * @return FTP information object
**/ **/
function getFTPInfo() { function getFTPInfo() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
if(!$self->isFTPRegisted()) return null; if(!$self->isFTPRegisted()) return null;
$ftp_config_file = $self->getFTPConfigFile(); $ftp_config_file = $self->getFTPConfigFile();
@ -388,7 +388,7 @@ class Context {
**/ **/
function addBrowserTitle($site_title) { function addBrowserTitle($site_title) {
if(!$site_title) return; if(!$site_title) return;
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
if($self->site_title) $self->site_title .= ' - '.$site_title; if($self->site_title) $self->site_title .= ' - '.$site_title;
else $self->site_title = $site_title; else $self->site_title = $site_title;
@ -401,7 +401,7 @@ class Context {
**/ **/
function setBrowserTitle($site_title) { function setBrowserTitle($site_title) {
if(!$site_title) return; if(!$site_title) return;
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->site_title = $site_title; $self->site_title = $site_title;
} }
@ -410,7 +410,7 @@ class Context {
* @return browser title string (htmlspecialchars applied) * @return browser title string (htmlspecialchars applied)
**/ **/
function getBrowserTitle() { function getBrowserTitle() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$oModuleController = &getController('module'); $oModuleController = &getController('module');
$oModuleController->replaceDefinedLangCode($self->site_title); $oModuleController->replaceDefinedLangCode($self->site_title);
@ -426,7 +426,7 @@ class Context {
function loadLang($path) { function loadLang($path) {
global $lang; global $lang;
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
if(!is_object($lang)) $lang = new stdClass; if(!is_object($lang)) $lang = new stdClass;
if(!$self->lang_type) return; if(!$self->lang_type) return;
@ -451,7 +451,7 @@ class Context {
* @return none * @return none
**/ **/
function setLangType($lang_type = 'ko') { function setLangType($lang_type = 'ko') {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->lang_type = $lang_type; $self->lang_type = $lang_type;
$self->set('lang_type', $lang_type); $self->set('lang_type', $lang_type);
@ -464,7 +464,7 @@ class Context {
* @return lang_type string * @return lang_type string
**/ **/
function getLangType() { function getLangType() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->lang_type; return $self->lang_type;
} }
@ -539,7 +539,7 @@ class Context {
* @return none * @return none
**/ **/
function setResponseMethod($method = "HTML") { function setResponseMethod($method = "HTML") {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$methods = array('HTML','XMLRPC','JSON'); $methods = array('HTML','XMLRPC','JSON');
$self->response_method = in_array($method, $methods)?$method:$methods[0]; $self->response_method = in_array($method, $methods)?$method:$methods[0];
@ -550,7 +550,7 @@ class Context {
* @return response method string (if it's not set, returns request method) * @return response method string (if it's not set, returns request method)
*/ */
function getResponseMethod() { function getResponseMethod() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
if($self->response_method) return $self->response_method; if($self->response_method) return $self->response_method;
@ -566,7 +566,7 @@ class Context {
* @return none * @return none
**/ **/
function setRequestMethod($type) { function setRequestMethod($type) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
($type && $self->request_method=$type) or ($type && $self->request_method=$type) or
(strpos($_SERVER['CONTENT_TYPE'],'json') && $this->request_method='JSON') or (strpos($_SERVER['CONTENT_TYPE'],'json') && $this->request_method='JSON') or
@ -657,7 +657,7 @@ class Context {
* @return true: exists, false: otherwise * @return true: exists, false: otherwise
**/ **/
function isUploaded() { function isUploaded() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->is_uploaded; return $self->is_uploaded;
} }
@ -683,7 +683,7 @@ class Context {
* @return request method type * @return request method type
**/ **/
function getRequestMethod() { function getRequestMethod() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->request_method; return $self->request_method;
} }
@ -711,7 +711,7 @@ class Context {
static $site_module_info = null; static $site_module_info = null;
static $current_info = null; static $current_info = null;
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
// retrieve virtual site information // retrieve virtual site information
if(is_null($site_module_info)) $site_module_info = Context::get('site_module_info'); if(is_null($site_module_info)) $site_module_info = Context::get('site_module_info');
@ -910,7 +910,7 @@ class Context {
* @brief key/val로 context vars 세팅 * @brief key/val로 context vars 세팅
**/ **/
function set($key, $val, $set_to_get_vars = false) { function set($key, $val, $set_to_get_vars = false) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->context->{$key} = $val; $self->context->{$key} = $val;
if($set_to_get_vars || $self->get_vars->{$key}) $self->get_vars->{$key} = $val; if($set_to_get_vars || $self->get_vars->{$key}) $self->get_vars->{$key} = $val;
} }
@ -919,7 +919,7 @@ class Context {
* @brief key값에 해당하는 값을 return * @brief key값에 해당하는 값을 return
**/ **/
function get($key) { function get($key) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->context->{$key}; return $self->context->{$key};
} }
@ -931,7 +931,7 @@ class Context {
function gets() { function gets() {
$num_args = func_num_args(); $num_args = func_num_args();
if($num_args<1) return; if($num_args<1) return;
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$args_list = func_get_args(); $args_list = func_get_args();
foreach($args_list as $v) { foreach($args_list as $v) {
@ -944,7 +944,7 @@ class Context {
* @brief 모든 데이터를 return * @brief 모든 데이터를 return
**/ **/
function getAll() { function getAll() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->context; return $self->context;
} }
@ -952,7 +952,7 @@ class Context {
* @brief GET/POST/XMLRPC에서 넘어온 변수값을 return * @brief GET/POST/XMLRPC에서 넘어온 변수값을 return
**/ **/
function getRequestVars() { function getRequestVars() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return clone($self->get_vars); return clone($self->get_vars);
} }
@ -961,18 +961,18 @@ class Context {
* common/js/xml_handler.js에서 action들에 대해서 https로 전송되도록 * common/js/xml_handler.js에서 action들에 대해서 https로 전송되도록
**/ **/
function addSSLAction($action) { function addSSLAction($action) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
if(in_array($action, $self->ssl_actions)) return; if(in_array($action, $self->ssl_actions)) return;
$self->ssl_actions[] = $action; $self->ssl_actions[] = $action;
} }
function getSSLActions() { function getSSLActions() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->ssl_actions; return $self->ssl_actions;
} }
function isExistsSSLAction($action) { function isExistsSSLAction($action) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return in_array($action, $self->ssl_actions); return in_array($action, $self->ssl_actions);
} }
@ -992,7 +992,7 @@ class Context {
* @brief js file을 추가 * @brief js file을 추가
**/ **/
function addJsFile($file, $optimized = false, $targetie = '',$index=null, $type='head') { function addJsFile($file, $optimized = false, $targetie = '',$index=null, $type='head') {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$avail_types = array('head', 'body'); $avail_types = array('head', 'body');
if(!in_array($type, $avail_types)) $type = $avail_types[0]; if(!in_array($type, $avail_types)) $type = $avail_types[0];
@ -1012,7 +1012,7 @@ class Context {
* @brief js file을 제거 * @brief js file을 제거
**/ **/
function unloadJsFile($file, $optimized = false, $targetie = '') { function unloadJsFile($file, $optimized = false, $targetie = '') {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$realfile = realpath($file); $realfile = realpath($file);
@ -1029,7 +1029,7 @@ class Context {
* @brief unload all javascript files * @brief unload all javascript files
**/ **/
function unloadAllJsFiles() { function unloadAllJsFiles() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->js_files = array(); $self->js_files = array();
$self->js_files_map = array(); $self->js_files_map = array();
} }
@ -1063,7 +1063,7 @@ class Context {
* @brief returns the list of javascripts that matches the given type. * @brief returns the list of javascripts that matches the given type.
**/ **/
function getJsFile($type='head') { function getJsFile($type='head') {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
ksort($self->js_files); ksort($self->js_files);
@ -1079,7 +1079,7 @@ class Context {
* @brief CSS file 추가 * @brief CSS file 추가
**/ **/
function addCSSFile($file, $optimized = false, $media = 'all', $targetie = '',$index = null) { function addCSSFile($file, $optimized = false, $media = 'all', $targetie = '',$index = null) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$file = $self->normalizeFilePath($file); $file = $self->normalizeFilePath($file);
@ -1096,7 +1096,7 @@ class Context {
* @brief css file을 제거 * @brief css file을 제거
**/ **/
function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') { function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$realfile = realpath($file); $realfile = realpath($file);
@ -1113,7 +1113,7 @@ class Context {
* @brief unload all css files * @brief unload all css files
**/ **/
function unloadAllCSSFiles() { function unloadAllCSSFiles() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->css_files = array(); $self->css_files = array();
$self->css_files_map = array(); $self->css_files_map = array();
} }
@ -1122,7 +1122,7 @@ class Context {
* @brief CSS file 목록 return * @brief CSS file 목록 return
**/ **/
function getCSSFile() { function getCSSFile() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
ksort($self->css_files); ksort($self->css_files);
return array_values($self->css_files); return array_values($self->css_files);
} }
@ -1133,7 +1133,7 @@ class Context {
function loadJavascriptPlugin($plugin_name) { function loadJavascriptPlugin($plugin_name) {
static $loaded_plugins = array(); static $loaded_plugins = array();
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
if($plugin_name == 'ui.datepicker') $plugin_name = 'ui'; if($plugin_name == 'ui.datepicker') $plugin_name = 'ui';
if($loaded_plugins[$plugin_name]) return; if($loaded_plugins[$plugin_name]) return;
@ -1160,7 +1160,7 @@ class Context {
* @brief HtmlHeader 추가 * @brief HtmlHeader 추가
**/ **/
function addHtmlHeader($header) { function addHtmlHeader($header) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->html_header .= "\n".$header; $self->html_header .= "\n".$header;
} }
@ -1168,7 +1168,7 @@ class Context {
* @brief HtmlHeader return * @brief HtmlHeader return
**/ **/
function getHtmlHeader() { function getHtmlHeader() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->html_header; return $self->html_header;
} }
@ -1176,7 +1176,7 @@ class Context {
* @brief Html Body에 css class 추가 * @brief Html Body에 css class 추가
**/ **/
function addBodyClass($class_name) { function addBodyClass($class_name) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->body_class[] = $class_name; $self->body_class[] = $class_name;
} }
@ -1184,7 +1184,7 @@ class Context {
* @brief Html Body에 css class return * @brief Html Body에 css class return
**/ **/
function getBodyClass() { function getBodyClass() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->body_class = array_unique($self->body_class); $self->body_class = array_unique($self->body_class);
return count($self->body_class)?sprintf(' class="%s"', implode(' ',$self->body_class)):''; return count($self->body_class)?sprintf(' class="%s"', implode(' ',$self->body_class)):'';
@ -1194,7 +1194,7 @@ class Context {
* @brief BodyHeader 추가 * @brief BodyHeader 추가
**/ **/
function addBodyHeader($header) { function addBodyHeader($header) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->body_header .= "\n".$header; $self->body_header .= "\n".$header;
} }
@ -1202,7 +1202,7 @@ class Context {
* @brief BodyHeader return * @brief BodyHeader return
**/ **/
function getBodyHeader() { function getBodyHeader() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->body_header; return $self->body_header;
} }
@ -1210,7 +1210,7 @@ class Context {
* @brief HtmlFooter 추가 * @brief HtmlFooter 추가
**/ **/
function addHtmlFooter($footer) { function addHtmlFooter($footer) {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
$self->html_footer .= ($self->Htmlfooter?"\n":'').$footer; $self->html_footer .= ($self->Htmlfooter?"\n":'').$footer;
} }
@ -1218,7 +1218,7 @@ class Context {
* @brief HtmlFooter return * @brief HtmlFooter return
**/ **/
function getHtmlFooter() { function getHtmlFooter() {
$self = ($this instanceof Context)?$this:Context::getInstance(); is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
return $self->html_footer; return $self->html_footer;
} }
@ -1295,4 +1295,4 @@ class Context {
return $path; return $path;
} }
} }
?> ?>