Class: CHMdefaultConverter
Source Location: /phpDocumentor/Converters/CHM/default/CHMdefaultConverter.inc
Class CHMdefaultConverter
Class Overview
Generates files that MS HTML Help Worshop can use to create a MS Windows compiled help file (CHM)
The free MS HTML Help compiler takes the project file (phpdoc.hhp) and reads the table of contents file specified in the project (which is always contents.hhc in phpDocumentor). When the converter reaches stable state, it will also output an index file index.hhk. The free download for MS HTML Help Workshop is available below
Located in /phpDocumentor/Converters/CHM/default/CHMdefaultConverter.inc [line 56]
Converter
|
--CHMdefaultConverter
Author(s):
Information Tags:
|
Properties
|
Methods
|
Inherited Properties, Constants, and Methods
Property Summary
string |
$base_dir |
target directory passed on the command-line. |
string |
$class_dir |
output directory for the current class being processed |
array |
$current |
contains all of the template procedural page element loop data needed for the current template |
array |
$currentclass |
contains all of the template class element loop data needed for the current template |
boolean |
$juststarted |
controls formatting of parser informative output |
array |
$KLinks |
Table of Contents entry for index.hhk |
array |
$leftindex |
indexes of elements by package that need to be generated |
string |
$page_dir |
output directory for the current procedural page being processed |
Method Summary
void |
addKLink() |
Add an item to the index.hhk file |
void |
convertConst() |
Converts class constants for template output |
void |
convertGlobal() |
Converts global variables for template output |
void |
convertPackagepage() |
Converts package page and sets its package as used in $package_pages |
void |
convertPage() |
converts procedural pages for template output |
void |
convertVar() |
Converts class variables for template output |
void |
Convert_RIC() |
Convert README/INSTALL/CHANGELOG file contents to output format |
void |
endClass() |
Writes out the template file of $class_data and unsets the template to save memory |
void |
endPage() |
Writes out the template file of $page_data and unsets the template to save memory |
void |
formatIndex() |
CHMdefaultConverter uses this function to format template index.html and packages.html |
void |
formatLeftIndex() |
Generate indexes for li_package.html and classtree output files |
void |
formatPkgIndex() |
CHMdefaultConverter chooses to format both package indexes and the complete index here |
string |
formatTutorialTOC() |
Use the template tutorial_toc.tpl to generate a table of contents for HTML |
string |
getRootTree() |
return formatted class tree for the Class Trees page |
void |
Output() |
Create the phpdoc.hhp, contents.hhc files needed by MS HTML Help Compiler to create a CHM file |
void |
postProcess() |
Uses htmlspecialchars() on the input |
int |
rcNatCmp() |
does a nat case sort on the specified second level value of the array |
int |
rcNatCmp1() |
does a nat case sort on the specified second level value of the array. |
void |
setTargetDir() |
calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied |
string |
sourceLine() |
Return a line of highlighted source code with formatted line number |
void |
writefile() |
Write a file to disk, and add it to the $hhp_files list of files to include in the generated CHM |
Properties
target directory passed on the command-line.
$targetDir is malleable, always adding package/ and package/subpackage/ subdirectories onto it.
output directory for the current class being processed
contains all of the template procedural page element loop data needed for the current template
contains all of the template class element loop data needed for the current template
controls formatting of parser informative output
Converter prints: "Converting /path/to/file.php... Procedural Page Elements... Classes..." Since CHMdefaultConverter outputs files while converting, it needs to send a \n to start a new line. However, if there is more than one class, output is messy, with multiple \n's just between class file output. This variable prevents that and is purely cosmetic
Table of Contents entry for index.hhk
API Tags:
indexes of elements by package that need to be generated
Redefinition of:
- Converter::$leftindex
- Controls which of the one-element-only indexes are generated.
array of converted package page names.
Used to link to the package page in the left index
output directory for the current procedural page being processed
CHMdefaultConverter wants elements sorted by type as well as alphabetically
API Tags:
Redefinition of:
- Converter::$sort_page_contents_by_type
- This determines whether the $page_contents array should be sorted by element type as well as alphabetically by name
Methods
CHMdefaultConverter CHMdefaultConverter(
&$allp,
&$packp,
&$classes,
&$procpages,
$po,
$pp,
$qm,
$targetDir,
$templateDir,
$title
)
|
|
sets $base_dir to $targetDir
Parameters:
|
&$allp: |
|
|
&$packp: |
|
|
&$classes: |
|
|
&$procpages: |
|
|
$po: |
|
|
$pp: |
|
|
$qm: |
|
|
$targetDir: |
|
|
$templateDir: |
|
|
$title: |
|
API Tags:
Parameters:
API Tags:
Uses: | $hhp_files - creates the array by adding parameter $file |
void addKLink(
string
$name, string
$file, [string
$bookmark = ''], [string
$group = '']
)
|
|
Add an item to the index.hhk file
Parameters:
string |
$name: |
index entry name |
string |
$file: |
filename containing index |
string |
$bookmark: |
html anchor of location in file, if any |
string |
$group: |
group this entry with a string |
API Tags:
Information Tags:
void addSourceTOC(
$name,
$file,
$package,
$subpackage, [
$source = false]
)
|
|
Parameters:
|
$name: |
|
|
$file: |
|
|
$package: |
|
|
$subpackage: |
|
|
$source: |
|
void addTOC(
$name,
$file,
$package,
$subpackage, [
$class = false], [
$tutorial = false]
)
|
|
Parameters:
|
$name: |
|
|
$file: |
|
|
$package: |
|
|
$subpackage: |
|
|
$class: |
|
|
$tutorial: |
|
Converts class constants for template output
Parameters:
API Tags:
Redefinition of:
- Converter::convertConst()
- Converts class constants for template output.
Converts defines for template output
Parameters:
API Tags:
Redefinition of:
- Converter::convertDefine()
- Converts defines for template output
Create errors.html template file output
This method takes all parsing errors and warnings and spits them out ordered by file and line number.
API Tags:
Global: | ErrorTracker $phpDocumentor_errors: We'll be using it's output facility |
Redefinition of:
- Converter::ConvertErrorLog()
- Convert the phpDocumentor parsing/conversion error log
Converts function for template output
Parameters:
API Tags:
Redefinition of:
- Converter::convertFunction()
- Converts function for template output
Converts global variables for template output
Parameters:
Redefinition of:
- Converter::convertGlobal()
- Converts global variables for template output
Converts include elements for template output
Parameters:
API Tags:
Redefinition of:
- Converter::convertInclude()
- Converts includes for template output
Converts class methods for template output
Parameters:
API Tags:
Redefinition of:
- Converter::convertMethod()
- Converts method for template output
Converts package page and sets its package as used in $package_pages
Parameters:
converts procedural pages for template output
Parameters:
API Tags:
Redefinition of:
- Converter::convertPage()
- Default Page Handler
Converts class variables for template output
Parameters:
API Tags:
Redefinition of:
- Converter::convertVar()
- Converts class variables for template output.
void Convert_RIC(
README|INSTALL|CHANGELOG
$name, string
$contents
)
|
|
Convert README/INSTALL/CHANGELOG file contents to output format
Parameters:
README|INSTALL|CHANGELOG |
$name: |
|
string |
$contents: |
contents of the file |
Redefinition of:
- Converter::Convert_RIC()
- Convert README/INSTALL/CHANGELOG file contents to output format
void copyMediaRecursively(
$media,
$targetdir, [
$subdir = '']
)
|
|
Parameters:
|
$media: |
|
|
$targetdir: |
|
|
$subdir: |
|
Writes out the template file of $class_data and unsets the template to save memory
API Tags:
Redefinition of:
- Converter::endClass()
- Called by walk() while converting, when the last class element has been parsed.
Writes out the template file of $page_data and unsets the template to save memory
API Tags:
Redefinition of:
- Converter::endPage()
- Called by walk() while converting, when the last procedural page element has been parsed.
CHMdefaultConverter uses this function to format template index.html and packages.html
This function generates the package list from $all_packages, eliminating any packages that don't have any entries in their package index (no files at all, due to @ignore or other factors). Then it uses the default package name as the first package index to display. It sets the right pane to be either a blank file with instructions on making package-level docs, or the package-level docs for the default package.
API Tags:
Global: | string $phpDocumentor_DefaultPackageName: Used to set the starting package to display |
Redefinition of:
- Converter::formatIndex()
- Called by walk() while converting.
Generate indexes for li_package.html and classtree output files
This function generates the li_package.html files from the template file left.html. It does this by iterating through each of the $page_elements, $class_elements and $function_elements arrays to retrieve the pre-sorted abstractLink descendants needed for index generation. Conversion of these links to text is done by returnSee(). The $local parameter is set to false to ensure that paths are correct. Then it uses generateFormattedClassTrees() to create class trees from the template file classtrees.html. Output filename is classtrees_packagename.html. This function also unsets $elements and $pkg_elements to free up the considerable memory these two class vars use
API Tags:
Redefinition of:
- Converter::formatLeftIndex()
- Called by walk() while converting.
CHMdefaultConverter chooses to format both package indexes and the complete index here
This function formats output for the elementindex.html and pkgelementindex.html template files. It then writes them to the target directory
API Tags:
Redefinition of:
- Converter::formatPkgIndex()
- Called by walk() while converting.
string formatTutorialTOC(
array
$toc
)
|
|
Use the template tutorial_toc.tpl to generate a table of contents for HTML
Parameters:
array |
$toc: |
format: array(array('tagname' => section, 'link' => returnsee link, 'id' => anchor name, 'title' => from title tag),...) |
API Tags:
Return: | table of contents formatted for use in the current output format |
Redefinition of:
- Converter::formatTutorialTOC()
- Creates a table of contents for a {@toc} inline tag in a tutorial
void generateElementIndex(
)
|
|
Generate alphabetical index of all elements
API Tags:
returns an array containing the class inheritance tree from the root object to the class
Parameters:
API Tags:
Redefinition of:
- Converter::generateFormattedClassTree()
- returns an array containing the class inheritance tree from the root object to the class.
void generateFormattedClassTrees(
string
$package
)
|
|
returns a template-enabled array of class trees
Parameters:
string |
$package: |
package to generate a class tree for |
API Tags:
See: | $roots, HTMLConverter::getRootTree() |
void generateFormattedInterfaceTrees(
string
$package
)
|
|
returns a template-enabled array of interface inheritance trees
Parameters:
string |
$package: |
package to generate a class tree for |
API Tags:
See: | $roots, HTMLConverter::getRootTree() |
Get the table of contents for index.hhk
API Tags:
Return: | contents of tocentry.tpl generated from $KLinks |
Information Tags:
void generatePkgElementIndex(
string
$package
)
|
|
Generate alphabetical index of all elements by package and subpackage
Parameters:
string |
$package: |
name of a package |
API Tags:
void generatePkgElementIndexes(
)
|
|
API Tags:
mixed getClassLink(
string
$expr, string
$package, [string
$file = false], [boolean
$text = false], [boolean
$with_a = true]
)
|
|
Parameters:
string |
$expr: |
name of class |
string |
$package: |
package name |
string |
$file: |
full path to look in (used in index generation) |
boolean |
$text: |
deprecated |
boolean |
$with_a: |
return just the URL, or enclose it in an html a tag |
API Tags:
Redefinition of:
- Converter::getClassLink()
- return false or a classLink to $expr
mixed getConstLink(
string
$expr, string
$class, string
$package, [string
$file = false], [boolean
$text = false], boolean
5
)
|
|
Parameters:
boolean |
5: |
return just the URL, or enclose it in an html a tag |
string |
$expr: |
name of class constant |
string |
$class: |
class containing class constant |
string |
$package: |
package name |
string |
$file: |
full path to look in (used in index generation) |
boolean |
$text: |
deprecated |
API Tags:
Redefinition of:
- Converter::getConstLink()
- return false or a constLink to $expr in $class
mixed getDefineLink(
string
$expr, string
$package, [string
$file = false], [boolean
$text = false], boolean
4
)
|
|
Parameters:
boolean |
4: |
return just the URL, or enclose it in an html a tag |
string |
$expr: |
name of define |
string |
$package: |
package name |
string |
$file: |
full path to look in (used in index generation) |
boolean |
$text: |
deprecated |
API Tags:
Redefinition of:
- Converter::getDefineLink()
- return false or a defineLink to $expr
void getExampleLink(
$path,
$title
)
|
|
Parameters:
mixed getFunctionLink(
string
$expr, string
$package, [string
$file = false], [boolean
$text = false], boolean
4
)
|
|
Parameters:
boolean |
4: |
return just the URL, or enclose it in an html a tag |
string |
$expr: |
name of function |
string |
$package: |
package name |
string |
$file: |
full path to look in (used in index generation) |
boolean |
$text: |
deprecated |
API Tags:
Redefinition of:
- Converter::getFunctionLink()
- return false or a functionLink to $expr
mixed getGlobalLink(
string
$expr, string
$package, [string
$file = false], [boolean
$text = false], boolean
4
)
|
|
Parameters:
boolean |
4: |
return just the URL, or enclose it in an html a tag |
string |
$expr: |
name of global variable |
string |
$package: |
package name |
string |
$file: |
full path to look in (used in index generation) |
boolean |
$text: |
deprecated |
API Tags:
Redefinition of:
- Converter::getGlobalLink()
- return false or a globalLink to $expr
void getId(
$element, [
$fullpath = true]
)
|
|
Parameters:
Redefinition of:
- Converter::getId()
- take abstractLink descendant and text $eltext and return a
Generate indexing information for given element
Parameters:
API Tags:
mixed getMethodLink(
string
$expr, string
$class, string
$package, [string
$file = false], [boolean
$text = false], boolean
5
)
|
|
Parameters:
boolean |
5: |
return just the URL, or enclose it in an html a tag |
string |
$expr: |
name of method |
string |
$class: |
class containing method |
string |
$package: |
package name |
string |
$file: |
full path to look in (used in index generation) |
boolean |
$text: |
deprecated |
API Tags:
Redefinition of:
- Converter::getMethodLink()
- return false or a methodLink to $expr in $class
mixed getPageLink(
string
$expr, string
$package, [string
$path = false], [boolean
$text = false], boolean
4
)
|
|
Parameters:
boolean |
4: |
return just the URL, or enclose it in an html a tag |
string |
$expr: |
name of procedural page |
string |
$package: |
package name |
string |
$path: |
full path to look in (used in index generation) |
boolean |
$text: |
deprecated |
API Tags:
Redefinition of:
- Converter::getPageLink()
- return false or a pageLink to $expr
void getPageName(
&$element
)
|
|
Parameters:
string getRootTree(
array
$tree, string
$package, [
$noparent = false], boolean
$nounknownparent
)
|
|
return formatted class tree for the Class Trees page
Parameters:
array |
$tree: |
output from getSortedClassTreeFromClass() |
string |
$package: |
package |
boolean |
$nounknownparent: |
if true, an object's parent will not be checked |
|
$noparent: |
|
API Tags:
string getSourceAnchor(
string
$sourcefile, string
$anchor, [string
$text = ''], [boolean
$link = false]
)
|
|
Retrieve a Converter-specific anchor to a segment of a source code file parsed via a @filesource tag.
Parameters:
string |
$sourcefile: |
full path to source file |
string |
$anchor: |
name of anchor |
string |
$text: |
link text, if this is a link |
boolean |
$link: |
returns either a link or a destination based on this parameter |
API Tags:
Return: | link to an anchor, or the anchor |
void getTutorialId(
$package,
$subpackage,
$tutorial,
$id
)
|
|
Parameters:
|
$package: |
|
|
$subpackage: |
|
|
$tutorial: |
|
|
$id: |
|
Redefinition of:
- Converter::getTutorialId()
- Return a converter-specific id to distinguish tutorials and their sections
mixed getVarLink(
string
$expr, string
$class, string
$package, [string
$file = false], [boolean
$text = false], boolean
5
)
|
|
Parameters:
boolean |
5: |
return just the URL, or enclose it in an html a tag |
string |
$expr: |
name of var |
string |
$class: |
class containing var |
string |
$package: |
package name |
string |
$file: |
full path to look in (used in index generation) |
boolean |
$text: |
deprecated |
API Tags:
Redefinition of:
- Converter::getVarLink()
- return false or a varLink to $expr in $class
Create the phpdoc.hhp, contents.hhc files needed by MS HTML Help Compiler to create a CHM file
The output function generates the table of contents (contents.hhc) and file list (phpdoc.hhp) files used to create a .CHM by the free MS HTML Help compiler. {@, a list of all separate .html files is created in CHM format, and written to phpdoc.hhp. This list was generated by writefile. Next, a call to the table of contents: phpDocumentor_out("NOTE: to create the documentation.chm file, you must now run Microsoft Help Workshop on phpdoc.hhp\n");
phpDocumentor_out("To get the free Microsoft Help Workshop, browse to: http://go.microsoft.com/fwlink/?LinkId=14188\n");
finishes things off}}
API Tags:
Information Tags:
Redefinition of:
- Converter::Output()
- do all necessary output
void postProcess(
$text
)
|
|
Uses htmlspecialchars() on the input
Parameters:
Redefinition of:
- Converter::postProcess()
- This version does nothing
string ProgramExample(
string
$example, [boolean
$tutorial = false], [
$inlinesourceparse = null], [
$class = null], [
$linenum = null], [
$filesourcepath = null]
)
|
|
Used to convert the <code> tag in a docblock
Parameters:
string |
$example: |
|
boolean |
$tutorial: |
|
|
$inlinesourceparse: |
|
|
$class: |
|
|
$linenum: |
|
|
$filesourcepath: |
|
Redefinition of:
- Converter::ProgramExample()
- Used to convert the <code> tag in a docblock
int rcNatCmp(
mixed
$a, mixed
$b
)
|
|
does a nat case sort on the specified second level value of the array
Parameters:
int rcNatCmp1(
mixed
$a, mixed
$b
)
|
|
does a nat case sort on the specified second level value of the array.
this one puts constructors first
Parameters:
string returnLink(
string
$link, string
$text
)
|
|
Parameters:
string |
$link: |
|
string |
$text: |
|
API Tags:
Return: | <a href="'.$link.'">'.$text.'</a> |
Redefinition of:
- Converter::returnLink()
- take URL $link and text $text and return a link in the format needed for the Converter
void returnSee(
abstractLink
&$element, [string
$eltext = false], [boolean
$with_a = true], boolean
3
)
|
|
This function takes an abstractLink descendant and returns an html link
Parameters:
boolean |
3: |
determines whether the returned text is enclosed in an <a> tag |
abstractLink |
&$element: |
a descendant of abstractlink should be passed, and never text |
string |
$eltext: |
text to display in the link |
boolean |
$with_a: |
this parameter is not used, and is deprecated |
Redefinition of:
- Converter::returnSee()
- take abstractLink descendant and text $eltext and return a link
void setTargetDir(
$dir
)
|
|
calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
Parameters:
API Tags:
Redefinition of:
- Converter::setTargetDir()
- Sets the output directory for generated documentation
void setTemplateDir(
$dir
)
|
|
Parameters:
Redefinition of:
- Converter::setTemplateDir()
- sets the template directory based on the $outputformat and $name
void &SmartyInit(
&$templ
)
|
|
Parameters:
string sourceLine(
integer
$linenumber, string
$line, [false|string
$path = false]
)
|
|
Return a line of highlighted source code with formatted line number
If the $path is a full path, then an anchor to the line number will be added as well
Parameters:
integer |
$linenumber: |
line number |
string |
$line: |
highlighted source code line |
false|string |
$path: |
full path to @filesource file this line is a part of, if this is a single line from a complete file. |
API Tags:
Return: | formatted source code line with line number |
Redefinition of:
- Converter::sourceLine()
- Return a line of highlighted source code with formatted line number
void writeExample(
$title,
$path,
$source
)
|
|
Parameters:
Redefinition of:
- Converter::writeExample()
- Write out the formatted source code for an example php file
void writefile(
$file,
$contents
)
|
|
Write a file to disk, and add it to the $hhp_files list of files to include in the generated CHM
{
}
Parameters:
void writeNewPPage(
$key
)
|
|
Parameters:
void writeSource(
string
$path, string
$value
)
|
|
Parameters:
string |
$path: |
full path to the source file |
string |
$value: |
fully highlighted source code |
Redefinition of:
- Converter::writeSource()
- Write out the formatted source code for a php file
|
|