Commit ea6d6b5c9107a5d64c1094939fb41f93445c35df

Authored by Conrad Vermeulen
1 parent 1f009d1f

KTS-2358

"php5 migration"
Updated. Removed & from &new. Added statics.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7189 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/templating/templating.inc.php
... ... @@ -8,7 +8,7 @@
8 8 * License Version 1.1.2 ("License"); You may not use this file except in
9 9 * compliance with the License. You may obtain a copy of the License at
10 10 * http://www.knowledgetree.com/KPL
11   - *
  11 + *
12 12 * Software distributed under the License is distributed on an "AS IS"
13 13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
14 14 * See the License for the specific language governing rights and
... ... @@ -19,9 +19,9 @@
19 19 * (ii) the KnowledgeTree copyright notice
20 20 * in the same form as they appear in the distribution. See the License for
21 21 * requirements.
22   - *
  22 + *
23 23 * The Original Code is: KnowledgeTree Open Source
24   - *
  24 + *
25 25 * The Initial Developer of the Original Code is The Jam Warehouse Software
26 26 * (Pty) Ltd, trading as KnowledgeTree.
27 27 * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
... ... @@ -38,7 +38,7 @@ class KTTemplating {
38 38  
39 39 /** Location registry */
40 40 var $aLocationRegistry;
41   -
  41 +
42 42 // {{{ KTTemplating
43 43 function KTTemplating() {
44 44 $this->aTemplateRegistry = array(
... ... @@ -88,7 +88,7 @@ class KTTemplating {
88 88 return $this->_chooseTemplate($templatename, $aPossibilities);
89 89 }
90 90 // }}}
91   -
  91 +
92 92 // {{{ loadTemplate
93 93 /**
94 94 * Create an object that conforms to the template interface, using
... ... @@ -108,8 +108,8 @@ class KTTemplating {
108 108 if (!class_exists($sClass)) {
109 109 return PEAR::raiseError(_kt("Could not find template language"));
110 110 }
111   -
112   - $oTemplate =& new $sClass($sTemplatePath);
  111 +
  112 + $oTemplate =new $sClass($sTemplatePath);
113 113 return $oTemplate;
114 114 }
115 115 // }}}
... ... @@ -121,11 +121,14 @@ class KTTemplating {
121 121 // }}}
122 122  
123 123 // {{{ getSingleton
124   - function &getSingleton () {
125   - if (!KTUtil::arrayGet($GLOBALS['_KT_PLUGIN'], 'oKTTemplating')) {
126   - $GLOBALS['_KT_PLUGIN']['oKTTemplating'] = new KTTemplating;
127   - }
128   - return $GLOBALS['_KT_PLUGIN']['oKTTemplating'];
  124 + static function &getSingleton () {
  125 + static $singleton = null;
  126 +
  127 + if (is_null($singleton))
  128 + {
  129 + $singleton = new KTTemplating();
  130 + }
  131 + return $singleton;
129 132 }
130 133 // }}}
131 134  
... ...