/** Write the HTML page to disk using the given path. * * @param str path The path to write the file to * @param str title The title for this page * @param bool shell Include the page shell in the output */ function _write($path) { $phpdoctor =& $this->_doclet->phpdoctor(); // make directory separators suitable to this platform $path = str_replace("/", DIRECTORY_SEPARATOR, $path); // make directories if they don"t exist $dirs = explode(DIRECTORY_SEPARATOR, $path); array_pop($dirs); $testPath = $this->_doclet->destinationPath(); foreach ($dirs as $dir) { $testPath .= $dir . DIRECTORY_SEPARATOR; if (!is_dir($testPath)) { if (!@mkdir($testPath)) { $phpdoctor->error(sprintf('Could not create directory "%s"', $testPath)); exit; } } } // write file $fp = fopen($this->_doclet->destinationPath() . $path, "w"); if ($fp) { $phpdoctor->message('Writing "' . $path . '"'); fwrite($fp, $this->_output); fclose($fp); } else { $phpdoctor->error('Could not write "' . $this->_doclet->destinationPath() . $path . '"'); exit; } }
/** Write the HTML page to disk using the given path. * * @param str path The path to write the file to * @param str title The title for this page * @param bool shell Include the page shell in the output */ function _write($path, $title, $shell) { $phpdoctor =& $this->_doclet->phpdoctor(); // make directories if they don't exist $dirs = explode('/', $path); array_pop($dirs); $testPath = $this->_doclet->destinationPath(); foreach ($dirs as $dir) { $testPath .= $dir . '/'; if (!is_dir($testPath)) { if (!@mkdir($testPath)) { $phpdoctor->error(sprintf('Could not create directory "%s"', $testPath)); exit; } } } // write file $fp = fopen($this->_doclet->destinationPath() . $path, 'w'); if ($fp) { $phpdoctor->message('Writing "' . $path . '"'); fwrite($fp, $this->_htmlHeader($title)); if ($shell) { fwrite($fp, $this->_shellHeader($path)); } fwrite($fp, $this->_output); if ($shell) { fwrite($fp, $this->_shellFooter($path)); } fwrite($fp, $this->_htmlFooter()); fclose($fp); } else { $phpdoctor->error('Could not write "' . $this->_doclet->destinationPath() . $path . '"'); exit; } }