Source for file HTMLframesConverter.inc

Documentation is available at HTMLframesConverter.inc

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

Documentation generated on Mon, 05 Dec 2011 21:33:03 -0600 by phpDocumentor 1.4.4