Merge pull request #42 from kijin/refactor/functions

일반 함수 리팩토링
This commit is contained in:
Kijin Sung 2016-01-12 10:53:10 +09:00
commit 5f9d6f2a6b
5 changed files with 216 additions and 373 deletions

View file

@ -587,6 +587,7 @@ class Context
if(!$db_info->time_zone)
$db_info->time_zone = date('O');
$GLOBALS['_time_zone'] = $db_info->time_zone;
$GLOBALS['_time_zone_offset'] = get_time_zone_offset($db_info->time_zone);
if($db_info->qmail_compatibility != 'Y')
$db_info->qmail_compatibility = 'N';

View file

@ -14,14 +14,12 @@ class JSCallbackDisplayHandler
$variables = $oModule->getVariables();
$variables['error'] = $oModule->getError();
$variables['message'] = $oModule->getMessage();
$json = str_replace(array("\r\n", "\n", "\t"), array('\n', '\n', '\t'), json_encode2($variables));
return sprintf('<script type="text/javascript">
//<![CDATA[
%s(%s);
//]]>
</script>', Context::getJSCallbackFunc(), $json);
</script>', Context::getJSCallbackFunc(), json_encode($variables));
}
}
/* End of file JSCallback.class.php */
/* Location: ./classes/display/JSCallback.class.php */

View file

@ -14,8 +14,7 @@ class JSONDisplayHandler
$variables = $oModule->getVariables();
$variables['error'] = $oModule->getError();
$variables['message'] = $oModule->getMessage();
$json = str_replace(array("\r\n", "\n", "\t"), array('\n', '\n', '\t'), json_encode2($variables));
return $json;
return json_encode($variables);
}
}

View file

@ -73,11 +73,11 @@ class TemplateHandler
protected function init($tpl_path, $tpl_filename, $tpl_file = '')
{
// verify arguments
if(substr($tpl_path, -1) != '/')
if(!$tpl_path || substr($tpl_path, -1) != '/')
{
$tpl_path .= '/';
}
if(!is_dir($tpl_path))
if($tpl_path === '/' || !is_dir($tpl_path))
{
return;
}