Remove unnecessary use of anonymous functions

This commit is contained in:
Kijin Sung 2015-04-03 16:28:46 +09:00
parent b4bbbb378f
commit 3ac6579968
4 changed files with 11 additions and 17 deletions

View file

@ -328,8 +328,7 @@ class DB
unset($oDB);
require_once($class_file);
$tmp_fn = create_function('', "return new {$class_name}();");
$oDB = $tmp_fn();
$oDB = new $class_name();
if(!$oDB)
{

View file

@ -1060,14 +1060,13 @@ class ModuleHandler extends Handler
return NULL;
}
// Create an instance with eval function
// Create an instance
require_once($class_file);
if(!class_exists($instance_name, false))
{
return NULL;
}
$tmp_fn = create_function('', "return new {$instance_name}();");
$oModule = $tmp_fn();
$oModule = new $instance_name();
if(!is_object($oModule))
{
return NULL;

View file

@ -724,22 +724,19 @@ function zdate($str, $format = 'Y-m-d H:i:s', $conversion = TRUE)
$month = (int) substr($str, 4, 2);
$day = (int) substr($str, 6, 2);
// leading zero?
$lz = create_function('$n', 'return ($n>9?"":"0").$n;');
$trans = array(
'Y' => $year,
'y' => $lz($year % 100),
'm' => $lz($month),
'y' => sprintf('%02d', $year % 100),
'm' => sprintf('%02d', $month),
'n' => $month,
'd' => $lz($day),
'd' => sprintf('%02d', $day),
'j' => $day,
'G' => $hour,
'H' => $lz($hour),
'H' => sprintf('%02d', $hour),
'g' => $hour % 12,
'h' => $lz($hour % 12),
'i' => $lz($min),
's' => $lz($sec),
'h' => sprintf('%02d', $hour % 12),
'i' => sprintf('%02d', $min),
's' => sprintf('%02d', $sec),
'M' => getMonthName($month),
'F' => getMonthName($month, FALSE)
);

View file

@ -550,8 +550,7 @@ class editorModel extends editor
if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
// Create an object after loading the class file
require_once($class_file);
$tmp_fn = create_function('$seq,$path', "return new {$component}(\$seq,\$path);");
$oComponent = $tmp_fn($editor_sequence, $class_path);
$oComponent = new $component($editor_sequence, $class_path);
if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
// Add configuration information
$component_info = $this->getComponent($component, $site_srl);