diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 94f762dbe..424028695 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -159,7 +159,7 @@ class Context * * @return object Instance */ - function &getInstance() + public static function &getInstance() { static $theInstance = null; if(!$theInstance) @@ -175,7 +175,7 @@ class Context * * @return void */ - function Context() + public function Context() { $this->oFrontEndFileHandler = new FrontEndFileHandler(); $this->get_vars = new stdClass(); @@ -198,7 +198,7 @@ class Context * @see This function should be called only once * @return void */ - function init() + public function init() { if(!isset($GLOBALS['HTTP_RAW_POST_DATA']) && version_compare(PHP_VERSION, '5.6.0', '>=') === true) { if(simplexml_load_string(file_get_contents("php://input")) !== false) $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents("php://input"); @@ -425,7 +425,7 @@ class Context * * @return void */ - function close() + public static function close() { session_write_close(); } @@ -435,7 +435,7 @@ class Context * * @return void */ - function loadDBInfo() + public static function loadDBInfo() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -498,7 +498,7 @@ class Context $db_info->use_db_session = 'N'; if(!$db_info->use_ssl) $db_info->use_ssl = 'none'; - $this->set('_use_ssl', $db_info->use_ssl); + $self->set('_use_ssl', $db_info->use_ssl); $self->set('_http_port', ($db_info->http_port) ? $db_info->http_port : NULL); $self->set('_https_port', ($db_info->https_port) ? $db_info->https_port : NULL); @@ -519,7 +519,7 @@ class Context * * @return string DB's db_type */ - function getDBType() + public static function getDBType() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->db_info->master_db["db_type"]; @@ -531,7 +531,7 @@ class Context * @param object $db_info DB information * @return void */ - function setDBInfo($db_info) + public static function setDBInfo($db_info) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->db_info = $db_info; @@ -542,7 +542,7 @@ class Context * * @return object DB information */ - function getDBInfo() + public static function getDBInfo() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->db_info; @@ -553,7 +553,7 @@ class Context * * @return object SSL status (Optional - none|always|optional) */ - function getSslStatus() + public static function getSslStatus() { $dbInfo = self::getDBInfo(); return $dbInfo->use_ssl; @@ -564,7 +564,7 @@ class Context * * @return string Default URL */ - function getDefaultUrl() + public static function getDefaultUrl() { $db_info = self::getDBInfo(); return $db_info->default_url; @@ -575,7 +575,7 @@ class Context * * @return array Supported languages */ - function loadLangSupported() + public static function loadLangSupported() { static $lang_supported = null; if(!$lang_supported) @@ -596,7 +596,7 @@ class Context * * @return array Selected languages */ - function loadLangSelected() + public static function loadLangSelected() { static $lang_selected = null; if(!$lang_selected) @@ -634,7 +634,7 @@ class Context * * @return bool True : Module handling is necessary in the control path of current request , False : Otherwise */ - function checkSSO() + public function checkSSO() { // pass if it's not GET request or XE is not yet installed if($this->db_info->use_sso != 'Y' || isCrawler()) @@ -713,7 +713,7 @@ class Context * * @return bool True: FTP information is registered, False: otherwise */ - function isFTPRegisted() + public static function isFTPRegisted() { return file_exists(self::getFTPConfigFile()); } @@ -723,7 +723,7 @@ class Context * * @return object FTP information */ - function getFTPInfo() + public static function getFTPInfo() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -743,7 +743,7 @@ class Context * @param string $site_title Browser title to be added * @return void */ - function addBrowserTitle($site_title) + public static function addBrowserTitle($site_title) { if(!$site_title) { @@ -767,7 +767,7 @@ class Context * @param string $site_title Browser title to be set * @return void */ - function setBrowserTitle($site_title) + public static function setBrowserTitle($site_title) { if(!$site_title) { @@ -782,7 +782,7 @@ class Context * * @return string Browser title(htmlspecialchars applied) */ - function getBrowserTitle() + public static function getBrowserTitle() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -796,7 +796,7 @@ class Context * Return layout's title * @return string layout's title */ - public function getSiteTitle() + public static function getSiteTitle() { $oModuleModel = getModel('module'); $moduleConfig = $oModuleModel->getModuleConfig('module'); @@ -812,7 +812,7 @@ class Context * Get browser title * @deprecated */ - function _getBrowserTitle() + public function _getBrowserTitle() { return $this->getBrowserTitle(); } @@ -823,7 +823,7 @@ class Context * @param string $path Path of the language file * @return void */ - function loadLang($path) + public static function loadLang($path) { global $lang; @@ -868,7 +868,7 @@ class Context * @param string Path of the language file * @return void */ - function _evalxmlLang($path) + public function _evalxmlLang($path) { global $lang; @@ -902,7 +902,7 @@ class Context * @param string $path Path of the language file * @return string file name */ - function _loadXmlLang($path) + public function _loadXmlLang($path) { if(!$path) return; @@ -916,7 +916,7 @@ class Context * @param string $path Path of the language file * @return string file name */ - function _loadPhpLang($path) + public function _loadPhpLang($path) { if(!$path) return; @@ -946,7 +946,7 @@ class Context * @param string $lang_type Language type. * @return void */ - function setLangType($lang_type = 'ko') + public static function setLangType($lang_type = 'ko') { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -961,7 +961,7 @@ class Context * * @return string Language type */ - function getLangType() + public static function getLangType() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->lang_type; @@ -973,7 +973,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) + public static function getLang($code) { if(!$code) { @@ -993,7 +993,7 @@ class Context * @param string $val `$code`s value * @return void */ - function setLang($code, $val) + public static function setLang($code, $val) { if(!isset($GLOBALS['lang'])) { @@ -1008,7 +1008,7 @@ class Context * @param object $source_obj Conatins strings to convert * @return object converted object */ - function convertEncoding($source_obj) + public static function convertEncoding($source_obj) { $charset_list = array( 'UTF-8', 'EUC-KR', 'CP949', 'ISO8859-1', 'EUC-JP', 'SHIFT_JIS', 'CP932', @@ -1049,7 +1049,7 @@ class Context * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5 * @return void */ - function checkConvertFlag(&$val, $key = null, $charset = null) + public static function checkConvertFlag(&$val, $key = null, $charset = null) { static $flag = TRUE; if($charset) @@ -1076,7 +1076,7 @@ class Context * @see arrayConvWalkCallback will replaced array_walk_recursive in >=PHP5 * @return object converted object */ - function doConvertEncoding(&$val, $key = null, $charset) + public static function doConvertEncoding(&$val, $key = null, $charset) { if (is_array($val)) { @@ -1091,7 +1091,7 @@ class Context * @param string $str String to convert * @return string converted string */ - function convertEncodingStr($str) + public static function convertEncodingStr($str) { if(!$str) return null; $obj = new stdClass(); @@ -1118,7 +1118,7 @@ class Context * @param string $method Response method. [HTML|XMLRPC|JSON] * @return void */ - function setResponseMethod($method = 'HTML') + public static function setResponseMethod($method = 'HTML') { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -1131,7 +1131,7 @@ class Context * * @return string Response method. If it's not set, returns request method. */ - function getResponseMethod() + public static function getResponseMethod() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -1152,7 +1152,7 @@ class Context * @param string $type Request method. (Optional - GET|POST|XMLRPC|JSON) * @return void */ - function setRequestMethod($type = '') + public static function setRequestMethod($type = '') { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -1170,7 +1170,7 @@ class Context * * @return void */ - function _checkGlobalVars() + public function _checkGlobalVars() { $this->_recursiveCheckVar($_SERVER['HTTP_HOST']); @@ -1186,7 +1186,7 @@ class Context * * @return void */ - function _setRequestArgument() + public function _setRequestArgument() { if(!count($_REQUEST)) { @@ -1229,7 +1229,7 @@ class Context } } - function _recursiveCheckVar($val) + public function _recursiveCheckVar($val) { if(is_string($val)) { @@ -1256,7 +1256,7 @@ class Context * * @return void */ - function _setJSONRequestArgument() + public function _setJSONRequestArgument() { if($this->getRequestMethod() != 'JSON') { @@ -1277,7 +1277,7 @@ class Context * * @return void */ - function _setXmlRpcArgument() + public function _setXmlRpcArgument() { if($this->getRequestMethod() != 'XMLRPC') { @@ -1368,7 +1368,7 @@ class Context * @param string $do_stripslashes Whether to strip slashes * @return mixed filtered value. Type are string or array */ - function _filterRequestVar($key, $val, $do_stripslashes = 1) + public function _filterRequestVar($key, $val, $do_stripslashes = 1) { if(!($isArray = is_array($val))) { @@ -1415,7 +1415,7 @@ class Context * * @return bool True: exists, False: otherwise */ - function isUploaded() + public static function isUploaded() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->is_uploaded; @@ -1426,7 +1426,7 @@ class Context * * @return void */ - function _setUploadedArgument() + public function _setUploadedArgument() { if($_SERVER['REQUEST_METHOD'] != 'POST' || !$_FILES || (stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE && stripos($_SERVER['HTTP_CONTENT_TYPE'], 'multipart/form-data') === FALSE)) { @@ -1469,7 +1469,7 @@ class Context * Return request method * @return string Request method type. (Optional - GET|POST|XMLRPC|JSON) */ - function getRequestMethod() + public static function getRequestMethod() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->request_method; @@ -1479,7 +1479,7 @@ class Context * Return request URL * @return string request URL */ - function getRequestUrl() + public static function getRequestUrl() { static $url = null; if(is_null($url)) @@ -1501,7 +1501,7 @@ class Context * Return js callback func. * @return string callback func. */ - function getJSCallbackFunc() + public static function getJSCallbackFunc() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; @@ -1526,7 +1526,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) + public static function getUrl($num_args = 0, $args_list = array(), $domain = null, $encode = TRUE, $autoEncode = FALSE) { static $site_module_info = null; static $current_info = null; @@ -1768,7 +1768,7 @@ class Context * @param string $domain Domain * @retrun string converted URL */ - function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null) + public static function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null) { static $url = array(); @@ -1867,7 +1867,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) + public static function set($key, $val, $set_to_get_vars = 0) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->context->{$key} = $val; @@ -1892,7 +1892,7 @@ class Context * @param string $key Key * @return string Key */ - function get($key) + public static function get($key) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -1908,7 +1908,7 @@ class Context * * @return object */ - function gets() + public static function gets() { $num_args = func_num_args(); if($num_args < 1) @@ -1931,7 +1931,7 @@ class Context * * @return object All data */ - function getAll() + public static function getAll() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->context; @@ -1942,7 +1942,7 @@ class Context * * @return Object Request variables. */ - function getRequestVars() + public static function getRequestVars() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); if($self->get_vars) @@ -1958,7 +1958,7 @@ class Context * @param string $action act name * @return void */ - function addSSLAction($action) + public static function addSSLAction($action) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -1982,7 +1982,7 @@ class Context * @param string $action act name * @return void */ - function addSSLActions($action_array) + public static function addSSLActions($action_array) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -2010,7 +2010,7 @@ class Context * @param string $action act name * @return void */ - function subtractSSLAction($action) + public static function subtractSSLAction($action) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -2028,7 +2028,7 @@ class Context * * @return string acts in array */ - function getSSLActions() + public static function getSSLActions() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); if($self->getSslStatus() == 'optional') @@ -2043,7 +2043,7 @@ class Context * @param string $action act name * @return bool If SSL exists, return TRUE. */ - function isExistsSSLAction($action) + public static function isExistsSSLAction($action) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return isset($self->ssl_actions[$action]); @@ -2056,7 +2056,7 @@ class Context * @param string $file file path * @return string normalized file path */ - function normalizeFilePath($file) + public static function normalizeFilePath($file) { if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE) { @@ -2078,7 +2078,7 @@ class Context * @param string $file file path * @return string Converted file path */ - function getAbsFileUrl($file) + public static function getAbsFileUrl($file) { $file = self::normalizeFilePath($file); if(strpos($file, './') === 0) @@ -2109,7 +2109,7 @@ class Context * $args[3]: index * */ - function loadFile($args) + public static function loadFile($args) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -2124,7 +2124,7 @@ class Context * @param string $media Media query * @return void */ - function unloadFile($file, $targetIe = '', $media = 'all') + public static function unloadFile($file, $targetIe = '', $media = 'all') { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->oFrontEndFileHandler->unloadFile($file, $targetIe, $media); @@ -2136,7 +2136,7 @@ class Context * @param string $type Unload target (optional - all|css|js) * @return void */ - function unloadAllFiles($type = 'all') + public static function unloadAllFiles($type = 'all') { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->oFrontEndFileHandler->unloadAllFiles($type); @@ -2155,7 +2155,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) + public static function addJsFile($file, $optimized = FALSE, $targetie = '', $index = 0, $type = 'head', $isRuleset = FALSE, $autoPath = null) { if($isRuleset) { @@ -2185,7 +2185,7 @@ class Context * @param string $targetie target IE * @return void */ - function unloadJsFile($file, $optimized = FALSE, $targetie = '') + public static function unloadJsFile($file, $optimized = FALSE, $targetie = '') { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->oFrontEndFileHandler->unloadFile($file, $targetie); @@ -2196,7 +2196,7 @@ class Context * * @return void */ - function unloadAllJsFiles() + public static function unloadAllJsFiles() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->oFrontEndFileHandler->unloadAllFiles('js'); @@ -2209,7 +2209,7 @@ class Context * @param string $filename File name * @return void */ - function addJsFilter($path, $filename) + public static function addJsFilter($path, $filename) { $oXmlFilter = new XmlJSFilter($path, $filename); $oXmlFilter->compile(); @@ -2222,7 +2222,7 @@ class Context * @param array $files File list * @return array File list */ - function _getUniqueFileList($files) + public static function _getUniqueFileList($files) { ksort($files); $files = array_values($files); @@ -2245,7 +2245,7 @@ class Context * @param string $type Added position. (head:.., body:..) * @return array Returns javascript file list. Array contains file, targetie. */ - function getJsFile($type = 'head') + public static function getJsFile($type = 'head') { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->oFrontEndFileHandler->getJsFileList($type); @@ -2263,7 +2263,7 @@ class Context * @return void * */ - function addCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '', $index = 0) + public 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)); @@ -2279,7 +2279,7 @@ class Context * @param string $targetie target IE * @return void */ - function unloadCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '') + public static function unloadCSSFile($file, $optimized = FALSE, $media = 'all', $targetie = '') { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->oFrontEndFileHandler->unloadFile($file, $targetie, $media); @@ -2290,7 +2290,7 @@ class Context * * @return void */ - function unloadAllCSSFiles() + public static function unloadAllCSSFiles() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->oFrontEndFileHandler->unloadAllFiles('css'); @@ -2301,7 +2301,7 @@ class Context * * @return array Returns css file list. Array contains file, media, targetie. */ - function getCSSFile() + public static function getCSSFile() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->oFrontEndFileHandler->getCssFileList(); @@ -2312,7 +2312,7 @@ class Context * @param string $pluginName * @return stdClass */ - function getJavascriptPluginInfo($pluginName) + public static function getJavascriptPluginInfo($pluginName) { if($plugin_name == 'ui.datepicker') { @@ -2367,7 +2367,7 @@ class Context * @param string $plugin_name plugin name * @return void */ - function loadJavascriptPlugin($plugin_name) + public static function loadJavascriptPlugin($plugin_name) { static $loaded_plugins = array(); @@ -2425,13 +2425,13 @@ class Context * @param string $header add html code before . * @return void */ - function addHtmlHeader($header) + public static function addHtmlHeader($header) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->html_header .= "\n" . $header; } - function clearHtmlHeader() + public static function clearHtmlHeader() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->html_header = ''; @@ -2442,7 +2442,7 @@ class Context * * @return string Added html code before */ - function getHtmlHeader() + public static function getHtmlHeader() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->html_header; @@ -2453,7 +2453,7 @@ class Context * * @param string $class_name class name */ - function addBodyClass($class_name) + public static function addBodyClass($class_name) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->body_class[] = $class_name; @@ -2464,7 +2464,7 @@ class Context * * @return string Return class to html body */ - function getBodyClass() + public static function getBodyClass() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->body_class = array_unique($self->body_class); @@ -2477,7 +2477,7 @@ class Context * * @param string $header Add html code after */ - function addBodyHeader($header) + public static function addBodyHeader($header) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->body_header .= "\n" . $header; @@ -2488,7 +2488,7 @@ class Context * * @return string Added html code after */ - function getBodyHeader() + public static function getBodyHeader() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->body_header; @@ -2499,7 +2499,7 @@ class Context * * @param string $footer Add html code before */ - function addHtmlFooter($footer) + public static function addHtmlFooter($footer) { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); $self->html_footer .= ($self->Htmlfooter ? "\n" : '') . $footer; @@ -2510,7 +2510,7 @@ class Context * * @return string Added html code before */ - function getHtmlFooter() + public static function getHtmlFooter() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); return $self->html_footer; @@ -2521,7 +2521,7 @@ class Context * * @retrun string The path of the config file that contains database settings */ - function getConfigFile() + public static function getConfigFile() { return _XE_PATH_ . 'files/config/db.config.php'; } @@ -2531,7 +2531,7 @@ class Context * * @return string The path of the config file that contains FTP settings */ - function getFTPConfigFile() + public static function getFTPConfigFile() { return _XE_PATH_ . 'files/config/ftp.config.php'; } @@ -2541,7 +2541,7 @@ class Context * * @return bool True if the config file exists, otherwise FALSE. */ - function isInstalled() + public static function isInstalled() { return FileHandler::hasContent(self::getConfigFile()); } @@ -2552,7 +2552,7 @@ class Context * @param string Transforms codes * @return string Transforms codes */ - function transContent($content) + public static function transContent($content) { return $content; } @@ -2562,7 +2562,7 @@ class Context * * @return bool True if it is allowed to use rewrite mod, otherwise FALSE */ - function isAllowRewrite() + public static function isAllowRewrite() { $oContext = self::getInstance(); return $oContext->allow_rewrite; @@ -2574,7 +2574,7 @@ class Context * @param string $path URL path * @return string Converted path */ - function pathToUrl($path) + public static function pathToUrl($path) { $xe = _XE_PATH_; $path = strtr($path, "\\", "/"); @@ -2629,7 +2629,7 @@ class Context * Get meta tag * @return array The list of meta tags */ - function getMetaTag() + public static function getMetaTag() { is_a($this, 'Context') ? $self = $this : $self = self::getInstance(); @@ -2656,7 +2656,7 @@ class Context * @param mixed $is_http_equiv value of http_equiv * @return void */ - function addMetaTag($name, $content, $is_http_equiv = FALSE) + public 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;