function execute($query, $extra = null, $tracking = false) { if (preg_match('/^\\w+\\.__\\w+$/', $query)) { $this->addError("The '__method' form are not accesibles"); } // get path and type $exists = $this->__h_include($query, $tracking); // local parameters $p = array('handler_file' => $exists ? $exists[0] : null, 'handler_query' => $query); // add query to stack array_push($this->cursor, $p); if (!$exists) { $this->addError("Handler \"{$query}\" don't exists"); } // start handler if (!$this->__h_start($query, $exists[0], $exists[1], $exists[2])) { $this->addError("Handler \"{$query}\" can't start"); } // parse query list($handler, $method, $query, $explicit) = $this->__h_extract($query); $new_parameters = new Parameters(); $new_parameters->origin('configuration_file'); $new_parameters->concat($GLOBALS['tt780'][$this->id]['globals']); // load in cascade $hc = explode('_', $handler); $hc_c = ''; foreach ($hc as $h) { $hc_c = "{$hc_c}{$h}"; if (isset($GLOBALS['tt780'][$this->id]['parameters'][$hc_c])) { $new_parameters->concat($GLOBALS['tt780'][$this->id]['parameters'][$hc_c]); } $hc_c .= '_'; } $new_parameters->concat($GLOBALS['tt780'][$this->id]['parameters'][$handler]); $new_parameters->concat($GLOBALS['tt780'][$this->id]['parameters']["{$handler}.{$method}"]); $new_parameters->origin(null); $new_parameters->concat($extra); $new_parameters->concat($p); $cache = null; if (isset($GLOBALS['tt780'][$this->id]['cache']) && isset($GLOBALS['tt780'][$this->id]['cache'][$query]) && ($cache = 'P' . @md5(@serialize($new_parameters->toArray()))) && array_key_exists($cache, $GLOBALS['tt780'][$this->id]['cache'][$query])) { if ($tracking) { echo "<b>return from cache: </b>" . print_r($GLOBALS['tt780'][$this->id]['cache'][$query][$cache], true); } return $GLOBALS['tt780'][$this->id]['cache'][$query][$cache]; } // execute if ($exists[1] == 'lambda') { $res = $GLOBALS['tt780'][$this->id]['includes'][$exists[2]][0]($new_parameters); } else { $res = $GLOBALS['tt780'][$this->id]['handler'][$exists[2]]->__tt780_execute($query, $new_parameters); } if ($cache) { $GLOBALS['tt780'][$this->id]['cache'][$query][$cache] = $res; } // remove query from stack array_pop($this->cursor); return $res; }