Source for file HTMLSmartyConverter.inc

Documentation is available at HTMLSmartyConverter.inc

  1. <?php
  2. /**
  3.  * HTML output converter for Smarty Template.
  4.  * This Converter takes output from the {@link Parser} and converts it to HTML-ready output for use with {@link Smarty}.
  5.  *
  6.  * phpDocumentor :: automatic documentation generator
  7.  *
  8.  * PHP versions 4 and 5
  9.  *
  10.  * Copyright (c) 2000-2006 Joshua Eichorn, Gregory Beaver
  11.  *
  12.  * LICENSE:
  13.  *
  14.  * This library is free software; you can redistribute it
  15.  * and/or modify it under the terms of the GNU Lesser General
  16.  * Public License as published by the Free Software Foundation;
  17.  * either version 2.1 of the License, or (at your option) any
  18.  * later version.
  19.  *
  20.  * This library is distributed in the hope that it will be useful,
  21.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  23.  * Lesser General Public License for more details.
  24.  *
  25.  * You should have received a copy of the GNU Lesser General Public
  26.  * License along with this library; if not, write to the Free Software
  27.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  28.  *
  29.  * @package    Converters
  30.  * @subpackage HTMLframes
  31.  * @author     Joshua Eichorn <[email protected]>
  32.  * @author     Greg Beaver <[email protected]>
  33.  * @copyright  2000-2006 Joshua Eichorn, Gregory Beaver
  34.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  35.  * @version    CVS: $Id: HTMLSmartyConverter.inc 318096 2011-10-14 03:05:30Z ashnazg $
  36.  * @filesource
  37.  * @link       http://www.phpdoc.org
  38.  * @link       http://pear.php.net/PhpDocumentor
  39.  * @see        parserDocBlock, parserInclude, parserPage, parserClass
  40.  * @see        parserDefine, parserFunction, parserMethod, parserVar
  41.  * @since      1.0rc1
  42.  */
  43. /**
  44.  * HTML output converter.
  45.  * This Converter takes output from the {@link Parser} and converts it to HTML-ready output for use with {@link Smarty}.
  46.  *
  47.  * @package Converters
  48.  * @subpackage HTMLSmarty
  49.  * @see parserDocBlock, parserInclude, parserPage, parserClass, parserDefine, parserFunction, parserMethod, parserVar
  50.  * @author Greg Beaver <[email protected]>
  51.  * @since 1.0rc1
  52.  * @version $Revision: 318096 $
  53.  */
  54. {
  55.     /**
  56.      * This converter knows about the new root tree processing
  57.      * In order to fix PEAR Bug #6389
  58.      * @var boolean 
  59.      */
  60.     var $processSpecialRoots = true;
  61.     /**
  62.      * Smarty Converter wants elements sorted by type as well as alphabetically
  63.      * @see Converter::$sort_page_contents_by_type
  64.      * @var boolean 
  65.      */
  66.     var $sort_page_contents_by_type = true;
  67.     /** @var string */
  68.     var $outputformat = 'HTML';
  69.     /** @var string */
  70.     var $name = 'Smarty';
  71.     /**
  72.      * indexes of elements by package that need to be generated
  73.      * @var array 
  74.      */
  75.     var $leftindex = array('classes' => true'pages' => true'functions' => true'defines' => false'globals' => false);
  76.  
  77.     /**
  78.      * output directory for the current procedural page being processed
  79.      * @var string 
  80.      */
  81.     var $page_dir;
  82.  
  83.     /**
  84.      * target directory passed on the command-line.
  85.      * {@link $targetDir} is malleable, always adding package/ and package/subpackage/ subdirectories onto it.
  86.      * @var string 
  87.      */
  88.     var $base_dir;
  89.  
  90.     /**
  91.      * output directory for the current class being processed
  92.      * @var string 
  93.      */
  94.     var $class_dir;
  95.  
  96.     /**
  97.      * array of converted package page names.
  98.      * Used to link to the package page in the left index
  99.      * @var array Format: array(package => 1)
  100.      */
  101.     var $package_pages = array();
  102.  
  103.     /**
  104.      * controls formatting of parser informative output
  105.      *
  106.      * Converter prints:
  107.      * "Converting /path/to/file.php... Procedural Page Elements... Classes..."
  108.      * Since HTMLdefaultConverter outputs files while converting, it needs to send a \n to start a new line.  However, if there
  109.      * is more than one class, output is messy, with multiple \n's just between class file output.  This variable prevents that
  110.      * and is purely cosmetic
  111.      * @var boolean 
  112.      */
  113.     var $juststarted = false;
  114.  
  115.     /**
  116.      * contains all of the template procedural page element loop data needed for the current template
  117.      * @var array 
  118.      */
  119.     var $current;
  120.  
  121.     /**
  122.      * contains all of the template class element loop data needed for the current template
  123.      * @var array 
  124.      */
  125.     var $currentclass;
  126.     var $wrote = false;
  127.     var $ric_set = array();
  128.  
  129.     /**
  130.      * sets {@link $base_dir} to $targetDir
  131.      * @see Converter()
  132.      */
  133.  
  134.     /**#@+
  135.      * @access private
  136.      */
  137.     var $_classleft_cache false;
  138.     var $_classcontents_cache false;
  139.     var $_pagecontents_cache false;
  140.     var $_pageleft_cache false;
  141.     var $_done_package_index false;
  142.     var $_ric_done false;
  143.     var $_wrote_tdir false;
  144.     var $ric_contents array();
  145.     /**#@-*/
  146.  
  147.     function HTMLSmartyConverter(&$allp&$packp&$classes&$procpages$po$pp$qm$targetDir$templateDir$title)
  148.     {
  149.         Converter::Converter($allp$packp$classes$procpages,$po$pp$qm$targetDir$templateDir$title);
  150.         $this->base_dir = $targetDir;
  151.     }
  152.  
  153.     function writeSource($path$value)
  154.     {
  155.         $templ &$this->newSmarty();
  156.         $pathinfo $this->proceduralpages->getPathInfo($path$this);
  157.         $templ->assign('source',$value);
  158.         $templ->assign('package',$pathinfo['package']);
  159.         $templ->assign('subpackage',$pathinfo['subpackage']);
  160.         $templ->assign('name',$pathinfo['name']);
  161.         $templ->assign('source_loc',$pathinfo['source_loc']);
  162.         $templ->assign('docs',$pathinfo['docs']);
  163.         $templ->assign("subdir",'../');
  164.         $templ->register_outputfilter('HTMLSmarty_outputfilter');
  165.         $this->setTargetDir($this->getFileSourcePath($this->base_dir));
  166.         phpDocumentor_out("\n");
  167.         $this->setSourcePaths($path);
  168.         $this->writefile($this->getFileSourceName($path).'.html',$templ->fetch('filesource.tpl'));
  169.     }
  170.  
  171.     function writeExample($title$path$source)
  172.     {
  173.         $templ &$this->newSmarty();
  174.         $templ->assign('source',$source);
  175.         if (empty($title))
  176.         {
  177.             $title 'example';
  178.             addWarning(PDERROR_EMPTY_EXAMPLE_TITLE$path$title);
  179.         }
  180.         $templ->assign('title',$title);
  181.         $templ->assign('file',$path);
  182.         $templ->assign("subdir",'../');
  183.         $templ->register_outputfilter('HTMLSmarty_outputfilter');
  184.         $this->setTargetDir($this->base_dir . PATH_DELIMITER '__examplesource');
  185.         phpDocumentor_out("\n");
  186.         $this->writefile('exsource_'.$path.'.html',$templ->fetch('examplesource.tpl'));
  187.     }
  188.  
  189.     function getExampleLink($path$title)
  190.     {
  191.         return $this->returnLink('../__examplesource' PATH_DELIMITER 'exsource_'.$path.'.html',$title);
  192.     }
  193.  
  194.     function getSourceLink($path)
  195.     {
  196.         return $this->returnLink('../__filesource/' .
  197.         $this->getFileSourceName($path).'.html','Source Code for this file');
  198.     }
  199.  
  200.     /**
  201.      * Retrieve a Converter-specific anchor to a segment of a source code file
  202.      * parsed via a {@tutorial tags.filesource.pkg} tag.
  203.      * @param string full path to source file
  204.      * @param string name of anchor
  205.      * @param string link text, if this is a link
  206.      * @param boolean returns either a link or a destination based on this
  207.      *                 parameter
  208.      * @return string link to an anchor, or the anchor
  209.      */
  210.     function getSourceAnchor($sourcefile,$anchor,$text '',$link false)
  211.     {
  212.         if ($link{
  213.             return $this->returnLink('../__filesource/' .
  214.                 $this->getFileSourceName($sourcefile'.html#a' $anchor$text);
  215.         else {
  216.             return '<a name="a'.$anchor.'"></a>';
  217.         }
  218.     }
  219.  
  220.     /**
  221.      * Return a line of highlighted source code with formatted line number
  222.      *
  223.      * If the $path is a full path, then an anchor to the line number will be
  224.      * added as well
  225.      * @param integer line number
  226.      * @param string highlighted source code line
  227.      * @param false|stringfull path to @filesource file this line is a part of,
  228.      *         if this is a single line from a complete file.
  229.      * @return string formatted source code line with line number
  230.      */
  231.     function sourceLine($linenumber$line$path false)
  232.     {
  233.         $extra '';
  234.         if (strlen(str_replace("\n"''$line)) == 0{
  235.             $extra '&nbsp;';
  236.         }
  237.         if ($path)
  238.         {
  239.             return '<li><div class="src-line">' $this->getSourceAnchor($path$linenumber.
  240.                    str_replace("\n",'',$line$extra .
  241.                    "</div></li>\n";
  242.         else
  243.         {
  244.             return '<li><div class="src-line">' str_replace("\n",'',$line"$extra</div></li>\n";
  245.         }
  246.     }
  247.  
  248.     /**
  249.      * Used to convert the <<code>> tag in a docblock
  250.      * @param string 
  251.      * @param boolean 
  252.      * @return string 
  253.      */
  254.     function ProgramExample($example$tutorial false$inlinesourceparse null/*false*/,
  255.                             $class null/*false*/$linenum null/*false*/$filesourcepath null/*false*/)
  256.     {
  257.         $trans $this->template_options['desctranslate'];
  258.         $this->template_options['desctranslate'array();
  259.         $example '<ol>' parent::ProgramExample($example$tutorial$inlinesourceparse$class$linenum$filesourcepath)
  260.                .'</ol>';
  261.         $this->template_options['desctranslate'$trans;
  262.         if (!isset($this->template_options['desctranslate'])) return $example;
  263.         if (!isset($this->template_options['desctranslate']['code'])) return $example;
  264.         $example $this->template_options['desctranslate']['code'$example;
  265.         if (!isset($this->template_options['desctranslate']['/code'])) return $example;
  266.         return $example $this->template_options['desctranslate']['/code'];
  267.     }
  268.  
  269.     /**
  270.      * @param string 
  271.      */
  272.     function TutorialExample($example)
  273.     {
  274.         $trans $this->template_options['desctranslate'];
  275.         $this->template_options['desctranslate'array();
  276.         $example '<ol>' parent::TutorialExample($example)
  277.                .'</ol>';
  278.         $this->template_options['desctranslate'$trans;
  279.         if (!isset($this->template_options['desctranslate'])) return $example;
  280.         if (!isset($this->template_options['desctranslate']['code'])) return $example;
  281.         $example $this->template_options['desctranslate']['code'$example;
  282.         if (!isset($this->template_options['desctranslate']['/code'])) return $example;
  283.         return $example $this->template_options['desctranslate']['/code'];
  284.     }
  285.  
  286.     function getCurrentPageLink()
  287.     {
  288.         return $this->curname '.html';
  289.     }
  290.  
  291.     function unmangle($sourcecode)
  292.     {
  293.         $sourcecode str_replace('&nbsp;',' ',$sourcecode);
  294.         $sourcecode str_replace('&amp;','&',$sourcecode);
  295.         $sourcecode str_replace('<br />',"<br>",$sourcecode);
  296.         $sourcecode str_replace('<code>','<pre>',$sourcecode);
  297.         $sourcecode str_replace('</code>','</pre>',$sourcecode);
  298.         $sourcecode str_replace('&lt;','<',$sourcecode);
  299.         $sourcecode str_replace('&gt;','>',$sourcecode);
  300.         return $sourcecode;
  301.     }
  302.  
  303.     /**
  304.      * Uses htmlspecialchars() on the input
  305.      */
  306.     function postProcess($text)
  307.     {
  308.         if ($this->highlightingSource{
  309.             return str_replace(array(' ',"\t")array('&nbsp;''&nbsp;&nbsp;&nbsp;'),
  310.                 htmlspecialchars($text));
  311.         }
  312.         return htmlspecialchars($text);
  313.     }
  314.  
  315.     /**
  316.      * Use the template tutorial_toc.tpl to generate a table of contents for HTML
  317.      * @return string table of contents formatted for use in the current output format
  318.      * @param array format: array(array('tagname' => section, 'link' => returnsee link, 'id' => anchor name, 'title' => from title tag),...)
  319.      */
  320.     function formatTutorialTOC($toc)
  321.     {
  322.         $template &$this->newSmarty();
  323.         $template->assign('toc',$toc);
  324.         return $template->fetch('tutorial_toc.tpl');
  325.     }
  326.  
  327.     function &SmartyInit(&$templ)
  328.     {
  329.         $this->makeLeft();
  330.         $templ->assign("ric",$this->ric_set);
  331.         $templ->assign("packageindex",$this->package_index);
  332.         $templ->assign('hastodos',count($this->todoList));
  333.         $templ->assign('todolink','todolist.html');
  334.         $templ->assign("subdir",'');
  335.         return $templ;
  336.     }
  337.  
  338.     /**
  339.      * Writes out the template file of {@link $class_data} and unsets the template to save memory
  340.      * @see registerCurrentClass()
  341.      * @see parent::endClass()
  342.      */
  343.     function endClass()
  344.     {
  345.         $a '../';
  346.         if (!empty($this->subpackage)) $a .= '../';
  347.         if ($this->juststarted)
  348.         {
  349.             $this->juststarted = false;
  350.             phpDocumentor_out("\n");
  351.             flush();
  352.         }
  353.         $this->setTargetDir($this->base_dir . PATH_DELIMITER $this->class_dir);
  354.         $classleft $this->getClassLeft();
  355.         $this->class_data->assign("compiledfileindex",$this->getPageLeft());
  356.         $this->class_data->assign("compiledclassindex",$classleft['class']);
  357.         $this->class_data->assign("compiledinterfaceindex",$classleft['interface']);
  358.         $this->class_data->assign("tutorials",$this->getTutorialList());
  359.         $this->class_data->assign("contents",$this->getClassContents());
  360.         $this->class_data->assign("packageindex",$this->package_index);
  361.         $this->class_data->assign("package",$this->package);
  362.         $this->class_data->assign("subdir",$a);
  363.         $this->class_data->register_outputfilter('HTMLSmarty_outputfilter');
  364.         $this->writefile($this->class . '.html',$this->class_data->fetch('class.tpl'));
  365.         unset($this->class_data);
  366.     }
  367.  
  368.     function getTutorialList()
  369.     {
  370.         static $cache false;
  371.         if ($cache)
  372.         {
  373.             if (isset($cache[$this->package])) return $cache[$this->package];
  374.         }
  375.         $package $this->package;
  376.         if (!isset($this->tutorials[$package])) return false;
  377.         foreach($this->tutorials[$packageas $subpackage => $blah)
  378.         {
  379.             $subpackages[$subpackage;
  380.         }
  381.         $tutes array();
  382.         foreach($subpackages as $subpackage)
  383.         {
  384.             if (isset($this->tutorial_tree&& is_array($this->tutorial_tree))
  385.             foreach($this->tutorial_tree as $root => $tr)
  386.             {
  387.                 if ($tr['tutorial']->package == $package && $tr['tutorial']->subpackage == $subpackage)
  388.                 $tutes[$tr['tutorial']->tutorial_type][$this->getTutorialTree($tr['tutorial']);
  389.             }
  390.         }
  391.         $cache[$this->package$tutes;
  392.         return $tutes;
  393.     }
  394.  
  395.     function getTutorialTree($tutorial,$k false)
  396.     {
  397.         $ret '';
  398.         if (is_object($tutorial)) $tree parent::getTutorialTree($tutorial)else $tree $tutorial;
  399.         if (!$tree)
  400.         {
  401.             $template &$this->newSmarty();
  402.             $template->assign('subtree',false);
  403.             $template->assign('name',str_replace('.','',$tutorial->name));
  404.             $template->assign('parent',false);
  405.             $template->assign('haskids',false);
  406.             $template->assign('kids','');
  407.             $link new tutorialLink;
  408.             $t $tutorial;
  409.             $link->addLink('',$t->path,$t->name,$t->package,$t->subpackage,$t->getTitle($this));
  410.             $main array('link' => $this->getId($link)'title' => $link->title);
  411.             $template->assign('main',$main);
  412.             return $template->fetch('tutorial_tree.tpl');
  413.         }
  414.         if (isset($tree['kids']))
  415.         {
  416.             foreach($tree['kids'as $subtree)
  417.             {
  418.                 $ret .= $this->getTutorialTree($subtreetrue);
  419.             }
  420.         }
  421.         $template &$this->newSmarty();
  422.         $template->assign('subtree',$k);
  423.         $template->assign('name',str_replace('.','',$tree['tutorial']->name));
  424.         $template->assign('parent',($k str_replace('.','',$tree['tutorial']->parent->namefalse));
  425.         $template->assign('haskids',strlen($ret));
  426.         $template->assign('kids',$ret);
  427.         $link new tutorialLink;
  428.         $t $tree['tutorial'];
  429.         $link->addLink('',$t->path,$t->name,$t->package,$t->subpackage,$t->getTitle($this));
  430.         $main array('link' => $this->getId($link)'title' => $link->title);
  431.         $template->assign('main',$main);
  432.         return $template->fetch('tutorial_tree.tpl');
  433.     }
  434.  
  435.     function getClassLeft()
  436.     {
  437.         if ($this->_classleft_cache)
  438.         {
  439.             if (isset($this->_classleft_cache[$this->package][$this->subpackage])) return $this->_classleft_cache[$this->package][$this->subpackage];
  440.         }
  441.         $arr $classarr $interfacearr array();
  442.         if (isset($this->left['#class'][$this->package]))
  443.         foreach($this->left['#class'][$this->packageas $subpackage => $pages)
  444.         {
  445.             for ($i 0$i count($pages)$i++{
  446.                 if ($pages[$i]['is_interface']{
  447.                     $interfacearr[$subpackage][$pages[$i];
  448.                 else {
  449.                     $classarr[$subpackage][$pages[$i];
  450.                 }
  451.             }
  452.         }
  453.         $templ &$this->newSmarty();
  454.         $templ->assign('classleftindex',$classarr);
  455.         $classarr $templ->fetch('classleft.tpl');
  456.         $this->_classleft_cache[$this->package][$this->subpackage]['class'$classarr;
  457.         $templ &$this->newSmarty();
  458.         $templ->assign('classleftindex',$interfacearr);
  459.         $interfacearr $templ->fetch('classleft.tpl');
  460.         $this->_classleft_cache[$this->package][$this->subpackage]['interface'=
  461.             $interfacearr;
  462.         return $this->_classleft_cache[$this->package][$this->subpackage];
  463.     }
  464.  
  465.     function getClassContents()
  466.     {
  467.         if ($this->_classcontents_cache)
  468.         {
  469.             if (isset($this->_classcontents_cache[$this->package][$this->subpackage][$this->class])) return $this->_classcontents_cache[$this->package][$this->subpackage][$this->class];
  470.         }
  471.         $arr array();
  472.         foreach($this->class_contents[$this->package][$this->subpackage][$this->classas $i => $link)
  473.         {
  474.             if (is_object($link))
  475.             $arr[$link->type][$this->returnSee($link,$link->name);
  476.         }
  477.         $this->_classcontents_cache[$this->package][$this->subpackage][$this->class$arr;
  478.         return $arr;
  479.     }
  480.  
  481.     function getPageContents()
  482.     {
  483.         if (!isset($this->path)) $this->path '#####';
  484.         if ($this->_pagecontents_cache)
  485.         {
  486.             if (isset($this->_pagecontents_cache[$this->package][$this->subpackage][$this->path])) return $this->_pagecontents_cache[$this->package][$this->subpackage][$this->path];
  487.         }
  488.         $arr array();
  489.         foreach($this->page_contents[$this->curpage->package][$this->curpage->subpackageas $i => $link)
  490.         {
  491.             if (is_object($link))
  492.             $arr[$link->type][$i$this->returnSee($link);
  493.         }
  494.         $this->_pagecontents_cache[$this->package][$this->subpackage][$this->path$arr;
  495.         return $arr;
  496.     }
  497.  
  498.     function getPageLeft()
  499.     {
  500.         if ($this->_pageleft_cache)
  501.         {
  502.             if (isset($this->_pageleft_cache[$this->package][$this->subpackage])) return $this->_pageleft_cache[$this->package][$this->subpackage];
  503.         }
  504.         $arr array();
  505.         if (isset($this->left[$this->package]))
  506.         foreach($this->left[$this->packageas $subpackage => $pages)
  507.         {
  508.             $arr[$subpackage$pages;
  509.         }
  510.         $templ &$this->newSmarty();
  511.         $templ->assign('fileleftindex',$arr);
  512.         $arr $templ->fetch('fileleft.tpl');
  513.         $this->_pageleft_cache[$this->package][$this->subpackage$arr;
  514.         return $arr;
  515.     }
  516.  
  517.     /**
  518.      * Writes out the template file of {@link $page_data} and unsets the template to save memory
  519.      * @see registerCurrent()
  520.      * @see parent::endPage()
  521.      */
  522.     function endPage()
  523.     {
  524.         $this->package $this->curpage->package;
  525.         $this->subpackage $this->curpage->subpackage;
  526.         $a '../';
  527.         if (!empty($this->subpackage)) $a .= '../';
  528.         $classleft $this->getClassLeft();
  529.         $this->setTargetDir($this->base_dir PATH_DELIMITER $this->page_dir);
  530.         $this->page_data->assign("contents",$this->getPageContents());
  531.         $this->page_data->assign("compiledfileindex",$this->getPageLeft());
  532.         $this->page_data->assign("compiledclassindex",$classleft['class']);
  533.         $this->page_data->assign("compiledinterfaceindex",$classleft['interface']);
  534.         $this->page_data->assign("tutorials",$this->getTutorialList());
  535.         $this->page_data->assign("packageindex",$this->package_index);
  536.         $this->page_data->assign("package",$this->package);
  537.         $this->page_data->assign("subdir",$a);
  538.         $this->page_data->register_outputfilter('HTMLSmarty_outputfilter');
  539.         $this->writefile($this->page '.html',$this->page_data->fetch('page.tpl'));
  540.         unset($this->page_data);
  541.     }
  542.  
  543.     /**
  544.      * @param string 
  545.      * @param string 
  546.      * @return string &lt;a href="'.$link.'">'.$text.'</a&gt;
  547.      */
  548.     function returnLink($link,$text)
  549.     {
  550.         return '<a href="'.$link.'">'.$text.'</a>';
  551.     }
  552.  
  553.     function makeLeft()
  554.     {
  555.         if ($this->_done_package_indexreturn;
  556.         $this->_done_package_index true;
  557.         if (!isset($this->package_index))
  558.         foreach($this->all_packages as $key => $val)
  559.         {
  560.             if (isset($this->pkg_elements[$key]))
  561.             {
  562.                 if (!isset($start)) $start $key;
  563.                 $this->package_index[array('link' => "li_$key.html"'title' => $key);
  564.             }
  565.         }
  566.         foreach($this->page_elements as $package => $o1)
  567.         {
  568.             foreach($o1 as $subpackage => $links)
  569.             {
  570.                 for($i=0;$i<count($links);$i++)
  571.                 {
  572.                     $this->left[$package][$subpackage][=
  573.                         array("link" => $this->getId($links[$i])"title" => $links[$i]->name);
  574.                 }
  575.             }
  576.         }
  577.         foreach($this->class_elements as $package => $o1)
  578.         {
  579.             foreach($o1 as $subpackage => $links)
  580.             {
  581.                 for($i=0;$i<count($links);$i++)
  582.                 {
  583.                     $isinterface false;
  584.                     if ($links[$i]->type == 'class'{
  585.                         $class $this->classes->getClass($links[$i]->name,
  586.                             $links[$i]->path);
  587.                         if ($class{
  588.                             $isinterface $class->isInterface();
  589.                         }
  590.                     }
  591.                     $this->left['#class'][$package][$subpackage][=
  592.                         array("link" => $this->getId($links[$i])"title" => $links[$i]->name'is_interface' => $isinterface);
  593.                 }
  594.             }
  595.         }
  596.     }
  597.  
  598.     /**
  599.      * HTMLdefaultConverter chooses to format both package indexes and the complete index here
  600.      *
  601.      * This function formats output for the elementindex.html and pkgelementindex.html template files.  It then
  602.      * writes them to the target directory
  603.      * @see generateElementIndex(), generatePkgElementIndex()
  604.      */
  605.     function formatPkgIndex()
  606.     {
  607.         list($package_indexes,$packages,$mletters$this->generatePkgElementIndexes();
  608.         for($i=0;$i<count($package_indexes);$i++)
  609.         {
  610.             $template &$this->newSmarty();
  611.             $this->package $package_indexes[$i]['package'];
  612.             $this->subpackage '';
  613.             $classleft $this->getClassLeft();
  614.             $template->assign("compiledfileindex",$this->getPageLeft());
  615.             $template->assign("compiledclassindex",$classleft['class']);
  616.             $template->assign("compiledinterfaceindex",$classleft['interface']);
  617.             $template->assign("tutorials",$this->getTutorialList());
  618.             $template->assign("index",$package_indexes[$i]['pindex']);
  619.             $template->assign("package",$package_indexes[$i]['package']);
  620.             $template->assign("letters",$mletters[$package_indexes[$i]['package']]);
  621.             $template->assign("title","Package ".$package_indexes[$i]['package']." Element Index");
  622.             $template->assign("date",date("r",time()));
  623.             $template->register_outputfilter('HTMLSmarty_outputfilter');
  624.             $this->setTargetDir($this->base_dir);
  625.             $this->writefile('elementindex_'.$package_indexes[$i]['package'].'.html',$template->fetch('pkgelementindex.tpl'));
  626.         }
  627.         phpDocumentor_out("\n");
  628.         flush();
  629.         }
  630.  
  631.     /**
  632.      * HTMLdefaultConverter uses this function to format template index.html and packages.html
  633.      *
  634.      * This function generates the package list from {@link $all_packages}, eliminating any
  635.      * packages that don't have any entries in their package index (no files at all, due to @ignore
  636.      * or other factors).  Then it uses the default package name as the first package index to display.
  637.      * It sets the right pane to be either a blank file with instructions on making package-level docs,
  638.      * or the package-level docs for the default package.
  639.      * @global string Used to set the starting package to display
  640.      */
  641.     function formatIndex()
  642.     {
  643.         global $phpDocumentor_DefaultPackageName;
  644.         if (!isset($this->package_index))
  645.         {
  646.             debug("\nERROR: Nothing parsed, check the command-line");
  647.             die();
  648.         }
  649.         list($elindex,$mletters$this->generateElementIndex();
  650.         $template &$this->newSmarty();
  651.         $template->assign("index",$elindex);
  652.         $template->assign("letters",$mletters);
  653.         $template->assign("title","Element Index");
  654.         $template->assign("package"false);
  655.         $template->assign("date",date("r",time()));
  656.         phpDocumentor_out("\n");
  657.         flush();
  658.         $this->setTargetDir($this->base_dir);
  659.         $template->register_outputfilter('HTMLSmarty_outputfilter');
  660.         $this->writefile('elementindex.html',$template->fetch('elementindex.tpl'));
  661.         usort($this->package_index,"HTMLSmarty_pindexcmp");
  662.         $index &$this->newSmarty();
  663.         foreach($this->all_packages as $key => $val)
  664.         {
  665.             if (isset($this->pkg_elements[$key]))
  666.             {
  667.                 if (!isset($start)) $start $key;
  668.                 if (!isset($this->package_pages[$key])) $this->writeNewPPage($key);
  669.             }
  670.         }
  671.         // Created index.html
  672.         $start $phpDocumentor_DefaultPackageName;
  673.         if (!isset($this->pkg_elements[$key]))
  674.         {
  675.             // if there are no elements, use a random package as the default
  676.             $a array_keys($this->pkg_elements);
  677.             $start array_shift($a);
  678.         }
  679.         $this->package $start;
  680.         $this->subpackage '';
  681.         $classleft $this->getClassLeft();
  682.         $index->assign("compiledfileindex",$this->getPageLeft());
  683.         $index->assign("compiledclassindex",$classleft['class']);
  684.         $index->assign("compiledinterfaceindex",$classleft['interface']);
  685.         $index->assign('hastodos',count($this->todoList));
  686.         $index->assign('todolink','todolist.html');
  687.         $index->assign("tutorials",$this->getTutorialList());
  688.         $index->assign("date",date("r",time()));
  689.         $index->assign("package",$this->package);
  690.         $index->assign("title",$this->title);
  691.         $index->assign("start","li_$start.html");
  692.         if (isset($this->package_pages[$start]))
  693.         {
  694.             $index->assign("contents",$this->package_pages[$start]);
  695.         }
  696.         $index->register_outputfilter('HTMLSmarty_outputfilter');
  697.         phpDocumentor_out("\n");
  698.         flush();
  699.         $this->setTargetDir($this->base_dir);
  700.         $this->writefile("index.html",$index->fetch('index.tpl'));
  701.         unset($index);
  702.  
  703.     }
  704.  
  705.     function writeNewPPage($key)
  706.     {
  707.         $template &$this->newSmarty();
  708.         $this->package $key;
  709.         $this->subpackage '';
  710.         $classleft $this->getClassLeft();
  711.         $template->assign("compiledfileindex",$this->getPageLeft());
  712.         $template->assign("compiledclassindex",$classleft['class']);
  713.         $template->assign("compiledinterfaceindex",$classleft['interface']);
  714.         $template->assign("tutorials",$this->getTutorialList());
  715.         $template->assign("date",date("r",time()));
  716.         $template->assign("title",$this->title);
  717.         $template->assign("package",$key);
  718.         $template->register_outputfilter('HTMLSmarty_outputfilter');
  719.         phpDocumentor_out("\n");
  720.         flush();
  721.         $this->setTargetDir($this->base_dir);
  722.         $this->writefile("li_$key.html",$template->fetch('index.tpl'));
  723.         unset($template);
  724.     }
  725.  
  726.     /**
  727.      * Generate indexes for li_package.html and classtree output files
  728.      *
  729.      * This function generates the li_package.html files from the template file left.html.  It does this by
  730.      * iterating through each of the $page_elements, $class_elements and  $function_elements arrays to retrieve
  731.      * the pre-sorted {@link abstractLink} descendants needed for index generation.  Conversion of these links to
  732.      * text is done by {@link returnSee()}.
  733.      *
  734.      * Then it uses {@link generateFormattedClassTrees()} to create class trees from the template file classtrees.html.  Output
  735.      * filename is classtrees_packagename.html.  This function also unsets {@link $elements} and {@link $pkg_elements} to free
  736.      * up the considerable memory these two class vars use
  737.      * @see $page_elements, $class_elements, $function_elements
  738.      */
  739.     function formatLeftIndex()
  740.     {
  741.         phpDocumentor_out("\n");
  742.         flush();
  743.         $this->setTargetDir($this->base_dir);
  744.         if (!isset($this->left))
  745.         {
  746.             debug("Nothing parsed, check the command-line");
  747.             die();
  748.         }
  749.         foreach($this->all_packages as $package => $rest)
  750.         {
  751.             if (!isset($this->pkg_elements[$package])) continue;
  752.             // Create class tree page
  753.             $template &$this->newSmarty();
  754.             $classleft $this->getClassLeft();
  755.             $template->assign("compiledfileindex",$this->getPageLeft());
  756.             $template->assign("compiledclassindex",$classleft['class']);
  757.             $template->assign("compiledinterfaceindex",$classleft['interface']);
  758.             $template->assign("classtrees",$this->generateFormattedClassTrees($package));
  759.             $template->assign("interfaces",$this->generateFormattedInterfaceTrees($package));
  760.             $template->assign("package",$package);
  761.             $template->assign("date",date("r",time()));
  762.             $template->assign("title","Class Trees for Package $package");
  763.             $template->register_outputfilter('HTMLSmarty_outputfilter');
  764.             $this->writefile("classtrees_$package.html",$template->fetch('classtrees.tpl'));
  765.             phpDocumentor_out("\n");
  766.             flush();
  767.         }
  768.         $this->writeRIC();
  769.         // free up considerable memory
  770.         unset($this->elements);
  771.         unset($this->pkg_elements);
  772.     }
  773.  
  774.  
  775.     /**
  776.      * This function takes an {@link abstractLink} descendant and returns an html link
  777.      *
  778.      * @param abstractLink a descendant of abstractlink should be passed, and never text
  779.      * @param string text to display in the link
  780.      * @param boolean this parameter is not used, and is deprecated
  781.      * @param boolean determines whether the returned text is enclosed in an &lt;a> tag
  782.      */
  783.     function returnSee(&$element$eltext false$with_a true)
  784.     {
  785.         if (!is_object($element|| !$elementreturn false;
  786.         if (!$with_areturn $this->getId($elementfalse);
  787.         if (!$eltext)
  788.         {
  789.             $eltext '';
  790.             switch($element->type)
  791.             {
  792.                 case 'tutorial' :
  793.                 $eltext strip_tags($element->title);
  794.                 break;
  795.                 case 'method' :
  796.                 case 'var' :
  797.                 case 'const' :
  798.                 $eltext .= $element->class.'::';
  799.                 case 'page' :
  800.                 case 'define' :
  801.                 case 'class' :
  802.                 case 'function' :
  803.                 case 'global' :
  804.                 default :
  805.                 $eltext .= $element->name;
  806.                 if ($element->type == 'function' || $element->type == 'method'$eltext .= '()';
  807.                 break;
  808.             }
  809.         }
  810.         return '<a href="'.$this->getId($element).'">'.$eltext.'</a>';
  811.     }
  812.  
  813.     function getId($element$fullpath true)
  814.     {
  815.         if (phpDocumentor_get_class($element== 'parserdata')
  816.         {
  817.             $element $this->addLink($element->parent);
  818.             $elp $element->parent;
  819.         elseif (is_a($element'parserbase'))
  820.         {
  821.             $elp $element;
  822.             $element $this->addLink($element);
  823.         }
  824.         $c '';
  825.         if (!empty($element->subpackage))
  826.         {
  827.             $c '/'.$element->subpackage;
  828.         }
  829.         $b '../';
  830.         switch ($element->type)
  831.         {
  832.             case 'page' :
  833.             if ($fullpath)
  834.             return $b.$element->package.$c.'/'.$element->fileAlias.'.html';
  835.             return 'top';
  836.             break;
  837.             case 'define' :
  838.             case 'global' :
  839.             case 'function' :
  840.             if ($fullpath)
  841.             return $b.$element->package.$c.'/'.$element->fileAlias.'.html#'.$element->type.$element->name;
  842.             return $element->type.$element->name;
  843.             break;
  844.             case 'class' :
  845.             if ($fullpath)
  846.             return $b.$element->package.$c.'/'.$element->name.'.html';
  847.             return 'top';
  848.             break;
  849.             case 'method' :
  850.             case 'var' :
  851.             case 'const' :
  852.             if ($fullpath)
  853.             return $b.$element->package.$c.'/'.$element->class.'.html#'.$element->type.$element->name;
  854.             return $element->type.$element->name;
  855.             break;
  856.             case 'tutorial' :
  857.             $d '';
  858.             if ($element->section)
  859.             {
  860.                 $d '#'.$element->section;
  861.             }
  862.             return $b.$element->package.$c.'/tutorial_'.$element->name.'.html'.$d;
  863.         }
  864.     }
  865.  
  866.     /**
  867.      * Convert README/INSTALL/CHANGELOG file contents to output format
  868.      * @param README|INSTALL|CHANGELOG
  869.      * @param string contents of the file
  870.      */
  871.     function Convert_RIC($name$contents)
  872.     {
  873.         $this->ric_contents[$name$contents;
  874.         $this->ric_set[array('file' => 'ric_'.$name '.html','name' => $name);
  875.     }
  876.  
  877.     function writeRIC()
  878.     {
  879.         if ($this->_ric_donereturn;
  880.         $this->_ric_done true;
  881.         foreach($this->ric_contents as $name => $contents)
  882.         {
  883.             $template &$this->newSmarty();
  884.             $template->assign('contents',$contents);
  885.             $template->assign('name',$name);
  886.             $template->assign('title',$name);
  887.             $this->setTargetDir($this->base_dir);
  888.             $this->writefile('ric_'.$name '.html',$template->fetch('ric.tpl'));
  889.         }
  890.     }
  891.  
  892.     function ConvertTodoList()
  893.     {
  894.         $todolist array();
  895.         foreach($this->todoList as $package => $alltodos)
  896.         {
  897.             foreach($alltodos as $todos)
  898.             {
  899.                 $converted array();
  900.                 $converted['link'$this->returnSee($todos[0]);
  901.                 if (!is_array($todos[1]))
  902.                 {
  903.                     $converted['todos'][$todos[1]->Convert($this);
  904.                 else
  905.                 {
  906.                     foreach($todos[1as $todo)
  907.                     {
  908.                         $converted['todos'][$todo->Convert($this);
  909.                     }
  910.                 }
  911.                 $todolist[$package][$converted;
  912.             }
  913.         }
  914.         $templ &$this->newSmarty();
  915.         $templ->assign('todos',$todolist);
  916.         $templ->register_outputfilter('HTMLSmarty_outputfilter');
  917.         $this->setTargetDir($this->base_dir);
  918.         $this->writefile('todolist.html',$templ->fetch('todolist.tpl'));
  919.     }
  920.  
  921.     /**
  922.      * Create errors.html template file output
  923.      *
  924.      * This method takes all parsing errors and warnings and spits them out ordered by file and line number.
  925.      * @global ErrorTracker We'll be using it's output facility
  926.      */
  927.     function ConvertErrorLog()
  928.     {
  929.         global $phpDocumentor_errors;
  930.         $allfiles array();
  931.         $files array();
  932.         $warnings $phpDocumentor_errors->returnWarnings();
  933.         $errors $phpDocumentor_errors->returnErrors();
  934.         $template &$this->newSmarty();
  935.         foreach($warnings as $warning)
  936.         {
  937.             $file '##none';
  938.             $linenum 'Warning';
  939.             if ($warning->file)
  940.             {
  941.                 $file $warning->file;
  942.                 $allfiles[$file1;
  943.                 $linenum .= ' on line '.$warning->linenum;
  944.             }
  945.             $files[$file]['warnings'][array('name' => $linenum'listing' => $warning->data);
  946.         }
  947.         foreach($errors as $error)
  948.         {
  949.             $file '##none';
  950.             $linenum 'Error';
  951.             if ($error->file)
  952.             {
  953.                 $file $error->file;
  954.                 $allfiles[$file1;
  955.                 $linenum .= ' on line '.$error->linenum;
  956.             }
  957.             $files[$file]['errors'][array('name' => $linenum'listing' => $error->data);
  958.         }
  959.         $i=1;
  960.         $af array();
  961.         foreach($allfiles as $file => $num)
  962.         {
  963.             $af[$i++$file;
  964.         }
  965.         $allfiles $af;
  966.         usort($allfiles,'strnatcasecmp');
  967.         $allfiles[0"Post-parsing";
  968.         foreach($allfiles as $i => $a)
  969.         {
  970.             $allfiles[$iarray('file' => $a);
  971.         }
  972.         $out array();
  973.         foreach($files as $file => $data)
  974.         {
  975.             if ($file == '##none'$file 'Post-parsing';
  976.             $out[$file$data;
  977.         }
  978.         $template->assign("files",$allfiles);
  979.         $template->assign("all",$out);
  980.         $template->assign("title","phpDocumentor Parser Errors and Warnings");
  981.         $template->register_outputfilter('HTMLSmarty_outputfilter');
  982.         $this->setTargetDir($this->base_dir);
  983.         $this->writefile("errors.html",$template->fetch('errors.tpl'));
  984.         unset($template);
  985.         phpDocumentor_out("\n\nTo view errors and warnings, look at ".$this->base_dirPATH_DELIMITER "errors.html\n");
  986.         flush();
  987.     }
  988.  
  989.     function getCData($value)
  990.     {
  991.         return '<pre>'.htmlentities($value).'</pre>';
  992.     }
  993.  
  994.     function getTutorialId($package,$subpackage,$tutorial,$id)
  995.     {
  996.         return $id;
  997.     }
  998.  
  999.     /**
  1000.      * Converts package page and sets its package as used in {@link $package_pages}
  1001.      * @param parserPackagePage 
  1002.      */
  1003.     function convertPackagepage(&$element)
  1004.     {
  1005.         phpDocumentor_out("\n");
  1006.         flush();
  1007.         $template &$this->newSmarty();
  1008.         $this->package $element->package;
  1009.         $this->subpackage '';
  1010.         $classleft $this->getClassLeft();
  1011.         $template->assign("compiledfileindex",$this->getPageLeft());
  1012.         $template->assign("compiledclassindex",$classleft['class']);
  1013.         $template->assign("compiledinterfaceindex",$classleft['interface']);
  1014.         $template->assign("tutorials",$this->getTutorialList());
  1015.         $template->assign("date",date("r",time()));
  1016.         $template->assign("title",$this->title);
  1017.         $template->assign("package",$element->package);
  1018.         $x $element->Convert($this);
  1019.         $x substr($x,strpos($x,'<body'));
  1020.         $template->assign("contents",trim(substr($x,strpos($x,'>'1)));
  1021.         $this->package_pages[$element->packagetrim(substr($x,strpos($x,'>'1));
  1022.         $template->register_outputfilter('HTMLSmarty_outputfilter');
  1023.         phpDocumentor_out("\n");
  1024.         flush();
  1025.         $this->setTargetDir($this->base_dir);
  1026.         $this->writefile("li_".$element->package.".html",$template->fetch('index.tpl'));
  1027.         unset($template);
  1028.     }
  1029.  
  1030.     /**
  1031.      * @param parserTutorial 
  1032.      */
  1033.     function convertTutorial(&$element)
  1034.     {
  1035.         phpDocumentor_out("\n");
  1036.         flush();
  1037.         $template &parent::convertTutorial($element);
  1038.         $this->package $element->package;
  1039.         $this->subpackage $element->subpackage;
  1040.         $classleft $this->getClassLeft();
  1041.         $template->assign("compiledfileindex",$this->getPageLeft());
  1042.         $template->assign("compiledclassindex",$classleft['class']);
  1043.         $template->assign("compiledinterfaceindex",$classleft['interface']);
  1044.         $template->assign("tutorials",$this->getTutorialList());
  1045.         $template->assign("title",strip_tags($element->getTitle($this)));
  1046.         $contents $element->Convert($this);
  1047.         if ($element->name == $this->package '.pkg')
  1048.         {
  1049.             $this->package_pages[$element->package$contents;
  1050.         }
  1051.         $a '../';
  1052.         if (!empty($element->subpackage)) $a .= $a;
  1053.         $template->assign("subdir",$a);
  1054.         $a '';
  1055.         if ($element->subpackage$a PATH_DELIMITER $element->subpackage;
  1056.         $template->register_outputfilter('HTMLSmarty_outputfilter');
  1057.         $this->setTargetDir($this->base_dir PATH_DELIMITER $element->package $a);
  1058.         $this->writeFile('tutorial_'.$element->name.'.html',$template->fetch('tutorial.tpl'));
  1059.         if ($element->name == $element->package '.pkg')
  1060.         {
  1061.             phpDocumentor_out("\n");
  1062.             flush();
  1063.             // package-level docs
  1064.             $this->setTargetDir($this->base_dir);
  1065.             $template->assign("subdir",'');
  1066.             $this->writeFile('li_'.$element->package.'.html',$template->fetch('tutorial.tpl'));
  1067.         }
  1068.         unset($template);
  1069.     }
  1070.  
  1071.     /**
  1072.      * Converts class for template output
  1073.      * @see prepareDocBlock(), generateChildClassList(), generateFormattedClassTree(), getFormattedConflicts()
  1074.      * @see getFormattedInheritedMethods(), getFormattedInheritedVars()
  1075.      * @param parserClass 
  1076.      */
  1077.     function convertClass(&$element)
  1078.     {
  1079.         parent::convertClass($element);
  1080.         $this->class_dir $element->docblock->package;
  1081.         if (!empty($element->docblock->subpackage)) $this->class_dir .= PATH_DELIMITER $element->docblock->subpackage;
  1082.         $a '../classtrees_';
  1083.         if ($element->docblock->subpackage != ''$a "../$a";
  1084.  
  1085.         $this->class_data->assign('subdir',$a);
  1086.         $this->class_data->assign("title","Docs For Class " $element->getName());
  1087.         $this->class_data->assign("page",$element->getName('.html');
  1088.     }
  1089.  
  1090.     /**
  1091.      * Converts class variables for template output
  1092.      * @see prepareDocBlock(), getFormattedConflicts()
  1093.      * @param parserDefine 
  1094.      */
  1095.     function convertVar(&$element)
  1096.     {
  1097.         parent::convertVar($elementarray('var_dest' => $this->getId($element,false)));
  1098.     }
  1099.  
  1100.     /**
  1101.      * Converts class variables for template output
  1102.      * @see prepareDocBlock(), getFormattedConflicts()
  1103.      * @param parserDefine 
  1104.      */
  1105.     function convertConst(&$element)
  1106.     {
  1107.         parent::convertConst($elementarray('const_dest' => $this->getId($element,false)));
  1108.     }
  1109.  
  1110.     /**
  1111.      * Converts class methods for template output
  1112.      * @see prepareDocBlock(), getFormattedConflicts()
  1113.      * @param parserDefine 
  1114.      */
  1115.     function convertMethod(&$element)
  1116.     {
  1117.         parent::convertMethod($elementarray('method_dest' => $this->getId($element,false)));
  1118.     }
  1119.  
  1120.     /**
  1121.      * Converts function for template output
  1122.      * @see prepareDocBlock(), parserFunction::getFunctionCall(), getFormattedConflicts()
  1123.      * @param parserFunction 
  1124.      */
  1125.     function convertFunction(&$element)
  1126.     {
  1127.         $funcloc $this->getId($this->addLink($element));
  1128.         parent::convertFunction($element,array('function_dest' => $this->getId($element,false)));
  1129.     }
  1130.  
  1131.     /**
  1132.      * Converts include elements for template output
  1133.      * @see prepareDocBlock()
  1134.      * @param parserInclude 
  1135.      */
  1136.     function convertInclude(&$element)
  1137.     {
  1138.         parent::convertInclude($elementarray('include_file'    => '_'.strtr($element->getValue(),array('"' => ''"'" => '','.' => '_'))));
  1139.     }
  1140.  
  1141.     /**
  1142.      * Converts defines for template output
  1143.      * @see prepareDocBlock(), getFormattedConflicts()
  1144.      * @param parserDefine 
  1145.      */
  1146.     function convertDefine(&$element)
  1147.     {
  1148.         parent::convertDefine($elementarray('define_link' => $this->getId($element,false)));
  1149.     }
  1150.  
  1151.     /**
  1152.      * Converts global variables for template output
  1153.      * @param parserGlobal 
  1154.      * @see prepareDocBlock(), getFormattedConflicts()
  1155.      */
  1156.     function convertGlobal(&$element)
  1157.     {
  1158.         parent::convertGlobal($elementarray('global_link' => $this->getId($element,false)));
  1159.     }
  1160.  
  1161.     /**
  1162.      * converts procedural pages for template output
  1163.      * @see prepareDocBlock(), getClassesOnPage()
  1164.      * @param parserData 
  1165.      */
  1166.     function convertPage(&$element)
  1167.     {
  1168.         parent::convertPage($element);
  1169.         $this->juststarted true;
  1170.         $this->page_dir $element->parent->package;
  1171.         if (!empty($element->parent->subpackage)) $this->page_dir .= PATH_DELIMITER $element->parent->subpackage;
  1172.         // registering stuff on the template
  1173.         $a '../';
  1174.         if (!empty($element->docblock->subpackage)) $a $a $a;
  1175.         $this->page_data->assign('subdir',$a);
  1176.         $this->page_data->assign("page",$this->getPageName($element'.html');
  1177.         $this->page_data->assign("title","Docs for page ".$element->parent->getFile());
  1178.     }
  1179.  
  1180.     function getPageName(&$element)
  1181.     {
  1182.         if (phpDocumentor_get_class($element== 'parserpage'return '_'.$element->getName();
  1183.         return '_'.$element->parent->getName();
  1184.     }
  1185.  
  1186.     /**
  1187.      * returns an array containing the class inheritance tree from the root object to the class
  1188.      *
  1189.      * @param parserClass    class variable
  1190.      * @return array Format: array(root,child,child,child,...,$class)
  1191.      * @uses parserClass::getParentClassTree()
  1192.      */
  1193.  
  1194.     function generateFormattedClassTree($class)
  1195.     {
  1196.         $tree $class->getParentClassTree($this);
  1197.         $out '';
  1198.         if (count($tree1)
  1199.         {
  1200.             $result array($class->getName());
  1201.             $parent $tree[$class->getName()];
  1202.             $distance['';
  1203.             while ($parent)
  1204.             {
  1205.                 $x $parent;
  1206.                 if (is_object($parent))
  1207.                 {
  1208.                     $subpackage $parent->docblock->subpackage;
  1209.                     $package $parent->docblock->package;
  1210.                     $x $parent;
  1211.                     $x $parent->getLink($this);
  1212.                     if (!$x$x $parent->getName();
  1213.                 }
  1214.                 $result[=
  1215.                     $x;
  1216.                 $distance[=
  1217.                     "\n%s|\n" .
  1218.                     "%s--";
  1219.                 if (is_object($parent))
  1220.                 $parent $tree[$parent->getName()];
  1221.                 elseif (isset($tree[$parent]))
  1222.                 $parent $tree[$parent];
  1223.             }
  1224.             $nbsp '   ';
  1225.             for($i=count($result1;$i>=0;$i--)
  1226.             {
  1227.                 $my_nbsp '';
  1228.                 for($j=0;$j<count($result$i;$j++$my_nbsp .= $nbsp;
  1229.                 $distance[$isprintf($distance[$i],$my_nbsp,$my_nbsp);
  1230.             }
  1231.             return array('classes'=>array_reverse($result),'distance'=>array_reverse($distance));
  1232.         else
  1233.         {
  1234.             return array('classes'=>$class->getName(),'distance'=>array(''));
  1235.         }
  1236.     }
  1237.  
  1238.     /** @access private */
  1239.     function sortVar($a$b)
  1240.     {
  1241.         return strnatcasecmp($a->getName(),$b->getName());
  1242.     }
  1243.  
  1244.     /** @access private */
  1245.     function sortMethod($a$b)
  1246.     {
  1247.         if ($a->isConstructorreturn -1;
  1248.         if ($b->isConstructorreturn 1;
  1249.         return strnatcasecmp($a->getName(),$b->getName());
  1250.     }
  1251.  
  1252.     /**
  1253.      * returns a template-enabled array of class trees
  1254.      *
  1255.      * @param    string    $package    package to generate a class tree for
  1256.      * @see $roots, HTMLConverter::getRootTree()
  1257.      */
  1258.     function generateFormattedClassTrees($package)
  1259.     {
  1260.         if (!isset($this->roots['normal'][$package]&&
  1261.               !isset($this->roots['special'][$package])) {
  1262.             return array();
  1263.         }
  1264.         $trees array();
  1265.         if (isset($this->roots['normal'][$package])) {
  1266.             $roots $this->roots['normal'][$package];
  1267.             for($i=0;$i<count($roots);$i++)
  1268.             {
  1269.                 $root $this->classes->getClassByPackage($roots[$i]$package);
  1270.                 if ($root && $root->isInterface()) {
  1271.                     continue;
  1272.                 }
  1273.                 $trees[array('class' => $roots[$i],'class_tree' => "<ul>\n".$this->getRootTree($this->getSortedClassTreeFromClass($roots[$i],$package,''),$package)."</ul>\n");
  1274.             }
  1275.         }
  1276.         if (isset($this->roots['special'][$package])) {
  1277.             $roots $this->roots['special'][$package];
  1278.             foreach ($roots as $parent => $classes{
  1279.                 $thistree '';
  1280.                 foreach ($classes as $classinfo{
  1281.                     $root $this->classes->getClassByPackage($classinfo$package);
  1282.                     if ($root && $root->isInterface()) {
  1283.                         continue;
  1284.                     }
  1285.                     $thistree .=
  1286.                         $this->getRootTree(
  1287.                             $this->getSortedClassTreeFromClass(
  1288.                                 $classinfo,
  1289.                                 $package,
  1290.                                 ''),
  1291.                             $package,
  1292.                             true);
  1293.                 }
  1294.                 if (!$thistree{
  1295.                     continue;
  1296.                 }
  1297.                 $trees[array(
  1298.                     'class' => $parent,
  1299.                     'class_tree' => "<ul>\n" $thistree "</ul>\n"
  1300.                 );
  1301.             }
  1302.         }
  1303.         return $trees;
  1304.     }
  1305.  
  1306.     /**
  1307.      * returns a template-enabled array of interface inheritance trees
  1308.      *
  1309.      * @param    string    $package    package to generate a class tree for
  1310.      * @see $roots, HTMLConverter::getRootTree()
  1311.      */
  1312.     function generateFormattedInterfaceTrees($package)
  1313.     {
  1314.         if (!isset($this->roots['normal'][$package]&&
  1315.               !isset($this->roots['special'][$package])) {
  1316.             return array();
  1317.         }
  1318.         $trees array();
  1319.         if (isset($this->roots['normal'][$package])) {
  1320.             $roots $this->roots['normal'][$package];
  1321.             for($i=0;$i<count($roots);$i++)
  1322.             {
  1323.                 $root $this->classes->getClassByPackage($roots[$i]$package);
  1324.                 if ($root && !$root->isInterface()) {
  1325.                     continue;
  1326.                 }
  1327.                 $trees[array('class' => $roots[$i],'class_tree' => "<ul>\n".$this->getRootTree($this->getSortedClassTreeFromClass($roots[$i],$package,''),$package)."</ul>\n");
  1328.             }
  1329.         }
  1330.         if (isset($this->roots['special'][$package])) {
  1331.             $roots $this->roots['special'][$package];
  1332.             foreach ($roots as $parent => $classes{
  1333.                 $thistree '';
  1334.                 foreach ($classes as $classinfo{
  1335.                     $root $this->classes->getClassByPackage($classinfo$package);
  1336.                     if ($root && !$root->isInterface()) {
  1337.                         continue;
  1338.                     }
  1339.                     $thistree .=
  1340.                         $this->getRootTree(
  1341.                             $this->getSortedClassTreeFromClass(
  1342.                                 $classinfo,
  1343.                                 $package,
  1344.                                 ''),
  1345.                             $package,
  1346.                             true);
  1347.                 }
  1348.                 if (!$thistree{
  1349.                     continue;
  1350.                 }
  1351.                 $trees[array(
  1352.                     'class' => $parent,
  1353.                     'class_tree' => "<ul>\n" $thistree "</ul>\n"
  1354.                 );
  1355.             }
  1356.         }
  1357.         return $trees;
  1358.     }
  1359.  
  1360.     /**
  1361.      * return formatted class tree for the Class Trees page
  1362.      *
  1363.      * @param array $tree output from {@link getSortedClassTreeFromClass()}
  1364.      * @param string $package  package
  1365.      * @param boolean $nounknownparent if true, an object's parent will not be checked
  1366.      * @see Classes::$definitechild, generateFormattedClassTrees()
  1367.      * @return string 
  1368.      */
  1369.     function getRootTree($tree$package$noparent false)
  1370.     {
  1371.         if (!$treereturn ''}
  1372.         $my_tree '';
  1373.         $cur '#root';
  1374.         $lastcur array(false);
  1375.         $kids array();
  1376.         $dopar false;
  1377.         if (!$noparent && isset($tree[$cur]['parent']&& $tree[$cur]['parent']{
  1378.             $dopar true;
  1379.             if (!is_object($tree[$cur]['parent'])) {
  1380.                 $my_tree .= '<li>' $tree[$cur]['parent'.'<ul>';
  1381.             else {
  1382.                 $root $this->classes->getClassByPackage($tree[$cur]['parent']->name$package);
  1383.                 $my_tree .= '<li>' $this->returnSee($tree[$cur]['parent']);
  1384.                 if ($tree[$cur]['parent']->package != $package$my_tree .= ' <b>(Different package)</b><ul>'}
  1385.             }
  1386.         }
  1387.  
  1388.         do {
  1389.             // if class has no children, or has children that are not yet handled
  1390.             if (!isset($kids[$cur])) {
  1391.  
  1392.                 // show the class name itself
  1393.                 $my_tree .= '<li>'.$this->returnSee($tree[$cur]['link']);
  1394.  
  1395.                 // handle interfaces, if there are any
  1396.                 $root $this->classes->getClassByPackage(
  1397.                     (isset($tree[$cur]['link']->name)    $tree[$cur]['link']->name    ''),
  1398.                     (isset($tree[$cur]['link']->package$tree[$cur]['link']->package '')
  1399.                 );
  1400.                 $interfaces $root->getImplements();
  1401.                 if (count($interfaces0{
  1402.                     $my_tree .= ' (implements ';
  1403.                     $needsComma false;
  1404.                     foreach ($interfaces as $interface{
  1405.                         $my_tree .= $needsComma ', ' '';
  1406.                         $link $this->getLink('object ' $interface$package);
  1407.                         if (is_a($link,'abstractLink')) {
  1408.                             $my_tree .= $this->returnSee($link);
  1409.                         else {
  1410.                             $my_tree .= $interface;
  1411.                         }
  1412.                         $needsComma true;
  1413.                     }
  1414.                     unset($needsComma);
  1415.                     $my_tree .= ')';
  1416.                 }
  1417.             }
  1418.  
  1419.             if (count($tree[$cur]['children'])) {
  1420.                 if (!isset($kids[$cur])) {
  1421.                     $kids[$cur1;
  1422.                     $my_tree .= '<ul>'."\n";
  1423.                 }
  1424.                 array_push($lastcur,$cur);
  1425.                 list(,$cureach($tree[$cur]['children']);
  1426.                 if ($cur{
  1427.                     $cur $cur['package''#' $cur['class'];
  1428.                     continue;
  1429.                 else {
  1430.                     $cur array_pop($lastcur);
  1431.                     $cur array_pop($lastcur)// will fall into infinite loop if this second array_pop() is removed
  1432.                     $my_tree .= '</ul></li>'."\n";
  1433.                 }
  1434.             else {
  1435.                 $my_tree .= '</li>';
  1436.                 $cur array_pop($lastcur);
  1437.             }
  1438.         while ($cur);
  1439.         if ($dopar{
  1440.             $my_tree .= '</ul></li>'."\n";
  1441.         }
  1442.         return $my_tree;
  1443.     }
  1444.  
  1445.     /**
  1446.      * Generate indexing information for given element
  1447.      *
  1448.      * @param parserElement descendant of parserElement
  1449.      * @see generateElementIndex()
  1450.      * @return array 
  1451.      */
  1452.     function getIndexInformation($elt)
  1453.     {
  1454.         $Result['type'$elt->type;
  1455.         $Result['file_name'$elt->file;
  1456.         $Result['path'$elt->getPath();
  1457.  
  1458.         if (isset($elt->docblock))
  1459.                     {
  1460.                         $Result['description'$elt->docblock->getSDesc($this);
  1461.  
  1462.                         if ($elt->docblock->hasaccess)
  1463.                             $Result['access'$elt->docblock->tags['access'][0]->value;
  1464.                         else
  1465.                             $Result['access''public';
  1466.  
  1467.                         $Result['abstract'= isset ($elt->docblock->tags['abstract'][0]);
  1468.                     }
  1469.         else
  1470.             $Result['description''';
  1471.  
  1472.         $aa $Result['description'];
  1473.         if (!empty($aa)) $aa "<br>&nbsp;&nbsp;&nbsp;&nbsp;$aa";
  1474.  
  1475.         switch($elt->type)
  1476.         {
  1477.                 case 'class':
  1478.                         $Result['name'$elt->getName();
  1479.                         $Result['title''Class';
  1480.                         $Result['link'$this->getClassLink($elt->getName(),
  1481.                                                               $elt->docblock->package,
  1482.                                                               $elt->getPath(),
  1483.                                                               $elt->getName());
  1484.                         $Result['listing''in file '.$elt->file.', class '.$Result['link']."$aa";
  1485.                 break;
  1486.                 case 'define':
  1487.                         $Result['name'$elt->getName();
  1488.                         $Result['title''Constant';
  1489.                         $Result['link'$this->getDefineLink($elt->getName(),
  1490.                                                                $elt->docblock->package,
  1491.                                                                $elt->getPath(),
  1492.                                                                $elt->getName());
  1493.                         $Result['listing''in file '.$elt->file.', constant '.$Result['link']."$aa";
  1494.                 break;
  1495.                 case 'global':
  1496.                         $Result['name'$elt->getName();
  1497.                         $Result['title''Global';
  1498.                         $Result['link'$this->getGlobalLink($elt->getName(),
  1499.                                                                $elt->docblock->package,
  1500.                                                                $elt->getPath(),
  1501.                                                                $elt->getName());
  1502.                         $Result['listing''in file '.$elt->file.', global variable '.$Result['link']."$aa";
  1503.                 break;
  1504.                 case 'function':
  1505.                         $Result['name'$elt->getName();
  1506.                         $Result['title''Function';
  1507.                         $Result['link'$this->getFunctionLink($elt->getName(),
  1508.                                                                  $elt->docblock->package,
  1509.                                                                  $elt->getPath(),
  1510.                                                                  $elt->getName().'()');
  1511.                         $Result['listing''in file '.$elt->file.', function '.$Result['link']."$aa";
  1512.                 break;
  1513.                 case 'method':
  1514.                         $Result['name'$elt->getName();
  1515.                         $Result['title''Method';
  1516.                         $Result['link'$this->getMethodLink($elt->getName(),
  1517.                                                                $elt->class,
  1518.                                                                $elt->docblock->package,
  1519.                                                                $elt->getPath(),
  1520.                                                                $elt->class.'::'.$elt->getName().'()'
  1521.                                                                          );
  1522.                                                     if ($elt->isConstructor$Result['constructor'1;
  1523.                         $Result['listing''in file '.$elt->file.', method '.$Result['link']."$aa";
  1524.                 break;
  1525.                 case 'var':
  1526.                         $Result['name'$elt->getName();
  1527.                         $Result['title''Variable';
  1528.                         $Result['link'$this->getVarLink($elt->getName(),
  1529.                                                             $elt->class,
  1530.                                                             $elt->docblock->package,
  1531.                                                             $elt->getPath(),
  1532.                                                             $elt->class.'::'.$elt->getName());
  1533.                         $Result['listing''in file '.$elt->file.', variable '.$Result['link']."$aa";
  1534.                 break;
  1535.                 case 'const':
  1536.                         $Result['name'$elt->getName();
  1537.                         $Result['title''Variable';
  1538.                         $Result['link'$this->getConstLink($elt->getName(),
  1539.                                                             $elt->class,
  1540.                                                             $elt->docblock->package,
  1541.                                                             $elt->getPath(),
  1542.                                                             $elt->class.'::'.$elt->getName());
  1543.                         $Result['listing''in file '.$elt->file.', class constant '.$Result['link']."$aa";
  1544.                 break;
  1545.                 case 'page':
  1546.                         $Result['name'$elt->getFile();
  1547.                         $Result['title''Page';
  1548.                         $Result['link'$this->getPageLink($elt->getFile(),
  1549.                                                              $elt->package,
  1550.                                                              $elt->getPath(),
  1551.                                                              $elt->getFile());
  1552.                         $Result['listing''procedural page '.$Result['link'];
  1553.                 break;
  1554.                 case 'include':
  1555.                         $Result['name'$elt->getName();
  1556.                         $Result['title''Include';
  1557.                         $Result['link'$elt->getValue();
  1558.                         $Result['listing''include '.$Result['name'];
  1559.                 break;
  1560.         }
  1561.  
  1562.         return $Result;
  1563.     }
  1564.  
  1565.     /**
  1566.      * Generate alphabetical index of all elements
  1567.      *
  1568.      * @see $elements, walk()
  1569.      */
  1570.     function generateElementIndex()
  1571.     {
  1572.         $elementindex array();
  1573.         $letters array();
  1574.         $used array();
  1575.         foreach($this->elements as $letter => $nutoh)
  1576.         {
  1577.             foreach($this->elements[$letteras $i => $yuh)
  1578.             {
  1579.                 if ($this->elements[$letter][$i]->type != 'include')
  1580.                 {
  1581.                     if (!isset($used[$letter]))
  1582.                     {
  1583.                         $letters[]['letter'$letter;
  1584.                         $elindex['letter'$letter;
  1585.                         $used[$letter1;
  1586.                     }
  1587.  
  1588.                     $elindex['index'][$this->getIndexInformation($this->elements[$letter][$i]);
  1589.                 }
  1590.             }
  1591.             if (isset($elindex['index']))
  1592.             {
  1593.                 $elementindex[$elindex;
  1594.             else
  1595.             {
  1596.                 unset($letters[count($letters1]);
  1597.             }
  1598.             $elindex array();
  1599.         }
  1600.         return array($elementindex,$letters);
  1601.     }
  1602.  
  1603.     function copyMediaRecursively($media,$targetdir,$subdir '')
  1604.     {
  1605.         $versionControlDirectories array ('CVS''media/CVS''media\\CVS''.svn''media/.svn''media\\.svn');
  1606.         if (!is_array($media)) {
  1607.             return;
  1608.         }
  1609.         foreach($media as $dir => $files)
  1610.         {
  1611.             if ($dir === '/')
  1612.             {
  1613.                 $this->copyMediaRecursively($files,$targetdir);
  1614.             else
  1615.             {
  1616.                 if (!is_numeric($dir))
  1617.                 {
  1618.                     if (in_array($dir$versionControlDirectories))
  1619.                     {
  1620.                         // skip it entirely
  1621.                     }
  1622.                     else
  1623.                     {
  1624.                         // create the subdir
  1625.                         phpDocumentor_out("creating $targetdirPATH_DELIMITER "$dir\n");
  1626.                         Converter::setTargetDir($targetdir PATH_DELIMITER $dir);
  1627.                         if (!empty($subdir))
  1628.                         {
  1629.                             $subdir .= PATH_DELIMITER;
  1630.                         }
  1631.                         $this->copyMediaRecursively($files,"$targetdir/$dir",$subdir $dir);
  1632.                     }
  1633.                 }
  1634.                 else
  1635.                 {
  1636.                     // copy the file
  1637.                     phpDocumentor_out("copying $targetdirPATH_DELIMITER $files['file']."\n");
  1638.                     $this->copyFile($files['file'],$subdir);
  1639.                 }
  1640.             }
  1641.         }
  1642.     }
  1643.  
  1644.     /**
  1645.      * calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
  1646.      * @see Converter::setTargetDir()
  1647.      */
  1648.     function setTargetDir($dir)
  1649.     {
  1650.         Converter::setTargetDir($dir);
  1651.         if ($this->_wrote_tdirreturn;
  1652.         $this->_wrote_tdir true;
  1653.         $template_images array();
  1654.         $stylesheets array();
  1655.         $tdir $dir;
  1656.         $dir $this->templateDir;
  1657.         $this->templateDir $this->templateDir.'templates/';
  1658.         $info new Io;
  1659.         $this->copyMediaRecursively($info->getDirTree($this->templateDir.'media',$this->templateDir),$tdir);
  1660.     }
  1661.  
  1662.     /**
  1663.      * Generate alphabetical index of all elements by package and subpackage
  1664.      *
  1665.      * @param string $package name of a package
  1666.      * @see $pkg_elements, walk(), generatePkgElementIndexes()
  1667.      */
  1668.     function generatePkgElementIndex($package)
  1669.     {
  1670.         $elementindex array();
  1671.         $letters array();
  1672.         $letterind array();
  1673.         $used array();
  1674.         $subp '';
  1675.         foreach($this->pkg_elements[$packageas $subpackage => $els)
  1676.         {
  1677.             if (empty($els)) continue;
  1678.             if (!empty($subpackage)) $subp " (<b>subpackage:</b> $subpackage)"else $subp '';
  1679.             foreach($els as $letter => $yuh)
  1680.             {
  1681.                 foreach($els[$letteras $i => $yuh)
  1682.                 {
  1683.                     if ($els[$letter][$i]->type != 'include')
  1684.                     {
  1685.                         if (!isset($used[$letter]))
  1686.                         {
  1687.                             $letters[]['letter'$letter;
  1688.                             $letterind[$lettercount($letters1;
  1689.                             $used[$letter1;
  1690.                         }
  1691.                         $elindex[$letter]['letter'$letter;
  1692.  
  1693.                         $elindex[$letter]['index'][$this->getIndexInformation($els[$letter][$i]);
  1694.                     }
  1695.                 }
  1696.             }
  1697.         }
  1698.         ksort($elindex);
  1699.         usort($letters,'HTMLSmarty_lettersort');
  1700.         if (isset($elindex))
  1701.         {
  1702.             while(list($letter,$tempeleach($elindex))
  1703.             {
  1704.                 if (!isset($tempel))
  1705.                 {
  1706.                     unset($letters[$letterind[$tempel['letter']]]);
  1707.                 else
  1708.                 $elementindex[$tempel;
  1709.             }
  1710.         else $letters array();
  1711.         return array($elementindex,$letters);
  1712.     }
  1713.  
  1714.     /**
  1715.      *
  1716.      * @see generatePkgElementIndex()
  1717.      */
  1718.     function generatePkgElementIndexes()
  1719.     {
  1720.         $packages array();
  1721.         $package_names array();
  1722.         $pkg array();
  1723.         $letters array();
  1724.         foreach($this->pkg_elements as $package => $trash)
  1725.         {
  1726.             $pkgs['package'$package;
  1727.             $pkg['package'$package;
  1728.             list($pkg['pindex'],$letters[$package]$this->generatePkgElementIndex($package);
  1729.             if (count($pkg['pindex']))
  1730.             {
  1731.                 $packages[$pkg;
  1732.                 $package_names[$pkgs;
  1733.             }
  1734.             unset($pkgs);
  1735.             unset($pkg);
  1736.         }
  1737.         foreach($packages as $i => $package)
  1738.         {
  1739.             $pnames array();
  1740.             for($j=0;$j<count($package_names);$j++)
  1741.             {
  1742.                 if ($package_names[$j]['package'!= $package['package']$pnames[$package_names[$j];
  1743.             }
  1744.             $packages[$i]['packageindexes'$pnames;
  1745.         }
  1746.         return array($packages,$package_names,$letters);
  1747.     }
  1748.  
  1749.     /**
  1750.      * @param string name of class
  1751.      * @param string package name
  1752.      * @param string full path to look in (used in index generation)
  1753.      * @param boolean deprecated
  1754.      * @param boolean return just the URL, or enclose it in an html a tag
  1755.      * @return mixed false if not found, or an html a link to the class's documentation
  1756.      * @see parent::getClassLink()
  1757.      */
  1758.     function getClassLink($expr,$package$file false,$text false$with_a true)
  1759.     {
  1760.         $a Converter::getClassLink($expr,$package,$file);
  1761.         if (!$areturn false;
  1762.         return $this->returnSee($a$text$with_a);
  1763.     }
  1764.  
  1765.     /**
  1766.      * @param string name of function
  1767.      * @param string package name
  1768.      * @param string full path to look in (used in index generation)
  1769.      * @param boolean deprecated
  1770.      * @param boolean return just the URL, or enclose it in an html a tag
  1771.      * @return mixed false if not found, or an html a link to the function's documentation
  1772.      * @see parent::getFunctionLink()
  1773.      */
  1774.     function getFunctionLink($expr,$package$file false,$text false)
  1775.     {
  1776.         $a Converter::getFunctionLink($expr,$package,$file);
  1777.         if (!$areturn false;
  1778.         return $this->returnSee($a$text);
  1779.     }
  1780.  
  1781.     /**
  1782.      * @param string name of define
  1783.      * @param string package name
  1784.      * @param string full path to look in (used in index generation)
  1785.      * @param boolean deprecated
  1786.      * @param boolean return just the URL, or enclose it in an html a tag
  1787.      * @return mixed false if not found, or an html a link to the define's documentation
  1788.      * @see parent::getDefineLink()
  1789.      */
  1790.     function getDefineLink($expr,$package$file false,$text false)
  1791.     {
  1792.         $a Converter::getDefineLink($expr,$package,$file);
  1793.         if (!$areturn false;
  1794.         return $this->returnSee($a$text);
  1795.     }
  1796.  
  1797.     /**
  1798.      * @param string name of global variable
  1799.      * @param string package name
  1800.      * @param string full path to look in (used in index generation)
  1801.      * @param boolean deprecated
  1802.      * @param boolean return just the URL, or enclose it in an html a tag
  1803.      * @return mixed false if not found, or an html a link to the global variable's documentation
  1804.      * @see parent::getGlobalLink()
  1805.      */
  1806.     function getGlobalLink($expr,$package$file false,$text false)
  1807.     {
  1808.         $a Converter::getGlobalLink($expr,$package,$file);
  1809.         if (!$areturn false;
  1810.         return $this->returnSee($a$text);
  1811.     }
  1812.  
  1813.     /**
  1814.      * @param string name of procedural page
  1815.      * @param string package name
  1816.      * @param string full path to look in (used in index generation)
  1817.      * @param boolean deprecated
  1818.      * @param boolean return just the URL, or enclose it in an html a tag
  1819.      * @return mixed false if not found, or an html a link to the procedural page's documentation
  1820.      * @see parent::getPageLink()
  1821.      */
  1822.     function getPageLink($expr,$package$path false,$text false)
  1823.     {
  1824.         $a Converter::getPageLink($expr,$package,$path);
  1825.         if (!$areturn false;
  1826.         return $this->returnSee($a$text);
  1827.     }
  1828.  
  1829.     /**
  1830.      * @param string name of method
  1831.      * @param string class containing method
  1832.      * @param string package name
  1833.      * @param string full path to look in (used in index generation)
  1834.      * @param boolean deprecated
  1835.      * @param boolean return just the URL, or enclose it in an html a tag
  1836.      * @return mixed false if not found, or an html a link to the method's documentation
  1837.      * @see parent::getMethodLink()
  1838.      */
  1839.     function getMethodLink($expr,$class,$package$file false,$text false)
  1840.     {
  1841.         $a Converter::getMethodLink($expr,$class,$package,$file);
  1842.         if (!$areturn false;
  1843.         return $this->returnSee($a$text);
  1844.     }
  1845.  
  1846.     /**
  1847.      * @param string name of var
  1848.      * @param string class containing var
  1849.      * @param string package name
  1850.      * @param string full path to look in (used in index generation)
  1851.      * @param boolean deprecated
  1852.      * @param boolean return just the URL, or enclose it in an html a tag
  1853.      * @return mixed false if not found, or an html a link to the var's documentation
  1854.      * @see parent::getVarLink()
  1855.      */
  1856.     function getVarLink($expr,$class,$package$file false,$text false)
  1857.     {
  1858.         $a Converter::getVarLink($expr,$class,$package,$file);
  1859.         if (!$areturn false;
  1860.         return $this->returnSee($a$text);
  1861.     }
  1862.  
  1863.     /**
  1864.      * @param string name of class constant
  1865.      * @param string class containing class constant
  1866.      * @param string package name
  1867.      * @param string full path to look in (used in index generation)
  1868.      * @param boolean deprecated
  1869.      * @param boolean return just the URL, or enclose it in an html a tag
  1870.      * @return mixed false if not found, or an html a link to the var's documentation
  1871.      * @see parent::getVarLink()
  1872.      */
  1873.     function getConstLink($expr,$class,$package$file false,$text false)
  1874.     {
  1875.         $a Converter::getConstLink($expr,$class,$package,$file);
  1876.         if (!$areturn false;
  1877.         return $this->returnSee($a$text);
  1878.     }
  1879.  
  1880.     /**
  1881.      * does a nat case sort on the specified second level value of the array
  1882.      *
  1883.      * @param    mixed    $a 
  1884.      * @param    mixed    $b 
  1885.      * @return    int 
  1886.      */
  1887.     function rcNatCmp ($a$b)
  1888.     {
  1889.         $aa strtoupper($a[$this->rcnatcmpkey]);
  1890.         $bb strtoupper($b[$this->rcnatcmpkey]);
  1891.  
  1892.         return strnatcasecmp($aa$bb);
  1893.     }
  1894.  
  1895.     /**
  1896.      * does a nat case sort on the specified second level value of the array.
  1897.      * this one puts constructors first
  1898.      *
  1899.      * @param    mixed    $a 
  1900.      * @param    mixed    $b 
  1901.      * @return    int 
  1902.      */
  1903.     function rcNatCmp1 ($a$b)
  1904.     {
  1905.         $aa strtoupper($a[$this->rcnatcmpkey]);
  1906.         $bb strtoupper($b[$this->rcnatcmpkey]);
  1907.  
  1908.         if (strpos($aa,'CONSTRUCTOR'=== 0)
  1909.         {
  1910.             return -1;
  1911.         }
  1912.         if (strpos($bb,'CONSTRUCTOR'=== 0)
  1913.         {
  1914.             return 1;
  1915.         }
  1916.         if (strpos($aa,strtoupper($this->class)) === 0)
  1917.         {
  1918.             return -1;
  1919.         }
  1920.         if (strpos($bb,strtoupper($this->class)) === 0)
  1921.         {
  1922.             return -1;
  1923.         }
  1924.         return strnatcasecmp($aa$bb);
  1925.     }
  1926.  
  1927.     /**
  1928.      * This function is not used by HTMLdefaultConverter, but is required by Converter
  1929.      */
  1930.     function Output()
  1931.     {
  1932.     }
  1933. }
  1934.  
  1935. /**
  1936.  * @access private
  1937.  * @global string name of the package to set as the first package
  1938.  */
  1939. function HTMLSmarty_pindexcmp($a$b)
  1940. {
  1941.     global $phpDocumentor_DefaultPackageName;
  1942.     if ($a['title'== $phpDocumentor_DefaultPackageNamereturn -1;
  1943.     if ($b['title'== $phpDocumentor_DefaultPackageNamereturn 1;
  1944.     return strnatcasecmp($a['title'],$b['title']);
  1945. }
  1946.  
  1947. /** @access private */
  1948. function HTMLSmarty_lettersort($a$b)
  1949. {
  1950.     return strnatcasecmp($a['letter'],$b['letter']);
  1951. }
  1952.  
  1953. /** @access private */
  1954. function HTMLSmarty_outputfilter($src&$smarty)
  1955. {
  1956.     return str_replace('../',$smarty->_tpl_vars['subdir'],$src);
  1957. }
  1958. ?>

Documentation generated on Mon, 05 Dec 2011 21:44:41 -0600 by phpDocumentor 1.4.4