/** * Will return a new node object * * @param string $table is the table id (not needed most of the time) * @param integer $id is the id needed * @param array $data may contain the data of the node, in order to preload it with data * */ function newNode($table = "node", $id = false, $data = false) { // will include the right module class if needed, for example, specialized modules like ftp datasource // currently the base module is used if ($table != '') { require_once 'node.class.php'; $node = new node($table); // experimental optimized node class support : /* require_once('node_cached.class.php'); $node = new node_cached($table); */ if ($id) { $node->setId($id); } // if a data array is passed, we assign it to the node, and assume it is loaded. This is an optimization if ($data) { $node->loadByArray($data); } return $node; } else { trigger_error('thinkedit::newNode() $table not defined'); return false; } return false; }