.
function runSnippet($snippetName, $params= array ()) {
if (isset ($this->snippetCache[$snippetName])) {
$snippet= $this->snippetCache[$snippetName];
$properties= $this->snippetCache[$snippetName . "Props"];
} else { // not in cache so let's check the db
$sql= "SELECT * FROM " . $this->getFullTableName("site_snippets") . " WHERE " . $this->getFullTableName("site_snippets") . ".name='" . mysql_escape_string($snippetName) . "';";
$result= $this->dbQuery($sql);
if ($this->recordCount($result) == 1) {
$row= $this->fetchRow($result);
$snippet= $this->snippetCache[$row['name']]= $row['snippet'];
$properties= $this->snippetCache[$row['name'] . "Props"]= $row['properties'];
} else {
$snippet= $this->snippetCache[$snippetName]= "return false;";
$properties= '';
}
}
// load default params/properties
$parameters= $this->parseProperties($properties);
$parameters= array_merge($parameters, $params);
// run snippet
return $this->evalSnippet($snippet, $parameters);
} function runSnippet2($snippetName, $params= array ()) {
$sql= "SELECT * FROM " . $this->getFullTableName("site_snippets") . " WHERE " . $this->getFullTableName("site_snippets") . ".name='" . mysql_escape_string($snippetName) . "';";
$result= $this->dbQuery($sql);
if ($this->recordCount($result) == 1) {
$row= $this->fetchRow($result);
$snippet= $this->snippetCache[$row['name']]= $row['snippet'];
$properties= $this->snippetCache[$row['name'] . "Props"]= $row['properties'];
} else {
$snippet= $this->snippetCache[$snippetName]= "return false;";
$properties= '';
}
// load default params/properties
$parameters= $this->parseProperties($properties);
$parameters= array_merge($parameters, $params);
// run snippet
return $this->evalSnippet($snippet, $parameters);
}
, äëèííîâàòî òîëüêî.