Minahito
minah****@users*****
2006年 10月 13日 (金) 18:21:04 JST
Index: xoops2jp/html/modules/base/class/Legacy_ModuleAdapter.class.php diff -u xoops2jp/html/modules/base/class/Legacy_ModuleAdapter.class.php:1.1.2.9.2.3 xoops2jp/html/modules/base/class/Legacy_ModuleAdapter.class.php:removed --- xoops2jp/html/modules/base/class/Legacy_ModuleAdapter.class.php:1.1.2.9.2.3 Sat Oct 7 16:33:21 2006 +++ xoops2jp/html/modules/base/class/Legacy_ModuleAdapter.class.php Fri Oct 13 18:21:04 2006 @@ -1,132 +0,0 @@ -<?php - -if (!defined('XOOPS_ROOT_PATH')) exit(); - -class Legacy_ModuleAdapter -{ - var $mAdaptee; - - /** - * @var XCube_Delegate - */ - var $mSearchAction = null; - - function Legacy_ModuleAdapter(&$xoopsModule) - { - $this->mAdaptee =& $xoopsModule; - $this->mSearchAction =& new XCube_Delegate(); - $this->mSearchAction->register('Legacy_ModuleAdapter.SearchAction'); - } - - function prepareAdmin(&$controller) - { - $this->mAdaptee->loadAdminMenu(); - if(count($this->mAdaptee->adminmenu)>0 || isset($this->mAdaptee->modinfo['config']) ) { - $controller->mRoot->mDelegateManager->add('Legacy_ActSearchAction.SearchAction', array(&$this, 'callbackSearchAction')); - } - } - - function callbackSearchAction(&$searchArgs) - { - if(!is_object($searchArgs)) { - return; - } - - // - // Search preference - // - if(isset($this->mAdaptee->modinfo['config'])&&count($this->mAdaptee->modinfo['config'])>0) { - $configInfos=array(); - foreach($this->mAdaptee->modinfo['config'] as $config) { - if(isset($config['title'])) - $configInfos[]=@constant($config['title']); - if(isset($config['description'])) - $configInfos[]=@constant($config['description']); - if(isset($config['options'])&&count($config['options'])>0) { - foreach($config['options'] as $key=>$val) { - $configInfos[]=$key; - } - } - } - - $findFlag=true; - foreach($searchArgs->getKeywords() as $word) { - $findFlag&=(stristr(implode(" ",$configInfos),$word)!==false); - } - - if($findFlag) { - $searchArgs->addRecord($this->mAdaptee->getVar('name'), - XOOPS_URL.'/modules/base/admin/index.php?action=PreferenceEdit&confmod_id='.$this->mAdaptee->getVar('mid'), - _PREFERENCES ); - } - } - - // - // Search AdminMenu - // - if(count($this->mAdaptee->adminmenu)>0) { - foreach($this->mAdaptee->adminmenu as $menu) { - $findFlag=true; - foreach($searchArgs->getKeywords() as $word) { - $tmpFlag=false; - $tmpFlag|=(stristr($menu['title'],$word)!==false); - - // Search keyword - if(isset($menu['keywords'])) { - $keyword=is_array($menu['keywords']) ? implode(" ",$menu['keywords']) : $menu['keywords']; - $tmpFlag|=(stristr($keyword,$word)!==false); - } - - $findFlag&=$tmpFlag; - } - - if($findFlag) { - // - // Create url string with absolute information. - // - $url=""; - if(isset($menu['absolute'])&&$menu['absolute']) { - $url=$menu['link']; - } - else { - $url=XOOPS_URL."/modules/".$this->mAdaptee->getVar('dirname')."/".$menu['link']; - } - - // - // Add record - // - $searchArgs->addRecord($this->mAdaptee->getVar('name'),$url,$menu['title']); - } - } - } - - // - // Search help - // - if ($this->mAdaptee->hasHelp()) { - $root =& XCube_Root::getSingleton(); - $language = $root->mContext->getXoopsConfig('language'); - $helpfile = $this->mAdaptee->getHelp(); - $dir = XOOPS_MODULE_PATH . "/" . $this->mAdaptee->getVar('dirname') . "/language/" . $language; - - if (!file_exists($dir . "/" . $helpfile)) { - $dir = XOOPS_MODULE_PATH . "/" . $this->mAdaptee->getVar('dirname') . "/language/" . $language; - if (!file_exists($dir . "/" . $helpfile)) { - return; - } - } - $lines = file($dir . "/" . $helpfile); - foreach ($lines as $line) { - foreach($searchArgs->getKeywords() as $word) { - if (stristr($line, $word) !== false) { - $url = XOOPS_MODULE_URL . "/base/admin/index.php?action=Help&dirname=" . $this->mAdaptee->getVar('dirname'); - $searchArgs->addRecord($this->mAdaptee->getVar('name'), $url, _HELP); - return; - } - } - } - } - } -} - -?> \ No newline at end of file