[ Index ] |
|
Code source de XOOPS 2.0.17.1 |
1 <?php 2 // $Id: handlerregistry.php 2 2005-11-02 18:23:29Z skalpa $ 3 // ------------------------------------------------------------------------ // 4 // XOOPS - PHP Content Management System // 5 // Copyright (c) 2000 XOOPS.org // 6 // <http://www.xoops.org/> // 7 // ------------------------------------------------------------------------ // 8 // This program is free software; you can redistribute it and/or modify // 9 // it under the terms of the GNU General Public License as published by // 10 // the Free Software Foundation; either version 2 of the License, or // 11 // (at your option) any later version. // 12 // // 13 // You may not change or alter any portion of this comment or credits // 14 // of supporting developers from this source code or any supporting // 15 // source code which is considered copyrighted (c) material of the // 16 // original comment or credit authors. // 17 // // 18 // This program is distributed in the hope that it will be useful, // 19 // but WITHOUT ANY WARRANTY; without even the implied warranty of // 20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // 21 // GNU General Public License for more details. // 22 // // 23 // You should have received a copy of the GNU General Public License // 24 // along with this program; if not, write to the Free Software // 25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 26 // ------------------------------------------------------------------------ // 27 // Author: Kazumi Ono (AKA onokazu) // 28 // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // 29 // Project: The XOOPS Project (http://www.xoops.org/) // 30 // ------------------------------------------------------------------------- // 31 32 /** 33 * A registry for holding references to {@link XoopsObjectHandler} classes 34 * 35 * @package kernel 36 * 37 * @author Kazumi Ono <onokazu@xoops.org> 38 * @copyright copyright (c) 2000-2003 XOOPS.org 39 */ 40 41 class XoopsHandlerRegistry 42 { 43 /** 44 * holds references to handler class objects 45 * 46 * @var array 47 * @access private 48 */ 49 var $_handlers = array(); 50 51 /** 52 * get a reference to the only instance of this class 53 * 54 * if the class has not been instantiated yet, this will also take 55 * care of that 56 * 57 * @static 58 * @staticvar object The only instance of this class 59 * @return object Reference to the only instance of this class 60 */ 61 function &instance() 62 { 63 static $instance; 64 if (!isset($instance)) { 65 $instance = new XoopsHandlerRegistry(); 66 } 67 return $instance; 68 } 69 70 /** 71 * Register a handler class object 72 * 73 * @param string $name Short name of a handler class 74 * @param object &$handler {@link XoopsObjectHandler} class object 75 */ 76 function setHandler($name, &$handler) 77 { 78 $this->_handlers['kernel'][$name] =& $handler; 79 } 80 81 /** 82 * Get a registered handler class object 83 * 84 * @param string $name Short name of a handler class 85 * 86 * @return object {@link XoopsObjectHandler}, FALSE if not registered 87 */ 88 function &getHandler($name) 89 { 90 if (!isset($this->_handlers['kernel'][$name])) { 91 return false; 92 } 93 return $this->_handlers['kernel'][$name]; 94 } 95 96 /** 97 * Unregister a handler class object 98 * 99 * @param string $name Short name of a handler class 100 */ 101 function unsetHandler($name) 102 { 103 unset($this->_handlers['kernel'][$name]); 104 } 105 106 /** 107 * Register a handler class object for a module 108 * 109 * @param string $module Directory name of a module 110 * @param string $name Short name of a handler class 111 * @param object &$handler {@link XoopsObjectHandler} class object 112 */ 113 function setModuleHandler($module, $name, &$handler) 114 { 115 $this->_handlers['module'][$module][$name] =& $handler; 116 } 117 118 /** 119 * Get a registered handler class object for a module 120 * 121 * @param string $module Directory name of a module 122 * @param string $name Short name of a handler class 123 * 124 * @return object {@link XoopsObjectHandler}, FALSE if not registered 125 */ 126 function &getModuleHandler($module, $name) 127 { 128 if (!isset($this->_handlers['module'][$module][$name])) { 129 return false; 130 } 131 return $this->_handlers['module'][$module][$name]; 132 } 133 134 /** 135 * Unregister a handler class object for a module 136 * 137 * @param string $module Directory name of a module 138 * @param string $name Short name of a handler class 139 */ 140 function unsetModuleHandler($module, $name) 141 { 142 unset($this->_handlers['module'][$module][$name]); 143 } 144 145 } 146 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 11:44:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |