Context::함수명 처럼 쓰일 수 있는 함수들에 static 적용

Context클래스의 함수 내부에서 $this 변수가 사용되지 않거나, is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); 를 통해 $self 변수를 이용하는 경우 static 변수를 붙임.
This commit is contained in:
조태상 2015-02-11 17:31:25 +09:00
parent 85db859fd3
commit e30506b935

View file

@ -159,7 +159,7 @@ class Context
*
* @return object Instance
*/
function &getInstance()
static function &getInstance()
{
static $theInstance = null;
if(!$theInstance)
@ -410,7 +410,7 @@ class Context
*
* @return void
*/
function loadDBInfo()
static function loadDBInfo()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -496,7 +496,7 @@ class Context
*
* @return string DB's db_type
*/
function getDBType()
static function getDBType()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->db_info->master_db["db_type"];
@ -508,7 +508,7 @@ class Context
* @param object $db_info DB information
* @return void
*/
function setDBInfo($db_info)
static function setDBInfo($db_info)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->db_info = $db_info;
@ -519,7 +519,7 @@ class Context
*
* @return object DB information
*/
function getDBInfo()
static function getDBInfo()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->db_info;
@ -530,7 +530,7 @@ class Context
*
* @return object SSL status (Optional - none|always|optional)
*/
function getSslStatus()
static function getSslStatus()
{
$dbInfo = self::getDBInfo();
return $dbInfo->use_ssl;
@ -541,7 +541,7 @@ class Context
*
* @return string Default URL
*/
function getDefaultUrl()
static function getDefaultUrl()
{
$db_info = self::getDBInfo();
return $db_info->default_url;
@ -552,7 +552,7 @@ class Context
*
* @return array Supported languages
*/
function loadLangSupported()
static function loadLangSupported()
{
static $lang_supported = null;
if(!$lang_supported)
@ -573,7 +573,7 @@ class Context
*
* @return array Selected languages
*/
function loadLangSelected()
static function loadLangSelected()
{
static $lang_selected = null;
if(!$lang_selected)
@ -679,7 +679,7 @@ class Context
*
* @return bool True: FTP information is registered, False: otherwise
*/
function isFTPRegisted()
static function isFTPRegisted()
{
return file_exists(self::getFTPConfigFile());
}
@ -689,7 +689,7 @@ class Context
*
* @return object FTP information
*/
function getFTPInfo()
static function getFTPInfo()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -709,7 +709,7 @@ class Context
* @param string $site_title Browser title to be added
* @return void
*/
function addBrowserTitle($site_title)
static function addBrowserTitle($site_title)
{
if(!$site_title)
{
@ -733,7 +733,7 @@ class Context
* @param string $site_title Browser title to be set
* @return void
*/
function setBrowserTitle($site_title)
static function setBrowserTitle($site_title)
{
if(!$site_title)
{
@ -748,7 +748,7 @@ class Context
*
* @return string Browser title(htmlspecialchars applied)
*/
function getBrowserTitle()
static function getBrowserTitle()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -762,7 +762,7 @@ class Context
* Return layout's title
* @return string layout's title
*/
public function getSiteTitle()
static public function getSiteTitle()
{
$oModuleModel = getModel('module');
$moduleConfig = $oModuleModel->getModuleConfig('module');
@ -789,7 +789,7 @@ class Context
* @param string $path Path of the language file
* @return void
*/
function loadLang($path)
static function loadLang($path)
{
global $lang;
@ -912,7 +912,7 @@ class Context
* @param string $lang_type Language type.
* @return void
*/
function setLangType($lang_type = 'ko')
static function setLangType($lang_type = 'ko')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -927,7 +927,7 @@ class Context
*
* @return string Language type
*/
function getLangType()
static function getLangType()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->lang_type;
@ -939,7 +939,7 @@ class Context
* @param string $code Language variable name
* @return string If string for the code exists returns it, otherwise returns original code
*/
function getLang($code)
static function getLang($code)
{
if(!$code)
{
@ -959,7 +959,7 @@ class Context
* @param string $val `$code`s value
* @return void
*/
function setLang($code, $val)
static function setLang($code, $val)
{
if(!isset($GLOBALS['lang']))
{
@ -974,7 +974,7 @@ class Context
* @param object $source_obj Conatins strings to convert
* @return object converted object
*/
function convertEncoding($source_obj)
static function convertEncoding($source_obj)
{
$charset_list = array(
'UTF-8', 'EUC-KR', 'CP949', 'ISO8859-1', 'EUC-JP', 'SHIFT_JIS', 'CP932',
@ -1015,7 +1015,7 @@ class Context
* @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
* @return void
*/
function checkConvertFlag(&$val, $key = null, $charset = null)
static function checkConvertFlag(&$val, $key = null, $charset = null)
{
static $flag = TRUE;
if($charset)
@ -1042,7 +1042,7 @@ class Context
* @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5
* @return object converted object
*/
function doConvertEncoding(&$val, $key = null, $charset)
static function doConvertEncoding(&$val, $key = null, $charset)
{
if (is_array($val))
{
@ -1057,7 +1057,7 @@ class Context
* @param string $str String to convert
* @return string converted string
*/
function convertEncodingStr($str)
static function convertEncodingStr($str)
{
$obj = new stdClass();
$obj->str = $str;
@ -1071,7 +1071,7 @@ class Context
* @param string $method Response method. [HTML|XMLRPC|JSON]
* @return void
*/
function setResponseMethod($method = 'HTML')
static function setResponseMethod($method = 'HTML')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1084,7 +1084,7 @@ class Context
*
* @return string Response method. If it's not set, returns request method.
*/
function getResponseMethod()
static function getResponseMethod()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1105,7 +1105,7 @@ class Context
* @param string $type Request method. (Optional - GET|POST|XMLRPC|JSON)
* @return void
*/
function setRequestMethod($type = '')
static function setRequestMethod($type = '')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1295,7 +1295,7 @@ class Context
*
* @return bool True: exists, False: otherwise
*/
function isUploaded()
static function isUploaded()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->is_uploaded;
@ -1349,7 +1349,7 @@ class Context
* Return request method
* @return string Request method type. (Optional - GET|POST|XMLRPC|JSON)
*/
function getRequestMethod()
static function getRequestMethod()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->request_method;
@ -1359,7 +1359,7 @@ class Context
* Return request URL
* @return string request URL
*/
function getRequestUrl()
static function getRequestUrl()
{
static $url = null;
if(is_null($url))
@ -1381,7 +1381,7 @@ class Context
* Return js callback func.
* @return string callback func.
*/
function getJSCallbackFunc()
static function getJSCallbackFunc()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->js_callback_func;
@ -1397,7 +1397,7 @@ class Context
* @param bool $autoEncode If TRUE, url encode automatically, detailed. Use this option, $encode value should be TRUE
* @return string URL
*/
function getUrl($num_args = 0, $args_list = array(), $domain = null, $encode = TRUE, $autoEncode = FALSE)
static function getUrl($num_args = 0, $args_list = array(), $domain = null, $encode = TRUE, $autoEncode = FALSE)
{
static $site_module_info = null;
static $current_info = null;
@ -1638,7 +1638,7 @@ class Context
* @param string $domain Domain
* @retrun string converted URL
*/
function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null)
static function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null)
{
static $url = array();
@ -1737,7 +1737,7 @@ class Context
* @param mixed $set_to_get_vars If not FALSE, Set to get vars.
* @return void
*/
function set($key, $val, $set_to_get_vars = 0)
static function set($key, $val, $set_to_get_vars = 0)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->context->{$key} = $val;
@ -1762,7 +1762,7 @@ class Context
* @param string $key Key
* @return string Key
*/
function get($key)
static function get($key)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1778,7 +1778,7 @@ class Context
*
* @return object
*/
function gets()
static function gets()
{
$num_args = func_num_args();
if($num_args < 1)
@ -1801,7 +1801,7 @@ class Context
*
* @return object All data
*/
function getAll()
static function getAll()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->context;
@ -1812,7 +1812,7 @@ class Context
*
* @return Object Request variables.
*/
function getRequestVars()
static function getRequestVars()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
if($self->get_vars)
@ -1828,7 +1828,7 @@ class Context
* @param string $action act name
* @return void
*/
function addSSLAction($action)
static function addSSLAction($action)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1852,7 +1852,7 @@ class Context
* @param string $action act name
* @return void
*/
function addSSLActions($action_array)
static function addSSLActions($action_array)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1880,7 +1880,7 @@ class Context
* @param string $action act name
* @return void
*/
function subtractSSLAction($action)
static function subtractSSLAction($action)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1898,7 +1898,7 @@ class Context
*
* @return string acts in array
*/
function getSSLActions()
static function getSSLActions()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
if($self->getSslStatus() == 'optional')
@ -1913,7 +1913,7 @@ class Context
* @param string $action act name
* @return bool If SSL exists, return TRUE.
*/
function isExistsSSLAction($action)
static function isExistsSSLAction($action)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return isset($self->ssl_actions[$action]);
@ -1926,7 +1926,7 @@ class Context
* @param string $file file path
* @return string normalized file path
*/
function normalizeFilePath($file)
static function normalizeFilePath($file)
{
if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
{
@ -1948,7 +1948,7 @@ class Context
* @param string $file file path
* @return string Converted file path
*/
function getAbsFileUrl($file)
static function getAbsFileUrl($file)
{
$file = self::normalizeFilePath($file);
if(strpos($file, './') === 0)
@ -1979,7 +1979,7 @@ class Context
* $args[3]: index
*
*/
function loadFile($args)
static function loadFile($args)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -1994,7 +1994,7 @@ class Context
* @param string $media Media query
* @return void
*/
function unloadFile($file, $targetIe = '', $media = 'all')
static function unloadFile($file, $targetIe = '', $media = 'all')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetIe, $media);
@ -2006,7 +2006,7 @@ class Context
* @param string $type Unload target (optional - all|css|js)
* @return void
*/
function unloadAllFiles($type = 'all')
static function unloadAllFiles($type = 'all')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadAllFiles($type);
@ -2025,7 +2025,7 @@ class Context
* @param string $autoPath If path not readed, set the path automatically.
* @return void
*/
function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
static function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null)
{
if($isRuleset)
{
@ -2055,7 +2055,7 @@ class Context
* @param string $targetie target IE
* @return void
*/
function unloadJsFile($file, $optimized = FALSE, $targetie = '')
static function unloadJsFile($file, $optimized = FALSE, $targetie = '')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetie);
@ -2066,7 +2066,7 @@ class Context
*
* @return void
*/
function unloadAllJsFiles()
static function unloadAllJsFiles()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadAllFiles('js');
@ -2079,7 +2079,7 @@ class Context
* @param string $filename File name
* @return void
*/
function addJsFilter($path, $filename)
static function addJsFilter($path, $filename)
{
$oXmlFilter = new XmlJSFilter($path, $filename);
$oXmlFilter->compile();
@ -2092,7 +2092,7 @@ class Context
* @param array $files File list
* @return array File list
*/
function _getUniqueFileList($files)
static function _getUniqueFileList($files)
{
ksort($files);
$files = array_values($files);
@ -2115,7 +2115,7 @@ class Context
* @param string $type Added position. (head:<head>..</head>, body:<body>..</body>)
* @return array Returns javascript file list. Array contains file, targetie.
*/
function getJsFile($type = 'head')
static function getJsFile($type = 'head')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->oFrontEndFileHandler->getJsFileList($type);
@ -2133,7 +2133,7 @@ class Context
* @return void
*
*/
function addCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '', $index = 0)
static function addCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '', $index = 0)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->loadFile(array($file, $media, $targetie, $index));
@ -2149,7 +2149,7 @@ class Context
* @param string $targetie target IE
* @return void
*/
function unloadCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '')
static function unloadCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '')
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadFile($file, $targetie, $media);
@ -2160,7 +2160,7 @@ class Context
*
* @return void
*/
function unloadAllCSSFiles()
static function unloadAllCSSFiles()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->oFrontEndFileHandler->unloadAllFiles('css');
@ -2171,7 +2171,7 @@ class Context
*
* @return array Returns css file list. Array contains file, media, targetie.
*/
function getCSSFile()
static function getCSSFile()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->oFrontEndFileHandler->getCssFileList();
@ -2182,7 +2182,7 @@ class Context
* @param string $pluginName
* @return stdClass
*/
function getJavascriptPluginInfo($pluginName)
static function getJavascriptPluginInfo($pluginName)
{
if($plugin_name == 'ui.datepicker')
{
@ -2237,7 +2237,7 @@ class Context
* @param string $plugin_name plugin name
* @return void
*/
function loadJavascriptPlugin($plugin_name)
static function loadJavascriptPlugin($plugin_name)
{
static $loaded_plugins = array();
@ -2295,13 +2295,13 @@ class Context
* @param string $header add html code before </head>.
* @return void
*/
function addHtmlHeader($header)
static function addHtmlHeader($header)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->html_header .= "\n" . $header;
}
function clearHtmlHeader()
static function clearHtmlHeader()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->html_header = '';
@ -2312,7 +2312,7 @@ class Context
*
* @return string Added html code before </head>
*/
function getHtmlHeader()
static function getHtmlHeader()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->html_header;
@ -2323,7 +2323,7 @@ class Context
*
* @param string $class_name class name
*/
function addBodyClass($class_name)
static function addBodyClass($class_name)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->body_class[] = $class_name;
@ -2334,7 +2334,7 @@ class Context
*
* @return string Return class to html body
*/
function getBodyClass()
static function getBodyClass()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->body_class = array_unique($self->body_class);
@ -2347,7 +2347,7 @@ class Context
*
* @param string $header Add html code after <body>
*/
function addBodyHeader($header)
static function addBodyHeader($header)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->body_header .= "\n" . $header;
@ -2358,7 +2358,7 @@ class Context
*
* @return string Added html code after <body>
*/
function getBodyHeader()
static function getBodyHeader()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->body_header;
@ -2369,7 +2369,7 @@ class Context
*
* @param string $footer Add html code before </body>
*/
function addHtmlFooter($footer)
static function addHtmlFooter($footer)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer;
@ -2380,7 +2380,7 @@ class Context
*
* @return string Added html code before </body>
*/
function getHtmlFooter()
static function getHtmlFooter()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
return $self->html_footer;
@ -2391,7 +2391,7 @@ class Context
*
* @retrun string The path of the config file that contains database settings
*/
function getConfigFile()
static function getConfigFile()
{
return _XE_PATH_ . 'files/config/db.config.php';
}
@ -2401,7 +2401,7 @@ class Context
*
* @return string The path of the config file that contains FTP settings
*/
function getFTPConfigFile()
static function getFTPConfigFile()
{
return _XE_PATH_ . 'files/config/ftp.config.php';
}
@ -2411,7 +2411,7 @@ class Context
*
* @return bool True if the config file exists, otherwise FALSE.
*/
function isInstalled()
static function isInstalled()
{
return FileHandler::hasContent(self::getConfigFile());
}
@ -2422,7 +2422,7 @@ class Context
* @param string Transforms codes
* @return string Transforms codes
*/
function transContent($content)
static function transContent($content)
{
return $content;
}
@ -2432,7 +2432,7 @@ class Context
*
* @return bool True if it is allowed to use rewrite mod, otherwise FALSE
*/
function isAllowRewrite()
static function isAllowRewrite()
{
$oContext = self::getInstance();
return $oContext->allow_rewrite;
@ -2444,7 +2444,7 @@ class Context
* @param string $path URL path
* @return string Converted path
*/
function pathToUrl($path)
static function pathToUrl($path)
{
$xe = _XE_PATH_;
$path = strtr($path, "\\", "/");
@ -2499,7 +2499,7 @@ class Context
* Get meta tag
* @return array The list of meta tags
*/
function getMetaTag()
static function getMetaTag()
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
@ -2526,7 +2526,7 @@ class Context
* @param mixed $is_http_equiv value of http_equiv
* @return void
*/
function addMetaTag($name, $content, $is_http_equiv = FALSE)
static function addMetaTag($name, $content, $is_http_equiv = FALSE)
{
is_a($this, 'Context') ? $self = $this : $self = self::getInstance();
$self->meta_tags[$name . "\t" . ($is_http_equiv ? '1' : '0')] = $content;