Minahito
minah****@users*****
2006年 8月 18日 (金) 18:13:29 JST
Index: xoops2jp/html/include/functions.php diff -u xoops2jp/html/include/functions.php:1.2.8.16 xoops2jp/html/include/functions.php:1.2.8.17 --- xoops2jp/html/include/functions.php:1.2.8.16 Wed Aug 9 18:34:19 2006 +++ xoops2jp/html/include/functions.php Fri Aug 18 18:13:29 2006 @@ -1,5 +1,5 @@ <?php -// $Id: functions.php,v 1.2.8.16 2006/08/09 09:34:19 minahito Exp $ +// $Id: functions.php,v 1.2.8.17 2006/08/18 09:13:29 minahito Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // @@ -53,20 +53,25 @@ /** * @deprecated */ -function xoops_header($closehead=true) +function xoops_header($closehead = true) { - $root=&XCube_Root::getSingleton(); - $renderSystem=&$root->mController->getRenderSystem(); - if($renderSystem!=null) + $root =& XCube_Root::getSingleton(); + $renderSystem =& $root->getRenderSystem('Legacy_RenderSystem'); + if ($renderSystem != null) { $renderSystem->showXoopsHeader($closehead); + } } +/** + * @deprecated + */ function xoops_footer() { - $root=&XCube_Root::getSingleton(); - $renderSystem=&$root->mController->getRenderSystem(); - if($renderSystem!=null) + $root =& XCube_Root::getSingleton(); + $renderSystem =& $root->getRenderSystem('Legacy_RenderSystem'); + if ($renderSystem != null) { $renderSystem->showXoopsFooter(); + } } function xoops_error($message, $title='', $style='errorMsg') @@ -528,11 +533,25 @@ return $ret; } +/** + * This function is Fly-Weight to get an instance of XoopsObject in Legacy + * Kernel. + */ function &xoops_gethandler($name, $optional = false ) { static $handlers; $name = strtolower(trim($name)); if (!isset($handlers[$name])) { + // + // The following delegate is test at Alpha4-c. + // + $handler = null; + XCube_DelegateUtils::call('Legacy.Event.GetHandler', new XCube_Ref($handler), $optional); + if (is_object($handler)) { + $handlers[$name] =& $handler; + return $handlers[$name]; + } + if ( file_exists( $hnd_file = XOOPS_ROOT_PATH.'/kernel/'.$name.'.php' ) ) { require_once $hnd_file; } @@ -572,10 +591,16 @@ if ( file_exists( $hnd_file = XOOPS_ROOT_PATH . "/modules/{$module_dir}/class/{$name}.php" ) ) { include_once $hnd_file; } - $class = ucfirst(strtolower($module_dir)).ucfirst($name).'Handler'; - if (class_exists($class)) { - $handlers[$module_dir][$name] = new $class($GLOBALS['xoopsDB']); - } + $className = ucfirst(strtolower($module_dir)) . "_" . ucfirst($name) . 'Handler'; + if (class_exists($className)) { + $handlers[$module_dir][$name] =& new $className($GLOBALS['xoopsDB']); + } + else { + $className = ucfirst(strtolower($module_dir)) . ucfirst($name) . 'Handler'; + if (class_exists($className)) { + $handlers[$module_dir][$name] = new $className($GLOBALS['xoopsDB']); + } + } } if (!isset($handlers[$module_dir][$name]) && !$optional) { trigger_error('Handler does not exist<br />Module: '.$module_dir.'<br />Name: '.$name, E_USER_ERROR);