From ea6d6b5c9107a5d64c1094939fb41f93445c35df Mon Sep 17 00:00:00 2001 From: Conrad Vermeulen Date: Thu, 20 Sep 2007 15:41:15 +0000 Subject: [PATCH] KTS-2358 "php5 migration" Updated. Removed & from &new. Added statics. --- lib/templating/templating.inc.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/templating/templating.inc.php b/lib/templating/templating.inc.php index 3728078..1c41bd8 100644 --- a/lib/templating/templating.inc.php +++ b/lib/templating/templating.inc.php @@ -8,7 +8,7 @@ * License Version 1.1.2 ("License"); You may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.knowledgetree.com/KPL - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * See the License for the specific language governing rights and @@ -19,9 +19,9 @@ * (ii) the KnowledgeTree copyright notice * in the same form as they appear in the distribution. See the License for * requirements. - * + * * The Original Code is: KnowledgeTree Open Source - * + * * The Initial Developer of the Original Code is The Jam Warehouse Software * (Pty) Ltd, trading as KnowledgeTree. * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright @@ -38,7 +38,7 @@ class KTTemplating { /** Location registry */ var $aLocationRegistry; - + // {{{ KTTemplating function KTTemplating() { $this->aTemplateRegistry = array( @@ -88,7 +88,7 @@ class KTTemplating { return $this->_chooseTemplate($templatename, $aPossibilities); } // }}} - + // {{{ loadTemplate /** * Create an object that conforms to the template interface, using @@ -108,8 +108,8 @@ class KTTemplating { if (!class_exists($sClass)) { return PEAR::raiseError(_kt("Could not find template language")); } - - $oTemplate =& new $sClass($sTemplatePath); + + $oTemplate =new $sClass($sTemplatePath); return $oTemplate; } // }}} @@ -121,11 +121,14 @@ class KTTemplating { // }}} // {{{ getSingleton - function &getSingleton () { - if (!KTUtil::arrayGet($GLOBALS['_KT_PLUGIN'], 'oKTTemplating')) { - $GLOBALS['_KT_PLUGIN']['oKTTemplating'] = new KTTemplating; - } - return $GLOBALS['_KT_PLUGIN']['oKTTemplating']; + static function &getSingleton () { + static $singleton = null; + + if (is_null($singleton)) + { + $singleton = new KTTemplating(); + } + return $singleton; } // }}} -- libgit2 0.21.4