From 3fb04fcee79a476d347149013b4feb92f35bb858 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 16 Oct 2005 20:09:45 +0000 Subject: [PATCH] getobject() apparently causes a parse error; guess we have to use arrays --- kernel.php | 21 ++------------------- template.php | 18 +++++++++--------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/kernel.php b/kernel.php index 21f8e81..275052b 100644 --- a/kernel.php +++ b/kernel.php @@ -249,8 +249,6 @@ class Shared_Object_Framework return; } - $this->modules["$framework"] = $asobject; - if (isset($this->$asobject)) { trigger_error('Cannot instantiate framework `' . $framework . '` into `' . $asobject . '`', E_USER_ERROR); @@ -258,6 +256,8 @@ class Shared_Object_Framework $this->$asobject = new $framework($this); + $this->modules["$framework"] =& $this->$asobject; + if ($globalize) { $GLOBALS["$asobject"] =& $this->$asobject; @@ -266,23 +266,6 @@ class Shared_Object_Framework return $this->$asobject; } - /** - * Returns the instance of a loaded module - * - * @param string Framework name - * - * @return object Instantiated instance - */ - function &getobject($framework) - { - if (!$this->is_loaded($framework)) - { - trigger_error('Framework module `' . $framework . '` is not loaded', E_USER_WARNING); - } - - return $this->{$this->modules["$framework"]}; - } - /** * Prints a list of all currently loaded framework modules * diff --git a/template.php b/template.php index 5094d39..4fb4957 100644 --- a/template.php +++ b/template.php @@ -78,7 +78,7 @@ class Template * The name of the function phrases are fetched with * @var string */ - var $langcall = '$this->registry->getobject(\'localize\')->string'; + var $langcall = '$this->registry->modules[\'localize\']->string'; /** * The name of the function phrases are sprintf() parsed with @@ -132,8 +132,8 @@ class Template } else { - $templates = $this->registry->getobject('db_mysql')->query("SELECT * FROM " . $this->tablename . " WHERE " . $this->namecolumn . " IN ('" . implode("', '", $namearray) . "')" . (($this->extrawhere) ? $this->extrawhere : '')); - while ($template = $this->registry->getobject('db_mysql')->fetch_array($templates)) + $templates = $this->registry->modules['db_mysql']->query("SELECT * FROM " . $this->tablename . " WHERE " . $this->namecolumn . " IN ('" . implode("', '", $namearray) . "')" . (($this->extrawhere) ? $this->extrawhere : '')); + while ($template = $this->registry->modules['db_mysql']->fetch_array($templates)) { $template = $this->_parse($template); $this->cache[ $template[ $this->namecolumn ] ] = $template[ $this->datacolumn ]; @@ -191,10 +191,10 @@ class Template if ($this->registry->debug AND isset($_GET['query'])) { - if (is_array($this->registry->getobject('db_mysql')->history)) + if (is_array($this->registry->modules['db_mysql']->history)) { echo '
';
-				foreach ($this->registry->getobject('db_mysql')->history AS $query)
+				foreach ($this->registry->modules['db_mysql']->history AS $query)
 				{
 					echo $query . "\n\n
\n\n"; } @@ -299,16 +299,16 @@ class Template $debug .= "\n\t
  • Source Control: $scinfo
  • "; // query information - if (is_object($this->registry->getobject('db_mysql'))) + if (is_object($this->registry->modules['db_mysql'])) { - $debug .= "\n\t
  • Total Queries: " . sizeof($this->registry->getobject('db_mysql')->history) . " (registry->sanitize($_SERVER['REQUEST_URI']) . ((strpos($_SERVER['REQUEST_URI'], '?') !== false) ? '&query=1' : '?query=1') . "\">?)
  • "; + $debug .= "\n\t
  • Total Queries: " . sizeof($this->registry->modules['db_mysql']->history) . " (registry->sanitize($_SERVER['REQUEST_URI']) . ((strpos($_SERVER['REQUEST_URI'], '?') !== false) ? '&query=1' : '?query=1') . "\">?)
  • "; } // total execution time if (defined('ISSO_MT_START')) { $this->registry->load('functions', 'functions'); - $debug .= "\n\t
  • Total Execution Time: " . round($this->registry->getobject('functions')->fetch_microtime_diff(ISSO_MT_START), 10) . "
  • "; + $debug .= "\n\t
  • Total Execution Time: " . round($this->registry->modules['functions']->fetch_microtime_diff(ISSO_MT_START), 10) . "
  • "; } // debug notices @@ -355,7 +355,7 @@ class Template */ function _load($name) { - if ($template = $this->registry->getobject('db_mysql')->query("SELECT * FROM " . $this->tablename . " WHERE " . $this->namecolumn . " = '$name'" . (($this->extrawhere) ? $this->extrawhere : ''))) + if ($template = $this->registry->modules['db_mysql']->query("SELECT * FROM " . $this->tablename . " WHERE " . $this->namecolumn . " = '$name'" . (($this->extrawhere) ? $this->extrawhere : ''))) { return $template[ $this->datacolumn ]; } -- 2.22.5