\n"); } // Write out closing line, and end files fputs_wrapper($index, " \n\n"); fputs_wrapper($toc, " \n\n"); fclose($index); fclose($toc); } // makeContentfiles() function end // Generates the HTML Help project file function makeProjectFile() { global $LANGUAGE, $MANUAL_TITLE, $LANGUAGES, $HTML_PATH, $FANCY_PATH, $INDEX_IN_HTML, $FIRST_PAGE; // Try to find the fancy index file if (file_exists("$FANCY_PATH/fancy-index.html")) { $FIRST_PAGE = 'fancy-index.html'; } else { $FIRST_PAGE = $INDEX_IN_HTML; } $FIRST_PAGEP = substr($FANCY_PATH, 4) . "\\$FIRST_PAGE"; // Start writing the project file $project = fopen("chm/smarty_manual_$LANGUAGE.hhp", "w"); fputs_wrapper($project, "[OPTIONS]\n"); fputs_wrapper($project, "Compatibility=1.1 or later\n"); fputs_wrapper($project, "Compiled file=smarty_manual_$LANGUAGE.chm\n"); fputs_wrapper($project, "Contents file=smarty_manual_$LANGUAGE.hhc\n"); fputs_wrapper($project, "Index file=smarty_manual_$LANGUAGE.hhk\n"); fputs_wrapper($project, "Default Window=smarty\n"); fputs_wrapper($project, "Default topic=$FIRST_PAGEP\n"); fputs_wrapper($project, "Display compile progress=Yes\n"); fputs_wrapper($project, "Full-text search=Yes\n"); // Get the proper language code from the array fputs_wrapper($project, "Language={$LANGUAGES[$LANGUAGE]["langcode"]}\n"); // Now try to find out how the manual named in the actual language // this must be in the index.html file as the title (DSSSL generated) $content = oneLiner("$HTML_PATH/$INDEX_IN_HTML"); if (preg_match("|([^<]*)|U", $content, $found)) { $MANUAL_TITLE = $found[1]; } else { // Fallback $MANUAL_TITLE = "Smarty Manual"; } fputs_wrapper($project, "Title=$MANUAL_TITLE\n"); fputs_wrapper($project, "Default Font={$LANGUAGES[$LANGUAGE]['preferred_font']}\n"); // Define the phpdoc window style (adds more functionality) fputs_wrapper($project, "\n[WINDOWS]\nsmarty=\"$MANUAL_TITLE\",\"smarty_manual_$LANGUAGE.hhc\",\"smarty_manual_$LANGUAGE.hhk\"," . "\"$FIRST_PAGEP\",\"$FIRST_PAGEP\",,,,,0x23520,,0x386e,,,,,,,,0\n"); // Write out all the filenames as in FANCY_PATH fputs_wrapper($project, "\n[FILES]\n"); $handle = opendir($FANCY_PATH); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { fputs_wrapper($project, substr($FANCY_PATH, 4)."\\$file\n"); } } closedir($handle); fclose($project); } // makeProjectFile() function end // Print out a SiteMap object for a file function mapAndIndex($name, $local, $tabs, $toc, $index, $imgnum = "auto") { global $FANCY_PATH; $name = str_replace('"', '"', $name); fputs_wrapper($toc, " $tabs
  • $tabs $tabs "); if ($imgnum != "auto") { fputs_wrapper($toc, "$tabs \r\n"); } fputs_wrapper($toc, "$tabs \r\n"); fputs_wrapper($index, "
  • "); } // mapAndIndex() function end // Process a file, and find any links need to be presented in tree function findDeeperLinks ($filename, $toc, $index) { global $HTML_PATH; $contents = oneLiner("$HTML_PATH/$filename"); // Find all sublinks if (preg_match_all("!([^<]*)!U", $contents, $matches, PREG_SET_ORDER)) { // Print out the file informations for all the links fputs_wrapper($toc, "\n
      "); foreach ($matches as $onematch) { $param["html"] = $onematch[1]; if (!empty($onematch[3])) { $param["html"] .= $onematch[3]; } $param["title"] = strip_tags($onematch[4]); mapAndIndex($param["title"], $param["html"], " ", $toc, $index); } fputs_wrapper($toc, "
    \n"); } else { echo "no deeper TOC info found in $filename\n"; } } // findDeeperLinks() function end ?>