Source for file HTMLframesConverter.inc
Documentation is available at HTMLframesConverter.inc
* HTML original framed output converter, modified to use Smarty Template.
* This Converter takes output from the {@link Parser} and converts it to HTML-ready output for use with {@link Smarty}.
* phpDocumentor :: automatic documentation generator
* Copyright (c) 2002-2006 Gregory Beaver
* This library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General
* Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* @copyright 2002-2006 Gregory Beaver
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @version CVS: $Id: HTMLframesConverter.inc 318096 2011-10-14 03:05:30Z ashnazg $
* @link http://www.phpdoc.org
* @link http://pear.php.net/PhpDocumentor
* @see parserDocBlock, parserInclude, parserPage, parserClass
* @see parserDefine, parserFunction, parserMethod, parserVar
* This Converter takes output from the {@link Parser} and converts it to HTML-ready output for use with {@link Smarty}.
* @see parserDocBlock, parserInclude, parserPage, parserClass, parserDefine, parserFunction, parserMethod, parserVar
* @version $Id: HTMLframesConverter.inc 318096 2011-10-14 03:05:30Z ashnazg $
* This converter knows about the new root tree processing
* In order to fix PEAR Bug #6389
* Smarty Converter wants elements sorted by type as well as alphabetically
* @see Converter::$sort_page_contents_by_type
* indexes of elements by package that need to be generated
var $leftindex =
array('classes' =>
true, 'pages' =>
true, 'functions' =>
true, 'defines' =>
false, 'globals' =>
false);
* output directory for the current procedural page being processed
* target directory passed on the command-line.
* {@link $targetDir} is malleable, always adding package/ and package/subpackage/ subdirectories onto it.
* output directory for the current class being processed
* array of converted package page names.
* Used to link to the package page in the left index
* @var array Format: array(package => 1)
* controls formatting of parser informative output
* "Converting /path/to/file.php... Procedural Page Elements... Classes..."
* Since HTMLdefaultConverter 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
* 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
* sets {@link $base_dir} to $targetDir
function HTMLframesConverter(&$allp, &$packp, &$classes, &$procpages, $po, $pp, $qm, $targetDir, $templateDir, $title)
Converter::Converter($allp, $packp, $classes, $procpages,$po, $pp, $qm, $targetDir, $templateDir, $title);
* @deprecated in favor of PHP 4.3.0+ tokenizer-based source highlighting
$sourcecode =
str_replace('<code>','<pre>',$sourcecode);
$sourcecode =
str_replace('</code>','</pre>',$sourcecode);
* @param string full path to the source file
* @param string fully highlighted source code
$pathinfo =
$this->proceduralpages->getPathInfo($path, $this);
$templ->assign('source',$value);
$templ->assign('package',$pathinfo['package']);
$templ->assign('subpackage',$pathinfo['subpackage']);
$templ->assign('name',$pathinfo['name']);
$templ->assign('source_loc',$pathinfo['source_loc']);
$templ->assign('docs',$pathinfo['docs']);
$templ->assign("subdir",'../');
$templ->register_outputfilter('HTMLframes_outputfilter');
$this->writefile($this->getFileSourceName($path).
'.html',$templ->fetch('filesource.tpl'));
$templ->assign('source',$source);
$templ->assign('title',$title);
$templ->assign('file',$path);
$templ->assign("subdir",'../');
$templ->register_outputfilter('HTMLframes_outputfilter');
$this->writefile('exsource_'.
$path.
'.html',$templ->fetch('examplesource.tpl'));
* Retrieve a Converter-specific anchor to a segment of a source code file
* parsed via a {@tutorial tags.filesource.pkg} tag.
* @param string full path to source file
* @param string name of anchor
* @param string link text, if this is a link
* @param boolean returns either a link or a destination based on this
* @return string link to an anchor, or the anchor
return '<a name="a'.
$anchor.
'"></a>';
* 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
* @param integer line number
* @param string highlighted source code line
* @param false|stringfull path to @filesource file this line is a part of,
* if this is a single line from a complete file.
* @return string formatted source code line with line number
function sourceLine($linenumber, $line, $path =
false)
return '<li><div class="src-line">' .
$this->getSourceAnchor($path, $linenumber) .
return '<li><div class="src-line">' .
str_replace("\n",'',$line) .
* Used to convert the <<code>> tag in a docblock
function ProgramExample($example, $tutorial =
false, $inlinesourceparse =
null/*false*/,
$class =
null/*false*/, $linenum =
null/*false*/, $filesourcepath =
null/*false*/)
return '<div class="src-code"><ol>' .
parent::ProgramExample($example, $tutorial, $inlinesourceparse, $class, $linenum, $filesourcepath)
return $this->curname .
'.html';
* Uses htmlspecialchars() on the input
return str_replace(array(' ',"\t"), array(' ', ' '),
* Use the template tutorial_toc.tpl to generate a table of contents for HTML
* @return string table of contents formatted for use in the current output format
* @param array format: array(array('tagname' => section, 'link' => returnsee link, 'id' => anchor name, 'title' => from title tag),...)
$template->assign('toc',$toc);
return $template->fetch('tutorial_toc.tpl');
if (!isset
($this->package_index))
if (!isset
($start)) $start =
$key;
$this->package_index[] =
array('link' =>
"li_$key.html", 'title' =>
$key);
$templ->assign("packageindex",$this->package_index);
$templ->assign("subdir",'');
* Writes out the template file of {@link $class_data} and unsets the template to save memory
* @see registerCurrentClass()
* @see parent::endClass()
$this->class_data->register_outputfilter('HTMLframes_outputfilter');
$this->writefile($this->class .
'.html',$this->class_data->fetch('class.tpl'));
* Writes out the template file of {@link $page_data} and unsets the template to save memory
$this->page_data->register_outputfilter('HTMLframes_outputfilter');
$this->writefile($this->page .
'.html',$this->page_data->fetch('page.tpl'));
* @return string <a href="'.$link.'">'.$text.'</a>
return '<a href="'.
$link.
'">'.
$text.
'</a>';
foreach($o1 as $subpackage =>
$links)
for($i=
0;$i<
count($links);$i++
)
$left[$package][$subpackage]['files'][] =
array("link" =>
$this->getId($links[$i]), "title" =>
$links[$i]->name);
$interfaces =
$classes =
false;
foreach($o1 as $subpackage =>
$links)
for($i=
0;$i<
count($links);$i++
)
$class =
$this->classes->getClassByPackage($links[$i]->name, $links[$i]->package);
$isinterface =
$isclass =
false;
if ($class->isInterface()) {
if ($class && isset
($class->docblock) &&
$class->docblock->hasaccess) {
$left[$package][$subpackage]['classes'][] =
array("link" =>
$this->getId($links[$i]),
"title" =>
$links[$i]->name,
'is_interface' =>
$isinterface,
"access" =>
$class->docblock->tags['access'][0]->value,
"abstract" => isset
($class->docblock->tags['abstract'][0]));
$left[$package][$subpackage]['classes'][] =
array("link" =>
$this->getId($links[$i]),
"title" =>
$links[$i]->name,
'is_interface' =>
$isinterface,
"abstract" => isset
($class->docblock->tags['abstract'][0]));
foreach($o1 as $subpackage =>
$links)
for($i=
0;$i<
count($links);$i++
)
$left[$package][$subpackage]['functions'][] =
array("link" =>
$this->getId($links[$i]), "title" =>
$links[$i]->name);
foreach($left as $package =>
$r)
if (isset
($this->package_pages[$package])) $pd =
$package.
'/package_'.
$package.
'.html';
if ($t =
$this->hasTutorial('pkg',$package,$package,''))
$pt =
$t->getLink($this);
$ptnoa =
$this->getId($t->getLink($this,true));
$ptt =
$t->getTitle($this);
foreach($this->tutorial_tree as $root =>
$tr)
if ($tr['tutorial']->package ==
$package &&
$tr['tutorial']->subpackage ==
'') {
$tutes[$tr['tutorial']->tutorial_type][] =
if (isset
($this->childless_tutorials[$package][$subpackage]))
foreach($this->childless_tutorials[$package][$subpackage] as $ext =>
$other)
foreach($other as $tutorial)
'packagetutorial' =>
$pt,
'packagetutorialnoa' =>
$ptnoa,
'packagetutorialtitle' =>
$ptt,
foreach($r as $subpackage =>
$info)
$my['package'] =
$package;
$my['packagedoc'] =
'blank';
$my['subpackage'] =
$subpackage;
if ($t =
$this->hasTutorial('pkg',$package,$package,$subpackage))
$my['packagetutorial'] =
$t->getLink($this);
$my['packagetutorialnoa'] =
$this->getId($t->getLink($this,true));
$my['packagetutorialtitle'] =
$t->getTitle($this);
$my['packagetutorial'] =
'<a href="blank.html">No Package-Level Tutorial</a>';
$my['packagetutorialnoa'] =
'blank.html';
$my['packagetutorialtitle'] =
$package;
if ($t =
$this->hasTutorial('pkg',$subpackage,$package,$subpackage))
$my['subpackagetutorialnoa'] =
$this->getId($t->getLink($this,true));
$my['subpackagetutorialtitle'] =
$t->getTitle($this);
$my['subpackagetutorial'] =
false;
$my['subpackagetutorialnoa'] =
false;
$my['subpackagetutorialtitle'] =
$subpackage;
foreach($this->tutorial_tree as $root =>
$tr)
if ($tr['tutorial']->package ==
$package &&
$tr['tutorial']->subpackage ==
$subpackage)
$tutes[$tr['tutorial']->tutorial_type][] =
$this->getTutorialTree($tr['tutorial']);
$my['tutorials'] =
$tutes;
$my['files'] =
$my['classes'] =
$my['functions'] =
array();
if (isset
($info['files']))
$my['files'] =
$info['files'];
if (isset
($info['classes']))
$my['classes'] =
$info['classes'];
$my['hasclasses'] =
$classes;
$my['hasinterfaces'] =
$interfaces;
if (isset
($info['functions']))
$my['functions'] =
$info['functions'];
// debug($this->vardump_tree($tree));exit;
$template->assign('subtree',false);
$template->assign('name',str_replace('.','',$tutorial->name));
$template->assign('parent',false);
$template->assign('haskids',false);
$template->assign('kids','');
$link->addLink('',$t->path,$t->name,$t->package,$t->subpackage,$t->getTitle($this));
$main =
array('link' =>
$this->getId($link), 'title' =>
$link->title);
$template->assign('main',$main);
return $template->fetch('tutorial_tree.tpl');
if (isset
($tree['kids']))
foreach($tree['kids'] as $subtree)
$template->assign('subtree',$k);
$template->assign('name',str_replace('.','',$tree['tutorial']->name));
$template->assign('parent',($k ?
str_replace('.','',$tree['tutorial']->parent->name) :
false));
$template->assign('haskids',strlen($ret));
$template->assign('kids',$ret);
$link->addLink('',$t->path,$t->name,$t->package,$t->subpackage,$t->getTitle($this));
$main =
array('link' =>
$this->getId($link), 'title' =>
$link->title);
$template->assign('main',$main);
$ret =
$template->fetch('tutorial_tree.tpl');
* HTMLdefaultConverter 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
* @see generateElementIndex(), generatePkgElementIndex()
for($i=
0;$i<
count($package_indexes);$i++
)
$this->package =
$package_indexes[$i]['package'];
$template->assign("index",$package_indexes[$i]['pindex']);
$template->assign("package",$package_indexes[$i]['package']);
$template->assign("letters",$mletters[$package_indexes[$i]['package']]);
$template->register_outputfilter('HTMLframes_outputfilter');
$this->writefile('elementindex_'.
$package_indexes[$i]['package'].
'.html',$template->fetch('pkgelementindex.tpl'));
* HTMLdefaultConverter uses this function to format template index.html and packages.html
* This function generates the package list from {@link $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.
* @global string Used to set the starting package to display
global $phpDocumentor_DefaultPackageName;
$template->assign("index",$elindex);
$template->assign("letters",$mletters);
$template->register_outputfilter('HTMLframes_outputfilter');
$this->writefile('elementindex.html',$template->fetch('elementindex.tpl'));
usort($this->package_index,"HTMLframes_pindexcmp");
if (!isset
($start)) $start =
$key;
if (isset
($this->pkg_elements[$phpDocumentor_DefaultPackageName])) $start =
$phpDocumentor_DefaultPackageName;
$index->assign("package_count",2);
$index->assign("date",date("r",time()));
$index->assign("title",$this->title);
$index->assign("start","li_$start.html");
$index->register_outputfilter('HTMLframes_outputfilter');
if (isset
($this->tutorials[$start]['']['pkg'][$start .
'.pkg']))
$index->assign("blank",$start.
'/tutorial_'.
$start.
'.pkg');
$index->assign("blank",$start.
'/package_'.
$start);
$index->assign("blank","blank");
$blank->assign('package',$this->package);
$this->writefile("blank.html",$blank->fetch('blank.tpl'));
$this->writefile("index.html",$index->fetch('index.tpl'));
$package->assign('ric',array());
foreach($this->ric_set as $name =>
$u)
$package->append('ric',array('file' =>
'ric_'.
$name.
'.html','name' =>
$name));
$package->assign("packages",$this->package_index);
$package->register_outputfilter('HTMLframes_outputfilter');
$this->writefile("packages.html",$package->fetch('top_frame.tpl'));
$template->assign("date",date("r",time()));
$template->assign("title",$this->title);
$template->assign("package",$key);
$template->register_outputfilter('HTMLframes_outputfilter');
$this->writefile("li_$key.html",$template->fetch('index.tpl'));
* 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 {@link abstractLink} descendants needed for index generation. Conversion of these links to
* text is done by {@link returnSee()}. The {@link $local} parameter is set to false to ensure that paths are correct.
* Then it uses {@link generateFormattedClassTrees()} to create class trees from the template file classtrees.html. Output
* filename is classtrees_packagename.html. This function also unsets {@link $elements} and {@link $pkg_elements} to free
* up the considerable memory these two class vars use
* @see $page_elements, $class_elements, $function_elements
if (0)//!isset($this->left))
debug("Nothing parsed, check the command-line");
$template->assign("info",$x[$package]);
$template->assign('package',$package);
$template->assign("hastutorials",isset
($this->tutorials[$package]));
$template->assign('todolink','todolist.html');
$template->assign("classtreepage","classtrees_$package");
$template->assign("elementindex","elementindex_$package");
$template->register_outputfilter('HTMLframes_outputfilter');
$template->assign("packagedoc",$package.
'/package_' .
$package .
'.html');
$template->assign("packagedoc",false);
$this->writefile("li_$package.html",$template->fetch('left_frame.tpl'));
// Create class tree page
$template->assign("package",$package);
$template->register_outputfilter('HTMLframes_outputfilter');
$this->writefile("classtrees_$package.html",$template->fetch('classtrees.tpl'));
// free up considerable memory
* This function takes an {@link abstractLink} descendant and returns an html link
* @param abstractLink a descendant of abstractlink should be passed, and never text
* @param string text to display in the link
* @param boolean this parameter is not used, and is deprecated
* @param boolean determines whether the returned text is enclosed in an <a> tag
function returnSee(&$element, $eltext =
false, $with_a =
true)
if (!is_object($element) ||
!$element) return false;
if (!$with_a) return $this->getId($element, false);
$eltext .=
$element->class.
'::';
$eltext .=
$element->name;
if ($element->type ==
'function' ||
$element->type ==
'method') $eltext .=
'()';
return '<a href="'.
$this->getId($element).
'">'.
$eltext.
'</a>';
function getId($element, $fullpath =
true)
$element =
$this->addLink($element->parent);
} elseif (is_a($element, 'parserbase'))
$element =
$this->addLink($element);
if (!empty($element->subpackage))
$c =
'/'.
$element->subpackage;
return $b.
$element->package.
$c.
'/'.
$element->fileAlias.
'.html';
return $b.
$element->package.
$c.
'/'.
$element->fileAlias.
'.html#'.
$element->type.
$element->name;
return $element->type.
$element->name;
return $b.
$element->package.
$c.
'/'.
$element->name.
'.html';
return $b.
$element->package.
$c.
'/'.
$element->class.
'.html#'.
$element->type.
$element->name;
return $element->type.
$element->name;
$d =
'#'.
$element->section;
return $b.
$element->package.
$c.
'/tutorial_'.
$element->name.
'.html'.
$d;
* Convert README/INSTALL/CHANGELOG file contents to output format
* @param README|INSTALL|CHANGELOG
* @param string contents of the file
$template->assign('contents',$contents);
$template->assign('name',$name);
$this->writefile('ric_'.
$name .
'.html',$template->fetch('ric.tpl'));
foreach($this->todoList as $package =>
$alltodos)
foreach($alltodos as $todos)
$converted['link'] =
$this->returnSee($todos[0]);
$converted['todos'][] =
$todos[1]->Convert($this);
foreach($todos[1] as $todo)
$converted['todos'][] =
$todo->Convert($this);
$todolist[$package][] =
$converted;
$templ->assign('todos',$todolist);
$templ->register_outputfilter('HTMLframes_outputfilter');
$this->writefile('todolist.html',$templ->fetch('todolist.tpl'));
* Create errors.html template file output
* This method takes all parsing errors and warnings and spits them out ordered by file and line number.
* @global ErrorTracker We'll be using it's output facility
global $phpDocumentor_errors;
$warnings =
$phpDocumentor_errors->returnWarnings();
$errors =
$phpDocumentor_errors->returnErrors();
foreach($warnings as $warning)
$linenum .=
' on line '.
$warning->linenum;
$files[$file]['warnings'][] =
array('name' =>
$linenum, 'listing' =>
$warning->data);
foreach($errors as $error)
$linenum .=
' on line '.
$error->linenum;
$files[$file]['errors'][] =
array('name' =>
$linenum, 'listing' =>
$error->data);
foreach($allfiles as $file =>
$num)
usort($allfiles,'strnatcasecmp');
$allfiles[0] =
"Post-parsing";
foreach($allfiles as $i =>
$a)
$allfiles[$i] =
array('file' =>
$a);
foreach($files as $file =>
$data)
if ($file ==
'##none') $file =
'Post-parsing';
$template->assign("files",$allfiles);
$template->assign("all",$out);
$template->assign("title","phpDocumentor Parser Errors and Warnings");
$this->writefile("errors.html",$template->fetch('errors.tpl'));
* Converts package page and sets its package as used in {@link $package_pages}
* @param parserPackagePage
$this->package =
$element->package;
$contents =
$element->Convert($this);
if ($element->subpackage) $a .=
'../';
$template->assign('subdir',$a);
$template->register_outputfilter('HTMLframes_outputfilter');
$contents =
$template->fetch('tutorial.tpl');
$this->writeFile('tutorial_'.
$element->name.
'.html',$contents);
* Converts class for template output
* @see prepareDocBlock(), generateChildClassList(), generateFormattedClassTree(), getFormattedConflicts()
* @see getFormattedInheritedMethods(), getFormattedInheritedVars()
$this->class_dir =
$element->docblock->package;
if ($element->docblock->subpackage !=
'') $a =
"../$a";
$this->class_data->assign("title","Docs For Class " .
$element->getName());
$this->class_data->assign("page",$element->getName() .
'.html');
* Converts class variables for template output
* @see prepareDocBlock(), getFormattedConflicts()
parent::convertVar($element, array('var_dest' =>
$this->getId($element,false)));
* Converts class variables for template output
* @see prepareDocBlock(), getFormattedConflicts()
* Converts class methods for template output
* @see prepareDocBlock(), getFormattedConflicts()
* Converts function for template output
* @see prepareDocBlock(), parserFunction::getFunctionCall(), getFormattedConflicts()
$funcloc =
$this->getId($this->addLink($element));
* Converts include elements for template output
parent::convertInclude($element, array('include_file' =>
'_'.
strtr($element->getValue(),array('"' =>
'', "'" =>
'','.' =>
'_'))));
* Converts defines for template output
* @see prepareDocBlock(), getFormattedConflicts()
* Converts global variables for template output
* converts procedural pages for template output
* @see prepareDocBlock(), getClassesOnPage()
$this->page_dir =
$element->parent->package;
// registering stuff on the template
$this->page_data->assign("title","Docs for page ".
$element->parent->getFile());
return '_'.
$element->parent->getName();
* returns an array containing the class inheritance tree from the root object to the class
* @param parserClass class variable
* @return array Format: array(root,child,child,child,...,$class)
* @uses parserClass::getParentClassTree()
$tree =
$class->getParentClassTree($this);
$result =
array($class->getName());
$parent =
$tree[$class->getName()];
$subpackage =
$parent->docblock->subpackage;
$package =
$parent->docblock->package;
$x =
$parent->getLink($this);
if (!$x) $x =
$parent->getName();
$parent =
$tree[$parent->getName()];
elseif (isset
($tree[$parent]))
$parent =
$tree[$parent];
for($i=
count($result) -
1;$i>=
0;$i--
)
for($j=
0;$j<
count($result) -
$i;$j++
) $my_nbsp .=
$nbsp;
$distance[$i] =
sprintf($distance[$i],$my_nbsp,$my_nbsp);
return array('classes'=>
$class->getName(),'distance'=>
array(''));
function sortMethod($a, $b)
if ($a->isConstructor) return -
1;
if ($b->isConstructor) return 1;
* returns a template-enabled array of class trees
* @param string $package package to generate a class tree for
* @see $roots, HTMLConverter::getRootTree()
if (!isset
($this->roots['normal'][$package]) &&
!isset
($this->roots['special'][$package])) {
if (isset
($this->roots['normal'][$package])) {
$roots =
$this->roots['normal'][$package];
for($i=
0;$i<
count($roots);$i++
)
$root =
$this->classes->getClassByPackage($roots[$i], $package);
if ($root &&
$root->isInterface()) {
if (isset
($this->roots['special'][$package])) {
$roots =
$this->roots['special'][$package];
foreach ($roots as $parent =>
$classes) {
foreach ($classes as $classinfo) {
$root =
$this->classes->getClassByPackage($classinfo, $package);
if ($root &&
$root->isInterface()) {
'class_tree' =>
"<ul>\n" .
$thistree .
"</ul>\n"
* returns a template-enabled array of interface inheritance trees
* @param string $package package to generate a class tree for
* @see $roots, HTMLConverter::getRootTree()
if (!isset
($this->roots['normal'][$package]) &&
!isset
($this->roots['special'][$package])) {
if (isset
($this->roots['normal'][$package])) {
$roots =
$this->roots['normal'][$package];
for($i=
0;$i<
count($roots);$i++
)
$root =
$this->classes->getClassByPackage($roots[$i], $package);
if ($root &&
!$root->isInterface()) {
if (isset
($this->roots['special'][$package])) {
$roots =
$this->roots['special'][$package];
foreach ($roots as $parent =>
$classes) {
foreach ($classes as $classinfo) {
$root =
$this->classes->getClassByPackage($classinfo, $package);
if ($root &&
!$root->isInterface()) {
'class_tree' =>
"<ul>\n" .
$thistree .
"</ul>\n"
* return formatted class tree for the Class Trees page
* @param array $tree output from {@link getSortedClassTreeFromClass()}
* @param string $package package
* @param boolean $nounknownparent if true, an object's parent will not be checked
* @see Classes::$definitechild, generateFormattedClassTrees()
function getRootTree($tree, $package, $noparent =
false)
if (!$tree) { return ''; }
if (!$noparent && isset
($tree[$cur]['parent']) &&
$tree[$cur]['parent']) {
$my_tree .=
'<li>' .
$tree[$cur]['parent'] .
'<ul>';
$root =
$this->classes->getClassByPackage($tree[$cur]['parent']->name, $package);
$my_tree .=
'<li>' .
$this->returnSee($tree[$cur]['parent']);
if ($tree[$cur]['parent']->package !=
$package) { $my_tree .=
' <b>(Different package)</b><ul>'; }
// if class has no children, or has children that are not yet handled
if (!isset
($kids[$cur])) {
// show the class name itself
$my_tree .=
'<li>'.
$this->returnSee($tree[$cur]['link']);
// handle interfaces, if there are any
$root =
$this->classes->getClassByPackage(
(isset
($tree[$cur]['link']->name) ?
$tree[$cur]['link']->name :
''),
(isset
($tree[$cur]['link']->package) ?
$tree[$cur]['link']->package :
'')
$interfaces =
$root->getImplements();
if (count($interfaces) >
0) {
$my_tree .=
' (implements ';
foreach ($interfaces as $interface) {
$my_tree .=
$needsComma ?
', ' :
'';
$link =
$this->getLink('object ' .
$interface, $package);
if (is_a($link,'abstractLink')) {
if (count($tree[$cur]['children'])) {
if (!isset
($kids[$cur])) {
list
(,$cur) =
each($tree[$cur]['children']);
$cur =
$cur['package'] .
'#' .
$cur['class'];
$cur =
array_pop($lastcur); // will fall into infinite loop if this second array_pop() is removed
$my_tree .=
'</ul></li>'.
"\n";
$my_tree .=
'</ul></li>'.
"\n";
* Generate indexing information for given element
* @param parserElement descendant of parserElement
* @see generateElementIndex()
$Result['type'] =
$elt->type;
$Result['file_name'] =
$elt->file;
$Result['path'] =
$elt->getPath();
if (isset
($elt->docblock))
$Result['description'] =
$elt->docblock->getSDesc($this);
if ($elt->docblock->hasaccess)
$Result['access'] =
$elt->docblock->tags['access'][0]->value;
$Result['access'] =
'public';
$Result['abstract'] = isset
($elt->docblock->tags['abstract'][0]);
$Result['description'] =
'';
$aa =
$Result['description'];
if (!empty($aa)) $aa =
"<br> $aa";
$Result['name'] =
$elt->getName();
$Result['title'] =
'Class';
$Result['listing'] =
'in file '.
$elt->file.
', class '.
$Result['link'].
"$aa";
$Result['name'] =
$elt->getName();
$Result['title'] =
'Constant';
$Result['listing'] =
'in file '.
$elt->file.
', constant '.
$Result['link'].
"$aa";
$Result['name'] =
$elt->getName();
$Result['title'] =
'Global';
$Result['listing'] =
'in file '.
$elt->file.
', global variable '.
$Result['link'].
"$aa";
$Result['name'] =
$elt->getName();
$Result['title'] =
'Function';
$Result['listing'] =
'in file '.
$elt->file.
', function '.
$Result['link'].
"$aa";
$Result['name'] =
$elt->getName();
$Result['title'] =
'Method';
$elt->class.
'::'.
$elt->getName().
'()'
if ($elt->isConstructor) $Result['constructor'] =
1;
$Result['listing'] =
'in file '.
$elt->file.
', method '.
$Result['link'].
"$aa";
$Result['name'] =
$elt->getName();
$Result['title'] =
'Variable';
$Result['link'] =
$this->getVarLink($elt->getName(),
$elt->class.
'::'.
$elt->getName());
$Result['listing'] =
'in file '.
$elt->file.
', variable '.
$Result['link'].
"$aa";
$Result['name'] =
$elt->getName();
$Result['title'] =
'Class Constant';
$elt->class.
'::'.
$elt->getName());
$Result['listing'] =
'in file '.
$elt->file.
', class constant '.
$Result['link'].
"$aa";
$Result['name'] =
$elt->getFile();
$Result['title'] =
'Page';
$Result['listing'] =
'procedural page '.
$Result['link'];
$Result['name'] =
$elt->getName();
$Result['title'] =
'Include';
$Result['link'] =
$elt->getValue();
$Result['listing'] =
'include '.
$Result['name'];
* Generate alphabetical index of all elements
foreach($this->elements as $letter =>
$nutoh)
foreach($this->elements[$letter] as $i =>
$yuh)
if ($this->elements[$letter][$i]->type !=
'include')
if (!isset
($used[$letter]))
$letters[]['letter'] =
$letter;
$elindex['letter'] =
$letter;
if (isset
($elindex['index']))
$elementindex[] =
$elindex;
unset
($letters[count($letters) -
1]);
return array($elementindex,$letters);
$versionControlDirectories =
array ('CVS', 'media/CVS', 'media\\CVS', '.svn', 'media/.svn', 'media\\.svn');
foreach($media as $dir =>
$files)
if (in_array($dir, $versionControlDirectories))
$this->copyFile($files['file'],$subdir);
* calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
* @see Converter::setTargetDir()
if ($this->wrote) return;
$template_images =
array();
* Generate alphabetical index of all elements by package and subpackage
* @param string $package name of a package
* @see $pkg_elements, walk(), generatePkgElementIndexes()
// var_dump($this->pkg_elements[$package]);
foreach($this->pkg_elements[$package] as $subpackage =>
$els)
if (empty($els)) continue;
if (!empty($subpackage)) $subp =
" (<b>subpackage:</b> $subpackage)"; else $subp =
'';
foreach($els as $letter =>
$yuh)
foreach($els[$letter] as $i =>
$yuh)
if ($els[$letter][$i]->type !=
'include')
if (!isset
($used[$letter]))
$letters[]['letter'] =
$letter;
$letterind[$letter] =
count($letters) -
1;
$elindex[$letter]['letter'] =
$letter;
usort($letters,'HTMLframes_lettersort');
while(list
($letter,$tempel) =
each($elindex))
unset
($letters[$letterind[$tempel['letter']]]);
$elementindex[] =
$tempel;
} else $letters =
array();
return array($elementindex,$letters);
* @see generatePkgElementIndex()
$package_names =
array();
$pkgs['package'] =
$package;
$pkg['package'] =
$package;
if (count($pkg['pindex']))
$package_names[] =
$pkgs;
foreach($packages as $i =>
$package)
for($j=
0;$j<
count($package_names);$j++
)
if ($package_names[$j]['package'] !=
$package['package']) $pnames[] =
$package_names[$j];
$packages[$i]['packageindexes'] =
$pnames;
return array($packages,$package_names,$letters);
* @param string name of class
* @param string package name
* @param string full path to look in (used in index generation)
* @param boolean deprecated
* @param boolean return just the URL, or enclose it in an html a tag
* @return mixed false if not found, or an html a link to the class's documentation
* @see parent::getClassLink()
function getClassLink($expr,$package, $file =
false,$text =
false, $with_a =
true)
* @param string name of function
* @param string package name
* @param string full path to look in (used in index generation)
* @param boolean deprecated
* @param boolean return just the URL, or enclose it in an html a tag
* @return mixed false if not found, or an html a link to the function's documentation
* @see parent::getFunctionLink()
* @param string name of define
* @param string package name
* @param string full path to look in (used in index generation)
* @param boolean deprecated
* @param boolean return just the URL, or enclose it in an html a tag
* @return mixed false if not found, or an html a link to the define's documentation
* @see parent::getDefineLink()
function getDefineLink($expr,$package, $file =
false,$text =
false)
* @param string name of global variable
* @param string package name
* @param string full path to look in (used in index generation)
* @param boolean deprecated
* @param boolean return just the URL, or enclose it in an html a tag
* @return mixed false if not found, or an html a link to the global variable's documentation
* @see parent::getGlobalLink()
function getGlobalLink($expr,$package, $file =
false,$text =
false)
* @param string name of procedural page
* @param string package name
* @param string full path to look in (used in index generation)
* @param boolean deprecated
* @param boolean return just the URL, or enclose it in an html a tag
* @return mixed false if not found, or an html a link to the procedural page's documentation
* @see parent::getPageLink()
function getPageLink($expr,$package, $path =
false,$text =
false)
* @param string name of method
* @param string class containing method
* @param string package name
* @param string full path to look in (used in index generation)
* @param boolean deprecated
* @param boolean return just the URL, or enclose it in an html a tag
* @return mixed false if not found, or an html a link to the method's documentation
* @see parent::getMethodLink()
function getMethodLink($expr,$class,$package, $file =
false,$text =
false)
* @param string name of var
* @param string class containing var
* @param string package name
* @param string full path to look in (used in index generation)
* @param boolean deprecated
* @param boolean return just the URL, or enclose it in an html a tag
* @return mixed false if not found, or an html a link to the var's documentation
* @see parent::getVarLink()
function getVarLink($expr,$class,$package, $file =
false,$text =
false)
* @param string name of class constant
* @param string class containing class constant
* @param string package name
* @param string full path to look in (used in index generation)
* @param boolean deprecated
* @param boolean return just the URL, or enclose it in an html a tag
* @return mixed false if not found, or an html a link to the var's documentation
* @see parent::getVarLink()
function getConstLink($expr,$class,$package, $file =
false,$text =
false)
* does a nat case sort on the specified second level value of the array
* does a nat case sort on the specified second level value of the array.
* this one puts constructors first
if (strpos($aa,'CONSTRUCTOR') ===
0)
if (strpos($bb,'CONSTRUCTOR') ===
0)
* This function is not used by HTMLdefaultConverter, but is required by Converter
* @global string name of the package to set as the first package
function HTMLframes_pindexcmp($a, $b)
global $phpDocumentor_DefaultPackageName;
if ($a['title'] ==
$phpDocumentor_DefaultPackageName) return -
1;
if ($b['title'] ==
$phpDocumentor_DefaultPackageName) return 1;
function HTMLframes_lettersort($a, $b)
function HTMLframes_outputfilter($src, &$smarty)
return str_replace('../',$smarty->_tpl_vars['subdir'],$src);
Documentation generated on Mon, 05 Dec 2011 21:38:40 -0600 by phpDocumentor 1.4.4