Module: nagvis Branch: master Commit: f4ef7068ac6c0272dba0a2578721352e236d81b4 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=f4ef7068ac6c0272dba0a2578721352e236d81b4
Author: Lars Michelsen <[email protected]> Date: Fri May 7 21:01:34 2010 +0200 Added some comments; Some code compacting --- share/server/core/classes/CoreModule.php | 10 +++++ share/server/core/classes/CoreRequestHandler.php | 46 +++++++++++++-------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/share/server/core/classes/CoreModule.php b/share/server/core/classes/CoreModule.php index 29d59dc..ba5a565 100644 --- a/share/server/core/classes/CoreModule.php +++ b/share/server/core/classes/CoreModule.php @@ -116,10 +116,20 @@ abstract class CoreModule { return $this->sObject !== ''; } + /** + * Initializes the URI handler object + * + * @author Lars Michelsen <[email protected]> + */ protected function initUriHandler() { $this->UHANDLER = new CoreUriHandler($this->CORE); } + /** + * Reads a list of custom variables from the request + * + * @author Lars Michelsen <[email protected]> + */ protected function getCustomOptions($aKeys) { // Initialize on first call if($this->UHANDLER === null) { diff --git a/share/server/core/classes/CoreRequestHandler.php b/share/server/core/classes/CoreRequestHandler.php index 074a01e..5694988 100644 --- a/share/server/core/classes/CoreRequestHandler.php +++ b/share/server/core/classes/CoreRequestHandler.php @@ -1,4 +1,27 @@ <?php +/***************************************************************************** + * + * CoreRequestHandler.php - Handler for requests + * + * Copyright (c) 2004-2010 NagVis Project (Contact: [email protected]) + * + * License: + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + * + *****************************************************************************/ + class CoreRequestHandler { private $aOpts; @@ -11,35 +34,22 @@ class CoreRequestHandler { } public function get($sKey) { - if(isset($this->aOpts[$sKey])) { + if(isset($this->aOpts[$sKey])) return $this->aOpts[$sKey]; - } else { + else return null; - } } public function isLongerThan($sKey, $iLen) { - if(strlen($this->aOpts[$sKey]) > $iLen) { - return true; - } else { - return false; - } + return strlen($this->aOpts[$sKey]) > $iLen; } public function match($sKey, $regex) { - if(preg_match($regex, $this->aOpts[$sKey])) { - return true; - } else { - return false; - } + return preg_match($regex, $this->aOpts[$sKey]); } public function isSetAndNotEmpty($sKey) { - if(isset($this->aOpts[$sKey]) && $this->aOpts[$sKey] != '') { - return true; - } else { - return false; - } + return isset($this->aOpts[$sKey]) && $this->aOpts[$sKey] != ''; } public static function getReferer($default) { ------------------------------------------------------------------------------ _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
