Minahito
minah****@users*****
2005年 10月 27日 (木) 20:04:08 JST
Index: xoops2jp/html/modules/base/class/BlockProcContext.class.php diff -u xoops2jp/html/modules/base/class/BlockProcContext.class.php:1.1.2.2 xoops2jp/html/modules/base/class/BlockProcContext.class.php:removed --- xoops2jp/html/modules/base/class/BlockProcContext.class.php:1.1.2.2 Sun Oct 23 15:25:06 2005 +++ xoops2jp/html/modules/base/class/BlockProcContext.class.php Thu Oct 27 20:04:08 2005 @@ -1,159 +0,0 @@ -<?php -// $Id: BlockProcContext.class.php,v 1.1.2.2 2005/10/23 06:25:06 minahito Exp $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2000 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// You may not change or alter any portion of this comment or credits // -// of supporting developers from this source code or any supporting // -// source code which is considered copyrighted (c) material of the // -// original comment or credit authors. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // - -class BlockProcContext -{ - var $mBlockObjs; - var $mXoopsTpl; - - var $mBlockShowFlag; - var $mBlockResult; - - var $mXoopsModule; - - function BlockProcContext(&$xoopsModule,&$xoopsTpl) - { - $this->mIds_=array(); - $this->mBlockShowFlag=array(); - $this->mBlockResult=array(); - - $this->mXoopsModule=&$xoopsModule; - $this->mXoopsTpl=&$xoopsTpl; - } - - function execute() - { - $xoopsLogger =& XoopsLogger::instance(); - - $blockObjects=$this->_getBlockObjects(); - - foreach($blockObjects as $blockObj) { - - $blockCacheTime = $blockObj->getVar('bcachetime'); - if(empty($blockCacheTime)) { - $this->mXoopsTpl->xoops_setCaching(0); - } - else{ - $this->mXoopsTpl->xoops_setCaching(2); - $this->mXoopsTpl->xoops_setCacheTime($blockCacheTime); - } - - // Get block template - $blockTemplate = $blockObj->getVar('template'); - if($blockTemplate!='') { - // if no cache setting or no chache done. - if(empty($bcachetime) || !$this->mXoopsTpl->isBlockCached($blockTemplate,$blockObj->getVar('bid'))) { - $xoopsLogger->addBlock($blockObj->getVar('name')); - $blockResult=&$blockObj->buildBlock(); - - // if no result, continue - if(!$blockResult) - continue; - - $this->mXoopsTpl->assign_by_ref('block',$blockResult); - $blockContent=&$this->mXoopsTpl->fetchBlock($blockTemplate,$blockObj->getVar('bid')); - $this->mXoopsTpl->clear_assign('block'); - } - else { - $blockContent=&$this->mXoopsTpl->fetchBlock($blockTemplate,$blockObj->getVar('bid')); - } - } - else { - // The case of no block template. - $bid=$blockObj->getVar('bid'); - if(empty($blockCacheTime) || !$this->mXoopsTpl->isBlockCached('system_dummy.html',$bid)) { - $xoopsLogger->addBlock($blockObj->getVar('name')); - $blockResult=&$blockObj->buildBlock(); - - if(!$blockResult) - continue; - - $this->mXoopsTpl->assign_by_ref('dummy_content', $blockResult['content']); - $blockContent=&$this->mXoopsTpl->fetchBlock('system_dummy.html',$bid); - $xoopsTpl->clear_assign('block'); - } - else { - $xoopsLogger->addBlock($blockObj->getVar('name'), true, $blockCacheTime); - $blockContent=&$this->mXoopsTpl->fetchBlock('system_dummy.html',$bid); - } - } - - $this->mBlockShowFlag[$blockObj->getVar('side')] = true; - $this->mBlockResult[$blockObj->getVar('side')][] = array('title' =>$blockObj->getVar('title'), 'content' => $blockContent, 'weight' =>$blockObj->getVar('weight')); - } - -// $this->_processAssign(); - } - - // @todo I must change this method name. - function visitTemplate(&$xoopsTpl) - { - /// @todo I must move these to somewhere. - $assignNameMap = array( - XOOPS_SIDEBLOCK_LEFT=>array('showflag'=>'xoops_showllock','block'=>'xoops_lblocks'), - XOOPS_CENTERBLOCK_LEFT=>array('showflag'=>'xoops_showcblock','block'=>'xoops_clblocks'), - XOOPS_CENTERBLOCK_RIGHT=>array('showflag'=>'xoops_showcblock','block'=>'xoops_crblocks'), - XOOPS_CENTERBLOCK_CENTER=>array('showflag'=>'xoops_showcblock','block'=>'xoops_ccblocks'), - XOOPS_SIDEBLOCK_RIGHT=>array('showflag'=>'xoops_showrblock','block'=>'xoops_rblocks') - ); - - foreach($assignNameMap as $key=>$val) { - $xoopsTpl->assign($val['showflag'],(isset($this->mBlockShowFlag[$key])&&$this->mBlockShowFlag[$key]) ? 1 : 0); - if(isset($this->mBlockResult[$key])) { - foreach($this->mBlockResult[$key] as $result) { - $xoopsTpl->append($val['block'],$result); - } - } - } - } - - /** - @access private - @return Array array by XoopsBlockObject - */ - function &_getBlockObjects() - { - // @todo I must change this to singleton. - global $xoopsUser; - global $xoopsConfig; - - if(is_object($this->mXoopsModule)) { // process module, now - $showFlag = (preg_match("/index\.php$/i", xoops_getenv('PHP_SELF')) && $xoopsConfig['startpage'] == $this->mXoopsModule->getVar('dirname')); - $mid=$this->mXoopsModule->getVar('mid'); - } - else { // process toppage, now - $showFlag = !empty($xoopsOption['show_cblock']); - $mid=0; - } - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - - $xoopsblock = new XoopsBlock(); - return $xoopsblock->getAllByGroupModule($groups, $mid, $showFlag, XOOPS_BLOCK_VISIBLE); - } -} - -?> \ No newline at end of file Index: xoops2jp/html/modules/base/class/FeatureManager.class.php diff -u xoops2jp/html/modules/base/class/FeatureManager.class.php:1.1.2.2 xoops2jp/html/modules/base/class/FeatureManager.class.php:removed --- xoops2jp/html/modules/base/class/FeatureManager.class.php:1.1.2.2 Tue Oct 25 19:58:24 2005 +++ xoops2jp/html/modules/base/class/FeatureManager.class.php Thu Oct 27 20:04:08 2005 @@ -1,145 +0,0 @@ -<?php -// $Id: MessageCatalog.class.php,v 1.1.2.2 2005/10/21 15:53:33 minahito Exp $ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2000 XOOPS.org // -// <http://www.xoops.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// You may not change or alter any portion of this comment or credits // -// of supporting developers from this source code or any supporting // -// source code which is considered copyrighted (c) material of the // -// original comment or credit authors. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // - -define("XCUBE_FUNCTION_TYPE_NONE",0); -define("XCUBE_FUNCTION_TYPE_KICK",1); -define("XCUBE_FUNCTION_TYPE_EXECUTE",2); - -class FeatureManager -{ - var $mFeatures; - - function FeatureManager() - { - $this->mFeatures=array(); - } - - function &getSingleton() - { - static $instance; - if(!is_object($instance)) - $instance = new FeatureManager($languageName); - - return $instance; - } - - function addFeature(&$feature) - { - $this->mFeatures[$feature->getName()]=&$feature; - } - - function &getFeature($featureName) - { - $ret=null; - if(isset($this->mFeatures[$featureName])) { - return $this->mFeatures[$featureName]; - } - else { - return $ret; - } - } -} - -class AbstractFeature -{ - var $mName; - - function AbstractFeature() - { - $this->mName=null; - } - - function getName() - { - return $this->mName; - } - - /** - @return bool - */ - function hasFunction($name) - { - $callbackMethodName="has".ucfirst(strtolower($name)); - if(method_exists($this,$callbackMethodName)) { - return $this->$callbackMethodName(); - } - else { - return false; - } - } - - /** - @return virtual enum XOOPSCUBE_FEATURE_TYPE_XXXX - */ - function getFunctionType($name) - { - $callbackMethodName="get".ucfirst(strtolower($name))."Type"; - if(method_exists($this,$callbackMethodName)) { - return $this->$callbackMethodName(); - } - else { - return XCUBE_FEATURE_TYPE_NONE; - } - } - - /** - @return string - */ - function getFunctionUrl($name) - { - $callbackMethodName="get".ucfirst(strtolower($name))."Url"; - if(method_exists($this,$callbackMethodName)) { - return $this->$callbackMethodName(); - } - else { - return null; - } - } - - function executeFunction($name) - { - $name=ucfirst(strtolower($name)); - $methodName="get".$name."Type"; - $type = $this->$methodName(); - switch($type){ - case XCUBE_FEATURE_TYPE_NONE: - break; - - case XCUBE_FEATURE_TYPE_KICK: - $methodName="get".$name."Url"; - header("location: ".$this->$methodName()); - break; // or exit? - - case XCUBE_FEATURE_TYPE_EXECUTE: - $methodName="execute".$name; - $this->$methodName(); - break; - } - } -} - -?> \ No newline at end of file