omitRedundantIncludes = $omitRedundantIncludes; parent::Circuit(C_INTERNAL, $folder, $name); } function addPrefuseaction($children = array()) { if($this->omitRedundantIncludes) { echo 'Warning: you are adding a <prefuseaction> to a circuit which omits redundant includes. If you call a fuseaction using <include> instead of <do>, the prefuseaction will not be executed.'; } parent::addPrefuseaction($children); } function addPostfuseaction($children = array()) { if($this->omitRedundantIncludes) { echo 'Warning: you are adding a <postfuseaction> to a circuit which omits redundant includes. If you call a fuseaction using <include> instead of <do>, the postfuseaction will not be executed.'; } parent::addPostfuseaction($children); } function addFa($faName, $children = array(), $isPublic = true) { if(!$this->omitRedundantIncludes) { parent::addFa($faName, $children, $isPublic); } } function includeTag($name, $text = '') //for model and view circuits only { if($text != '') { $this->files[] = array('fullName' => $this->folder.DIRSEP.$name.FILE_EXTENSION, 'content' => $text); } $tag = $this->doc->createElement('include'); $tag->setAttribute('template', $name); return $tag; } function save() { $results = Circuit::save(); foreach($this->files as $file) { $filename = $file['fullName']; if (!$handle = fopen($filename, 'w')) { $results[] = array('error' => 'Could not open file for writing (may already exist): '.$filename); continue; } if (fwrite($handle, $file['content']) === FALSE) { $results[] = array('error' => 'Could not write to file: '.$filename); continue; } fclose($handle); $results[] = array('includefile' => 'Wrote '.round(strlen($file['content']) / 1024, 1).'K to '.$filename); } return $results; } } ?>