phpDocumentor Converters
XMLDocBook
[ class tree: Converters ] [ index: Converters ] [ all elements ]

Source for file XMLDocBookConverter.inc

Documentation is available at XMLDocBookConverter.inc

  1. <?php
  2. //
  3. // +------------------------------------------------------------------------+
  4. // | phpDocumentor                                                          |
  5. // +------------------------------------------------------------------------+
  6. // | Copyright (c) 2000-2003 Joshua Eichorn, Gregory Beaver                 |
  7. // | Email         [email protected][email protected]                   |
  8. // | Web           http://www.phpdoc.org                                    |
  9. // | Mirror        http://phpdocu.sourceforge.net/                          |
  10. // | PEAR          http://pear.php.net/package-info.php?pacid=137           |
  11. // +------------------------------------------------------------------------+
  12. // | This source file is subject to version 3.00 of the PHP License,        |
  13. // | that is available at http://www.php.net/license/3_0.txt.               |
  14. // | If you did not receive a copy of the PHP license and are unable to     |
  15. // | obtain it through the world-wide-web, please send a note to            |
  16. // | [email protected] so we can mail you a copy immediately.                 |
  17. // +------------------------------------------------------------------------+
  18. //
  19. /**
  20.  * XML output converter for DocBook.
  21.  * This Converter takes output from the {@link Parser} and converts it to DocBook output
  22.  *
  23.  * @package Converters
  24.  * @subpackage XMLDocBook
  25.  * @see parserDocBlock, parserInclude, parserPage, parserClass, parserDefine, parserFunction, parserMethod, parserVar
  26.  * @author Greg Beaver <[email protected]>
  27.  * @since 1.0
  28.  * @version $Id: XMLDocBookConverter.inc,v 1.1 2005/10/17 18:37:36 jeichorn Exp $
  29.  */
  30. /**
  31.  * XML DocBook converter.
  32.  * This Converter takes output from the {@link Parser} and converts it to DocBook output
  33.  *
  34.  * @package Converters
  35.  * @subpackage XMLDocBook
  36.  * @see parserDocBlock, parserInclude, parserPage, parserClass, parserDefine, parserFunction, parserMethod, parserVar
  37.  * @author Greg Beaver <[email protected]>
  38.  * @since 1.0
  39.  * @version $Id: XMLDocBookConverter.inc,v 1.1 2005/10/17 18:37:36 jeichorn Exp $
  40.  * @todo indexes for other DocBook converters not based on peardoc
  41.  * @todo templates
  42.  */
  43. {
  44.     /**
  45.      * XMLDocBookConverter wants elements sorted by type as well as alphabetically
  46.      * @see Converter::$sort_page_contents_by_type
  47.      * @var boolean 
  48.      */
  49.     var $sort_page_contents_by_type = true;
  50.     /** @var string */
  51.     var $outputformat = 'XML';
  52.     /** @var string */
  53.     var $name = 'DocBook';
  54.     /**
  55.      * indexes of elements by package that need to be generated
  56.      * @var array 
  57.      */
  58.     var $leftindex = array('classes' => true'pages' => true'functions' => false'defines' => false'globals' => false);
  59.     /**
  60.      * whether a @see is going to be in the {@link $base_dir}, or in a package/subpackage subdirectory of $base_dir
  61.      * @var boolean 
  62.      */
  63.     var $local = true;
  64.     
  65.     /**
  66.      * name of current page being converted
  67.      * @var string 
  68.      */
  69.     var $page;
  70.     
  71.     /**
  72.      * path of current page being converted
  73.      * @var string 
  74.      */
  75.     var $path;
  76.     
  77.     /**
  78.      * name of current class being converted
  79.      * @var string 
  80.      */
  81.     var $class;
  82.     
  83.     /**
  84.      * template for the procedural page currently being processed
  85.      * @var Template 
  86.      */
  87.     var $page_data;
  88.     
  89.     /**
  90.      * output directory for the current procedural page being processed
  91.      * @var string 
  92.      */
  93.     var $page_dir;
  94.     
  95.     /**
  96.      * target directory passed on the command-line.
  97.      * {@link $targetDir} is malleable, always adding package/ and package/subpackage/ subdirectories onto it.
  98.      * @var string 
  99.      */
  100.     var $base_dir;
  101.     
  102.     /**
  103.      * output directory for the current class being processed
  104.      * @var string 
  105.      */
  106.     var $class_dir;
  107.     
  108.     /**
  109.      * template for the class currently being processed
  110.      * @var Template 
  111.      */
  112.     var $class_data;
  113.     
  114.     /**
  115.      * array of converted package page names.
  116.      * Used to link to the package page in the left index
  117.      * @var array Format: array(package => 1)
  118.      */
  119.     var $package_pages = array();
  120.     
  121.     /**
  122.      * controls formatting of parser informative output
  123.      * 
  124.      * Converter prints:
  125.      * "Converting /path/to/file.php... Procedural Page Elements... Classes..."
  126.      * Since HTMLdefaultConverter outputs files while converting, it needs to send a \n to start a new line.  However, if there
  127.      * is more than one class, output is messy, with multiple \n's just between class file output.  This variable prevents that
  128.      * and is purely cosmetic
  129.      * @var boolean 
  130.      */
  131.     var $juststarted = false;
  132.     
  133.     /**
  134.      * contains all of the template procedural page element loop data needed for the current template
  135.      * @var array 
  136.      */
  137.     var $current;
  138.     
  139.     /**
  140.      * contains all of the template class element loop data needed for the current template
  141.      * @var array 
  142.      */
  143.     var $currentclass;
  144.     /**
  145.      * template options.  Currently only 1 recognized option usepear
  146.      *
  147.      * usepear tells the getLink() function to return a package link to PEAR and PEAR_ERROR if possible, and to link directly
  148.      * to the fully-delimited link package#class.method or package#file.method in PEAR style, if possible, even if the
  149.      * package is not parsed.  This will allow parsing of separate PEAR packages without parsing the entire thing at once!
  150.      * @var array 
  151.      */
  152.     var $template_options = array('usepear' => false);
  153.     
  154.     var $function_data = array();
  155.     var $method_data = array();
  156.     var $sourceloc = '';
  157.     /**
  158.      * peardoc2 Category
  159.      * @var string 
  160.      */
  161.     var $category;
  162.     /**
  163.      * sets {@link $base_dir} to $targetDir
  164.      * @see Converter()
  165.      */
  166.     function XMLDocBookConverter(&$allp&$packp&$classes&$procpages$po$pp$qm$targetDir$templateDir$title)
  167.     {
  168.         die("XMLDocBookConverter is not supported in this development version.  Use XML:DocBook/peardoc2:default");
  169.     }
  170.     
  171.     /**
  172.      * do that stuff in $template_options
  173.      */
  174.     function &getLink($expr$package false$packages false)
  175.     {
  176.         return Converter::getLink($expr$package$packages);
  177.     }
  178.     
  179.     function unmangle($s,$sourcecode)
  180.     {
  181.         return '<programlisting role="php"><![CDATA[
  182. '.$sourcecode.']]></programlisting>';
  183.     }
  184.     
  185.     function type_adjust($typename)
  186.     {
  187.         if (isset($this->template_options['typechanging'][trim($typename)]))
  188.         return $this->template_options['typechanging'][trim($typename)];
  189.         $a $this->getLink($typename);
  190.         if (is_object($a))
  191.         {
  192.             if (phpDocumentor_get_class($a== 'classlink')
  193.             return '<classname>'.$typename.'</classname>';
  194.             if (phpDocumentor_get_class($a== 'functionlink' || phpDocumentor_get_class($a== 'methodlink')
  195.             return '<function>'.$typename.'</function>';
  196.             if (phpDocumentor_get_class($a== 'definelink')
  197.             return '<constant>'.$typename.'</constant>';
  198.             if (phpDocumentor_get_class($a== 'varlink')
  199.             return '<varname>'.$typename.'</varname>';
  200.         }
  201.         return $typename;
  202.     }
  203.     
  204.     function &SmartyInit(&$templ)
  205.     {
  206.         $this->makeLeft();
  207.         $templ->assign("packageindex",$this->package_index);
  208.         return $templ;
  209.     }
  210.     
  211.     /**
  212.      * Writes out the template file of {@link $class_data} and unsets the template to save memory
  213.      * @see registerCurrentClass()
  214.      * @see parent::endClass()
  215.      */
  216.     function endClass()
  217.     {
  218.         $a '../';
  219.         if (!empty($this->subpackage)) $a .= '../';
  220.         if ($this->juststarted)
  221.         {
  222.             $this->juststarted = false;
  223.             phpDocumentor_out("\n");
  224.             flush();
  225.         }
  226.         foreach($this->method_data as $func)
  227.         {
  228.             $func[0]->assign("phpdocversion",PHPDOCUMENTOR_VER);
  229.             $func[0]->assign("phpdocwebsite",PHPDOCUMENTOR_WEBSITE);
  230.             $this->setTargetDir($this->base_dir . PATH_DELIMITER strtolower($this->class_dir . PATH_DELIMITER str_replace(array('_','.'),array('-','--'),$this->class)));
  231.             $this->writefile(strtolower($func[1)'.xml',$func[0]->fetch('method.tpl'));
  232.         }
  233.         if (isset($this->template_options['separatepage']&& $this->template_options['separatepage'])
  234.         {
  235.             $this->setTargetDir($this->base_dir . PATH_DELIMITER strtolower($this->class_dirPATH_DELIMITER str_replace(array('_','.'),array('-','--'),strtolower($this->class)));
  236.             $this->writefile(str_replace(array('_','.'),array('-','--'),strtolower($this->class)).'-summary.xml',$this->class_summary->fetch('class_summary.tpl'));
  237.         }
  238.         $this->setTargetDir($this->base_dir . PATH_DELIMITER strtolower($this->class_dir));
  239.         $this->writefile(str_replace(array('_','.'),array('-','--'),strtolower($this->class)) '.xml',$this->class_data->fetch('class.tpl'));
  240.         unset($this->class_data);
  241.     }
  242.     
  243.     /**
  244.      * Writes out the template file of {@link $page_data} and unsets the template to save memory
  245.      * @see registerCurrent()
  246.      * @see parent::endPage()
  247.      */
  248.     function endPage()
  249.     {
  250.         $this->package = $this->curpage->package;
  251.         $this->subpackage = $this->curpage->subpackage;
  252.         $a '../';
  253.         if (!empty($this->subpackage)) $a .= '../';
  254.         foreach($this->function_data as $func)
  255.         {
  256.             $func[0]->assign("phpdocversion",PHPDOCUMENTOR_VER);
  257.             $func[0]->assign("phpdocwebsite",PHPDOCUMENTOR_WEBSITE);
  258.             $this->setTargetDir($this->base_dir . PATH_DELIMITER strtolower($this->page_dir . PATH_DELIMITER $this->page));
  259.             $this->writefile(str_replace('_','-',strtolower($func[1])) '.xml',$func[0]->fetch('function.tpl'));
  260.         }
  261.         if (isset($this->template_options['separatepage']&& $this->template_options['separatepage'])
  262.         {
  263.             $this->setTargetDir($this->base_dir . PATH_DELIMITER strtolower($this->page_dir . PATH_DELIMITER $this->page));
  264.             $this->writefile(strtolower($this->page).'-summary.xml',$this->page_summary->fetch('page_summary.tpl'));
  265.         }
  266.         $this->setTargetDir($this->base_dir . PATH_DELIMITER strtolower($this->page_dir));
  267.         $this->writefile(strtolower($this->page'.xml',$this->page_data->fetch('page.tpl'));
  268.         unset($this->page_data);
  269.     }
  270.     
  271.     /**
  272.      * @param string 
  273.      * @param string 
  274.      * @return string &lt;ulink url="'.$link.'">'.$text.'</ulink&gt;
  275.      */
  276.     function returnLink($link,$text)
  277.     {
  278.         return '<ulink url="'.$link.'">'.$text.'</ulink>';
  279.     }
  280.     
  281.     function makeLeft()
  282.     {
  283.         static $done false;
  284.         if ($donereturn;
  285.         $done true;
  286.         if (!isset($this->package_index))
  287.         foreach($this->all_packages as $key => $val)
  288.         {
  289.             if (isset($this->pkg_elements[$key]))
  290.             {
  291.                 if (!isset($start)) $start $key;
  292.                 $this->package_index[array('link' => "li_$key.html"'title' => $key);
  293.             }
  294.         }
  295.         foreach($this->page_elements as $package => $o1)
  296.         {
  297.             foreach($o1 as $subpackage => $links)
  298.             {
  299.                 for($i=0;$i<count($links);$i++)
  300.                 {
  301.                     $this->left[$package][$subpackage][=
  302.                         array("link" => $this->returnSee($links[$i]falsefalsefalse)"title" => $links[$i]->name);
  303.                 }
  304.             }
  305.         }
  306.         foreach($this->class_elements as $package => $o1)
  307.         {
  308.             foreach($o1 as $subpackage => $links)
  309.             {
  310.                 for($i=0;$i<count($links);$i++)
  311.                 {
  312.                     $this->left['#class'][$package][$subpackage][=
  313.                         array("link" => $this->returnSee($links[$i]falsefalsefalse)"title" => $links[$i]->name);
  314.                 }
  315.             }
  316.         }
  317.     }
  318.     
  319.     /**
  320.      * HTMLdefaultConverter chooses to format both package indexes and the complete index here
  321.      *
  322.      * This function formats output for the elementindex.html and pkgelementindex.html template files.  It then
  323.      * writes them to the target directory
  324.      * @see generateElementIndex(), generatePkgElementIndex()
  325.      */
  326.     function formatPkgIndex()
  327.     {
  328.         // will implement in next release with other templates than peardoc2
  329.         return;
  330.         list($package_indexes,$packages,$mletters$this->generatePkgElementIndexes();
  331.         for($i=0;$i<count($package_indexes);$i++)
  332.         {
  333.             $template &$this->newSmarty();
  334.             $this->package = $package_indexes[$i]['package'];
  335.             $this->subpackage = '';
  336.             $template->assign("compiledclassindex",$this->getClassLeft());
  337.             $template->assign("compiledfileindex",$this->getPageLeft());
  338.             $template->assign("index",$package_indexes[$i]['pindex']);
  339.             $template->assign("package",$package_indexes[$i]['package']);
  340.             $template->assign("letters",$mletters[$package_indexes[$i]['package']]);
  341.             $template->assign("title","Package ".$package_indexes[$i]['package']." Element Index");
  342.             $template->assign("date",date("r",time()));
  343. //            $this->writefile('elementindex_'.$package_indexes[$i]['package'].'.html',$template->fetch('pkgelementindex.tpl'));
  344.         }
  345.         phpDocumentor_out("\n");
  346.         flush();
  347.     }
  348.     
  349.     /**
  350.      * HTMLdefaultConverter uses this function to format template index.html and packages.html
  351.      *
  352.      * This function generates the package list from {@link $all_packages}, eliminating any
  353.      * packages that don't have any entries in their package index (no files at all, due to @ignore
  354.      * or other factors).  Then it uses the default package name as the first package index to display.
  355.      * It sets the right pane to be either a blank file with instructions on making package-level docs,
  356.      * or the package-level docs for the default package.
  357.      * @global string Used to set the starting package to display
  358.      */
  359.     function formatIndex()
  360.     {
  361.         // will implement in next release with other templates than peardoc2
  362.         return;
  363.         global $phpDocumentor_DefaultPackageName;
  364.         list($elindex,$mletters$this->generateElementIndex();
  365.         $template &$this->newSmarty();
  366.         $template->assign("index",$elindex);
  367.         $template->assign("letters",$mletters);
  368.         $template->assign("title","Element Index");
  369.         $template->assign("date",date("r",time()));
  370.         phpDocumentor_out("\n");
  371.         flush();
  372.         $this->setTargetDir($this->base_dir);
  373. //        $this->writefile('elementindex.html',$template->fetch('elementindex.tpl'));
  374.         uksort($this->package_index,"strnatcasecmp");
  375.         $index &$this->newSmarty();
  376.         foreach($this->all_packages as $key => $val)
  377.         {
  378.             if (isset($this->pkg_elements[$key]))
  379.             {
  380.                 if (!isset($start)) $start $key;
  381.                 if (!isset($this->package_pages[$key])) $this->writeNewPPage($key);
  382.             }
  383.         }
  384.         // Created index.html
  385.         if (isset($this->package_index[$phpDocumentor_DefaultPackageName])) $start $phpDocumentor_DefaultPackageName;
  386.         $this->package = $start;
  387.         $this->subpackage = '';
  388.         $index->assign("compiledclassindex",$this->getClassLeft());
  389.         $index->assign("compiledfileindex",$this->getPageLeft());
  390.         $index->assign("date",date("r",time()));
  391.         $index->assign("title",$this->title);
  392.         $index->assign("start","li_$start.html");
  393.         if (isset($this->package_pages[$start]))
  394.         {
  395.             $index->assign("contents",$this->package_pages[$start]);
  396.         }
  397.         phpDocumentor_out("\n");
  398.         flush();
  399.         $this->setTargetDir($this->base_dir);
  400. //        $this->writefile("index.html",$index->fetch('index.tpl'));
  401.         unset($index);
  402.  
  403.     }
  404.     
  405.     function writeNewPPage($key)
  406.     {
  407.         // will implement in next release with other templates than peardoc2
  408.         return;
  409.         $template &$this->newSmarty();
  410.         $this->package = $key;
  411.         $this->subpackage = '';
  412.         $template->assign("compiledclassindex",$this->getClassLeft());
  413.         $template->assign("compiledfileindex",$this->getPageLeft());
  414.         $template->assign("date",date("r",time()));
  415.         $template->assign("title",$this->title);
  416.         $template->assign("package",$key);
  417.         phpDocumentor_out("\n");
  418.         flush();
  419.         $this->setTargetDir($this->base_dir);
  420. //        $this->writefile("li_$key.html",$template->fetch('index.tpl'));
  421.         unset($template);
  422.     }
  423.     
  424.     /**
  425.      * Generate indexes for li_package.html and classtree output files
  426.      *
  427.      * This function generates the li_package.html files from the template file left.html.  It does this by
  428.      * iterating through each of the $page_elements, $class_elements and  $function_elements arrays to retrieve
  429.      * the pre-sorted {@link abstractLink} descendants needed for index generation.  Conversion of these links to
  430.      * text is done by {@link returnSee()}.  The {@link $local} parameter is set to false to ensure that paths are correct.
  431.      * 
  432.      * Then it uses {@link generateFormattedClassTrees()} to create class trees from the template file classtrees.html.  Output
  433.      * filename is classtrees_packagename.html.  This function also unsets {@link $elements} and {@link $pkg_elements} to free
  434.      * up the considerable memory these two class vars use
  435.      * @see $page_elements, $class_elements, $function_elements
  436.      */
  437.     function formatLeftIndex()
  438.     {
  439.         // will implement in next release with other templates than peardoc2
  440.         return;
  441.         phpDocumentor_out("\n");
  442.         flush();
  443.         $this->setTargetDir($this->base_dir);
  444.         if (!isset($this->left))
  445.         {
  446.             debug("Nothing parsed, check the command-line");
  447.             die();
  448.         }
  449.         foreach($this->all_packages as $package => $rest)
  450.         {
  451.             if (!isset($this->pkg_elements[$package])) continue;
  452.             // Create class tree page
  453.             $template &$this->newSmarty();
  454.             $template->assign("classtrees",$this->generateFormattedClassTrees($package));
  455.             $template->assign("package",$package);
  456.             $template->assign("date",date("r",time()));
  457.             $template->assign("title","Class Trees for Package $package");
  458. //            $this->writefile("classtrees_$package.html",$template->fetch('classtrees.tpl'));
  459.             phpDocumentor_out("\n");
  460.             flush();
  461.         }
  462.         // free up considerable memory
  463.         unset($this->elements);
  464.         unset($this->pkg_elements);
  465.     }
  466.     
  467.     /**
  468.      * This function takes an {@link abstractLink} descendant and returns an html link
  469.      *
  470.      * @param abstractLink a descendant of abstractlink should be passed, and never text
  471.      * @param string text to display in the link
  472.      * @param boolean this parameter is not used, and is deprecated
  473.      * @param boolean determines whether the returned text is enclosed in an &lt;a> tag
  474.      */
  475.     function returnSee(&$element$eltext false$local true$with_a true)
  476.     {
  477.         if (!$elementreturn false;
  478.         if (!$eltext)
  479.         {
  480.             $eltext '';
  481.             switch($element->type)
  482.             {
  483.                 case 'tutorial' :
  484.                 $eltext $element->title;
  485.                 break;
  486.                 case 'class' :
  487.                 $eltext '<classname>'.$element->name.'</classname>';
  488.                 break;
  489.                 case 'method' :
  490.                 $eltext .= '<function>';
  491.                 case 'var' :
  492.                 if ($element->type == 'var'$eltext .= '<varname>';
  493.                 $eltext .= $element->class.'::';
  494.                 case 'page' :
  495.                 case 'define' :
  496.                 if ($element->type == 'define')
  497.                 $eltext .= '<constant>';
  498.                 case 'function' :
  499.                 if ($element->type == 'function')
  500.                 $eltext .= '<function>';
  501.                 case 'global' :
  502.                 default :
  503.                 $eltext .= $element->name;
  504.                 if ($element->type == 'function' || $element->type == 'method'$eltext .= '()</function>';
  505.                 if ($element->type == 'var'$eltext .= '</varname>';
  506.                 if ($element->type == 'define'$eltext .= '</constant>';
  507.                 break;
  508.             }
  509.         }
  510.         $a '';
  511.         if (!empty($element->subpackage))
  512.         {
  513.             $a $element->subpackage.'.';
  514.         }
  515.         switch ($element->type)
  516.         {
  517.             case 'page' :
  518.             if ($with_a)
  519.             return '<link linkend="package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'">'.$eltext.'</link>';
  520.             else
  521.             return 'package.'.strtolower($element->package.'.'.$a).$element->fileAlias;
  522.             break;
  523.             case 'define' :
  524.             if ($with_a)
  525.             return '<link linkend="package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'.'.urlencode($element->name).'">'.$eltext.'</link>';
  526.             else
  527.             return 'package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'.'.urlencode($element->name);
  528.             break;
  529.             case 'global' :
  530.             if ($with_a)
  531.             return '<link linkend="package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'.'.urlencode($element->name).'">'.$eltext.'</link>';
  532.             else
  533.             return 'package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'.'.urlencode($element->name);
  534.             break;
  535.             case 'class' :
  536.             if ($with_a)
  537.             return '<link linkend="package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name)).'">'.$eltext.'</link>';
  538.             else
  539.             return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name));
  540.             break;
  541.             case 'function' :
  542.             if ($with_a)
  543.             return '<link linkend="package.'.strtolower($element->package.'.'.$a.$element->fileAlias.'.'.str_replace('_','-',$element->name)).'">'.$eltext.'</link>';
  544.             else
  545.             return 'package.'.strtolower($element->package.'.'.$a.$element->fileAlias.'.'.str_replace('_','-',$element->name));
  546.             break;
  547.             case 'method' :
  548.             if ($with_a)
  549.             return '<link linkend="package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.str_replace('_','-',$element->name)).'">'.$eltext.'</link>';
  550.             else
  551.             return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.str_replace('_','-',$element->name));
  552.             break;
  553.             case 'var' :
  554.             if ($with_a)
  555.             return '<link linkend="package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.$element->name).'">'.$eltext.'</link>';
  556.             else
  557.             return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.$element->name);
  558.             break;
  559.             case 'tutorial' :
  560.             if ($with_a)
  561.             return '<link linked="package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name).'-tutorial">'.$eltext).'</link>';
  562.             else
  563.             return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name)).'-tutorial';
  564.         }
  565.     }
  566.     
  567.     /**
  568.      * Get the id value needed to allow linking
  569.      * @param mixed descendant of parserElement or parserData/parserPage
  570.      * @see parserElement, parserData, parserPage
  571.      * @return string the id value for this element type
  572.      */
  573.     function getId(&$el)
  574.     {
  575.         if (phpDocumentor_get_class($el== 'parserdata')
  576.         {
  577.             $element $this->addLink($el->parent);
  578.             $elp $el->parent;
  579.         else
  580.         {
  581.             $elp $el;
  582.             $element $this->addLink($el);
  583.         }
  584.         $a '';
  585.         if (!empty($element->subpackage))
  586.         {
  587.             $a $element->subpackage.'.';
  588.         }
  589.         switch ($element->type)
  590.         {
  591.             case 'page' :
  592.             return 'package.'.strtolower($element->package.'.'.$a.$element->fileAlias);
  593.             break;
  594.             case 'define' :
  595.             return 'package.'.$element->package.'.'.strtolower($a.$element->fileAlias.'.'.str_replace(array('$','_','"',"'"),array('var--','-','-','-'),$element->name));
  596.             break;
  597.             case 'global' :
  598.             return 'package.'.strtolower($element->package.'.'.$a.$element->fileAlias.'.'.str_replace(array('$','_','"',"'"),array('var--','-','-','-'),$element->name));
  599.             break;
  600.             case 'class' :
  601.             return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name));
  602.             break;
  603.             case 'function' :
  604.             return 'package.'.strtolower($element->package.'.'.$a.$element->fileAlias.'.'.str_replace('_','-',$element->name));
  605.             break;
  606.             case 'method' :
  607.             return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.str_replace('_','-',$element->name));
  608.             break;
  609.             case 'var' :
  610.             return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'-summary.vars.'.str_replace(array('$','_'),array('var--','-'),$element->name));
  611.             break;
  612.             case 'tutorial' :
  613.             return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name)).'-tutorial';
  614.             break;
  615.         }
  616.     }
  617.  
  618.     /**
  619.      * Create errors.html template file output
  620.      *
  621.      * This method takes all parsing errors and warnings and spits them out ordered by file and line number.
  622.      * @global ErrorTracker We'll be using it's output facility
  623.      */
  624.     function ConvertErrorLog()
  625.     {
  626.         global $phpDocumentor_errors;
  627.         $allfiles array();
  628.         $files array();
  629.         $warnings $phpDocumentor_errors->returnWarnings();
  630.         $errors $phpDocumentor_errors->returnErrors();
  631.         $template &$this->newSmarty();
  632.         foreach($warnings as $warning)
  633.         {
  634.             $file '##none';
  635.             $linenum 'Warning';
  636.             if ($warning->file)
  637.             {
  638.                 $file $warning->file;
  639.                 $allfiles[$file1;
  640.                 $linenum .= ' on line '.$warning->linenum;
  641.             }
  642.             $files[$file]['warnings'][array('name' => $linenum'listing' => $warning->data);
  643.         }
  644.         foreach($errors as $error)
  645.         {
  646.             $file '##none';
  647.             $linenum 'Error';
  648.             if ($error->file)
  649.             {
  650.                 $file $error->file;
  651.                 $allfiles[$file1;
  652.                 $linenum .= ' on line '.$error->linenum;
  653.             }
  654.             $files[$file]['errors'][array('name' => $linenum'listing' => $error->data);
  655.         }
  656.         $i=1;
  657.         $af array();
  658.         foreach($allfiles as $file => $num)
  659.         {
  660.             $af[$i++$file;
  661.         }
  662.         $allfiles $af;
  663.         usort($allfiles,'strnatcasecmp');
  664.         $allfiles[0"Post-parsing";
  665.         foreach($allfiles as $i => $a)
  666.         {
  667.             $allfiles[$iarray('file' => $a);
  668.         }
  669.         $out array();
  670.         foreach($files as $file => $data)
  671.         {
  672.             if ($file == '##none'$file 'Post-parsing';
  673.             $out[$file$data;
  674.         }
  675.         $template->assign("files",$allfiles);
  676.         $template->assign("all",$out);
  677.         $template->assign("title","phpDocumentor Parser Errors and Warnings");
  678.         $this->setTargetDir($this->base_dir);
  679.         $this->writefile("errors.html",$template->fetch('errors.tpl'));
  680.         unset($template);
  681.         phpDocumentor_out("\n\nTo view errors and warnings, look at ".$this->base_dirPATH_DELIMITER "errors.html\n");
  682.         flush();
  683.     }
  684.     
  685.     function postProcess($text)
  686.     {
  687.         return htmlentities($text);
  688.     }
  689.  
  690.     function prepareDocBlock(&$element$nopackage true)
  691.     {
  692.         return parent::prepareDocBlock($elementarray('staticvar' => 'staticvar','deprec' => 'deprecated','abstract' => 'abstract','TODO' => 'todo''uses' => 'see''usedby' => 'see''tutorial' => 'see')$nopackage);
  693.     }
  694.     
  695.     function getTutorialId($package,$subpackage,$tutorial,$id)
  696.     {
  697.         $subpackage (empty($subpackage'' '.'.$subpackage);
  698.         $id (empty($id'' '.'.$id);
  699.         return 'package.'.strtolower($package.$subpackage.str_replace(array('_','.'),array('-','--'),$tutorial).$id);
  700.     }
  701.     
  702.     function getCData($value)
  703.     {
  704.         return '<!CDATA['.$value.']]>';
  705.     }
  706.     
  707.     /**
  708.      * Converts package page and sets its package as used in {@link $package_pages}
  709.      * @param parserPackagePage 
  710.      */
  711.     function convertPackagePage(&$element)
  712.     {
  713.         return;
  714.         phpDocumentor_out("\n");
  715.         flush();
  716.         $template &$this->newSmarty();
  717.         $this->package = $element->package;
  718.         $this->subpackage = '';
  719.         $template->assign("compiledclassindex",$this->getClassLeft());
  720.         $template->assign("compiledfileindex",$this->getPageLeft());
  721.         $template->assign("date",date("r",time()));
  722.         $template->assign("title",$this->title);
  723.         $template->assign("package",$element->package);
  724.         $x $element->Convert($this);
  725.         $x substr($x,strpos($x,'<body'));
  726.         $template->assign("contents",trim(substr($x,strpos($x,'>'1)));
  727.         phpDocumentor_out("\n");
  728.         flush();
  729.         $this->setTargetDir($this->base_dir);
  730. //        $this->writefile("li_".$element->package.".html",$template->fetch('index.tpl'));
  731.         unset($template);
  732.         $this->package_pages[$element->packagetrim(substr($x,strpos($x,'>'1));
  733.     }
  734.     
  735.     function convertTutorial(&$element)
  736.     {
  737.         $template &parent::convertTutorial($element);
  738.         phpDocumentor_out("\n");
  739.         flush();
  740.         $x $element->Convert($this,false);
  741.         if ($element->ini)
  742.         // add child tutorial list to the tutorial through a slight hack :)
  743.             $subtutorials '';
  744.             $b '';
  745.             if (!empty($element->subpackage)) $b '.'.$element->subpackage;
  746.             foreach($element->ini['Linked Tutorials'as $child)
  747.             {
  748.                 $subtutorials .= '      &'.$element->package.$b.'.'.str_replace(array('_','.'),array('-','--'),$child).'-'.$element->tutorial_type."-tutorial;\n";
  749.             }
  750.             $x str_replace('</refsect1></refentry>','</refsect1>
  751.     <refsect1>
  752.      <title>Related Docs</title>
  753.      <para>
  754. '.$subtutorials.
  755. '     </para>
  756.     </refsect1></refentry>',$x);
  757.         }
  758.         $template->assign('contents',$x);
  759.         $contents $template->fetch('tutorial.tpl');
  760.         $a '';
  761.         if ($element->subpackage$a PATH_DELIMITER $element->subpackage;
  762.         phpDocumentor_out("\n");
  763.         flush();
  764.         $this->setTargetDir($this->base_dir . PATH_DELIMITER strtolower($element->package $a));
  765.         $this->writeFile(str_replace(array('_','.'),array('-','--'),strtolower($element->name)).'-tutorial.xml',$contents);
  766.     }
  767.     
  768.     /**
  769.      * Converts class variables for template output.
  770.      * @see prepareDocBlock(), getFormattedOverrides()
  771.      * @param parserVar 
  772.      */
  773.     function convertVar(&$element)
  774.     {
  775.         $docblock $this->prepareDocBlock($element);
  776.         $b 'mixed';
  777.         if ($element->docblock->var)
  778.         {
  779.             $b $element->docblock->var->converted_returnType;
  780.         }
  781. //        var_dump($this->getFormattedOverrides($element));
  782.         if (isset($this->template_options['separatepage']&& $this->template_options['separatepage'])
  783.         $this->class_summary->append('vars',array('sdesc' => $docblock['sdesc'],
  784.                                                'desc' => $docblock['desc'],
  785.                                                'tags' => $docblock['tags'],
  786.                                                'var_name' => $this->type_adjust($element->getName()),
  787.                                                'var_default' => htmlspecialchars($element->getValue()),
  788.                                                'var_type' => $b,
  789.                                                'var_overrides' => $this->getFormattedOverrides($element),
  790.                                                'line_number' => $element->getLineNumber(),
  791.                                                'id' => $this->getId($element)));
  792.         else
  793.         $this->class_data->append('vars',array('sdesc' => $docblock['sdesc'],
  794.                                                'desc' => $docblock['desc'],
  795.                                                'tags' => $docblock['tags'],
  796.                                                'var_name' => $this->type_adjust($element->getName()),
  797.                                                'var_default' => htmlspecialchars($element->getValue()),
  798.                                                'var_type' => $b,
  799.                                                'var_overrides' => $this->getFormattedOverrides($element),
  800.                                                'line_number' => $element->getLineNumber(),
  801.                                                'id' => $this->getId($element)));
  802.     }
  803.     
  804.     /**
  805.      * Converts class for template output
  806.      * @see prepareDocBlock(), generateChildClassList(), generateFormattedClassTree(), getFormattedConflicts()
  807.      * @see getFormattedInheritedMethods(), getFormattedInheritedVars()
  808.      * @param parserClass 
  809.      */
  810.     function convertClass(&$element)
  811.     {
  812.         parent::convertClass($element);
  813.         $docblock $this->prepareDocBlock($element);
  814.         $this->class_dir = $element->docblock->package;
  815.         if (!empty($element->docblock->subpackage)) $this->class_dir .= PATH_DELIMITER $element->docblock->subpackage;
  816.         $docblock $this->prepareDocBlock($element,false);
  817.         
  818.         $this->class_data->assign("sdesc",$docblock['sdesc']);
  819.         $this->class_data->assign("desc",$docblock['desc']);
  820.         $this->class_data->assign("tags",$docblock['tags']);
  821.  
  822.         $this->class_data->assign("source_location",$element->getSourceLocation($this,$this->template_options['usepear']));
  823.         $this->class_data->assign("id",$this->getId($element));
  824.         $this->class_data->assign("method_ids",array());
  825.         if ($t $element->getTutorial())
  826.         {
  827.             $this->class_data->append("method_ids",$this->getId($t));
  828.         }
  829.  
  830.         if (isset($this->template_options['separatepage']&& $this->template_options['separatepage'])
  831.         {
  832.             $this->class_summary &$this->newSmarty(true);
  833.             if ($t $element->getTutorial())
  834.             {
  835.                 $this->class_summary->assign("tutorial",$this->returnSee($t));
  836.             }
  837.  
  838.             $this->class_summary->assign("class_name",$this->type_adjust($element->getName()));
  839.             $this->class_summary->assign("sdesc",$docblock['sdesc']);
  840.             $this->class_summary->assign("desc",$docblock['desc']);
  841.             $this->class_summary->assign("tags",$docblock['tags']);
  842.             $this->class_summary->assign("vars",array());
  843.             $this->class_summary->assign("methods",array());
  844.             $this->class_summary->assign("package",$element->docblock->package);
  845.  
  846.             $this->class_summary->assign("children"$this->generateChildClassList($element));
  847.             $this->class_summary->assign("class_tree"$this->generateFormattedClassTree($element));
  848.             $this->class_summary->assign("conflicts"$this->getFormattedConflicts($element,"classes"));
  849.         
  850.             $this->class_summary->assign("source_location",$element->getSourceLocation($this,$this->template_options['usepear']));
  851.             $this->class_summary->assign("id",$this->getId($element).'-summary');
  852.             $this->class_data->append("method_ids",$this->getId($element).'.'.strtolower(str_replace('_','-',$element->getName())).'-summary');
  853.             $inherited_methods $this->getFormattedInheritedMethods($element);
  854.             if (!empty($inherited_methods))
  855.             {
  856.                 $this->class_summary->assign("imethods",$inherited_methods);
  857.             }
  858.             $inherited_vars $this->getFormattedInheritedVars($element);
  859.             if (!empty($inherited_vars))
  860.             {
  861.                 $this->class_summary->assign("ivars",$inherited_vars);
  862.             }
  863.         }
  864.         $this->sourceloc = $element->getSourceLocation($this,$this->template_options['usepear']);
  865.     }
  866.     
  867.     /**
  868.      * Converts method for template output
  869.      * @see prepareDocBlock(), parserMethod::getFunctionCall(), getFormattedDescMethods(), getFormattedOverrides()
  870.      * @param parserMethod 
  871.      */
  872.     function convertMethod(&$element)
  873.     {
  874.         $fname $element->getName();
  875.         if ($element->isConstructor)
  876.         {
  877.             $fname 'constructor '.$element->getName();
  878.         }
  879.         $docblock $this->prepareDocBlock($element);
  880.         $returntype 'void';
  881.         if ($element->docblock->return)
  882.         {
  883.             $a $element->docblock->return->Convert($this);
  884.             $returntype $element->docblock->return->converted_returnType;
  885.             if ($returntype != $element->docblock->return->returnType)
  886.             {
  887.                 $returntype "<replaceable>$returntype</replaceable>";
  888.             }
  889.         }
  890.         $params array();
  891.         if (count($element->docblock->params))
  892.         foreach($element->docblock->params as $param => $val)
  893.         {
  894.             $a $val->Convert($this);
  895.             $params[$paramarray("var" => $param,"datatype" => $val->converted_returnType,"data" => $a);
  896.         }
  897.  
  898.         if (isset($this->template_options['separatepage']&& $this->template_options['separatepage'])
  899.         {
  900.             $this->class_data->append('method_ids',$this->getId($element));
  901.             $this->class_summary->append('methods',array('id' => $this->getId($element),
  902.                                                       'sdesc' => $docblock['sdesc'],
  903.                                                       'desc' => $docblock['desc'],
  904.                                                       'tags' => $docblock['tags'],
  905.                                                       'is_constructor' => $element->isConstructor,
  906.                                                       'function_name' => $element->getName(),
  907.                                                       'function_return' => $returntype,
  908.                                                       'function_call' => $element->getIntricateFunctionCall($this,$params),
  909.                                                       'descmethod' => $this->getFormattedDescMethods($element),
  910.                                                       'method_overrides' => $this->getFormattedOverrides($element),
  911.                                                       'line_number' => $element->getLineNumber(),
  912.                                                       'params' => $params));
  913.         else
  914.         {
  915.             $this->class_data->append('method_ids',$this->getId($element));
  916.             $this->class_data->append('methods',array('id' => $this->getId($element),
  917.                                                       'sdesc' => $docblock['sdesc'],
  918.                                                       'desc' => $docblock['desc'],
  919.                                                       'tags' => $docblock['tags'],
  920.                                                       'is_constructor' => $element->isConstructor,
  921.                                                       'function_name' => $element->getName(),
  922.                                                       'function_return' => $returntype,
  923.                                                       'function_call' => $element->getIntricateFunctionCall($this,$params),
  924.                                                       'descmethod' => $this->getFormattedDescMethods($element),
  925.                                                       'method_overrides' => $this->getFormattedOverrides($element),
  926.                                                       'line_number' => $element->getLineNumber(),
  927.                                                       'params' => $params));
  928.         }
  929.         if (!isset($this->method_data)) $this->method_data = array();
  930.         $this->method_data[$i count($this->method_data1][0$this->newSmarty(true);
  931.         $this->method_data[$i][1$element->getName();
  932.         $this->method_data[$i][0]->assign('class',$this->class);
  933.         $this->method_data[$i][0]->assign('source_location',$this->returnSee($this->getLink(basename($this->curpage->getFile())),$this->sourceloc));
  934.         $this->method_data[$i][0]->assign('sdesc',$docblock['sdesc']);
  935.         $this->method_data[$i][0]->assign('desc',$docblock['desc']);
  936.         $this->method_data[$i][0]->assign('tags',$docblock['tags']);
  937.         $this->method_data[$i][0]->assign('function_name',$fname);
  938.         $this->method_data[$i][0]->assign('function_return',$returntype);
  939.         $this->method_data[$i][0]->assign('function_call',$element->getIntricateFunctionCall($this,$params));
  940.         $this->method_data[$i][0]->assign('descmethod',$this->getFormattedDescMethods($element));
  941.         $this->method_data[$i][0]->assign('method_overrides',$this->getFormattedOverrides($element));
  942.         $this->method_data[$i][0]->assign('params',$params);
  943.         $this->method_data[$i][0]->assign('id',$this->getId($element));
  944.     }
  945.     
  946.     /**
  947.      * Converts function for template output
  948.      * @see prepareDocBlock(), parserFunction::getFunctionCall(), getFormattedConflicts()
  949.      * @param parserFunction 
  950.      */
  951.     function convertFunction(&$element)
  952.     {
  953.         parent::convertFunction($element);
  954.         $docblock $this->prepareDocBlock($element);
  955.         $fname $element->getName();
  956.         $params array();
  957.         if (count($element->docblock->params))
  958.         foreach($element->docblock->params as $param => $val)
  959.         {
  960.             $a $val->Convert($this);
  961.             $params[$paramarray("var" => $param,"datatype" => $val->converted_returnType,"data" => $a);
  962.         }
  963.         $returntype 'void';
  964.         if ($element->docblock->return)
  965.         {
  966.             $a $element->docblock->return->Convert($this);
  967.             $returntype $element->docblock->return->converted_returnType;
  968.         }
  969.  
  970.         $this->page_data->append("function_ids",$this->getId($element));
  971.         $this->page_summary->append("function_ids",$this->getId($element));
  972.         $this->page_summary->append('functions',array('id' => $this->getId($element),
  973.                                                    'sdesc' => $docblock['sdesc'],
  974.                                                    'desc' => $docblock['desc'],
  975.                                                    'tags' => $docblock['tags'],
  976.                                                    'function_name' => $element->getName(),
  977.                                                    'line_number' => $element->getLineNumber(),
  978.                                                    'function_return' => $returntype,
  979.                                                    'function_call' => $element->getIntricateFunctionCall($this,$params),
  980.                                                    'function_conflicts' => $this->getFormattedConflicts($element,'functions'),
  981.                                                    'params' => $params));
  982.         $this->function_data[$i count($this->function_data1][0$this->newSmarty(true);
  983.         $this->function_data[$i][1$element->getName();
  984.         $this->function_data[$i][0]->assign('sdesc',$docblock['sdesc']);
  985.         $this->function_data[$i][0]->assign('desc',$docblock['desc']);
  986.         $this->function_data[$i][0]->assign('tags',$docblock['tags']);
  987.         $this->function_data[$i][0]->assign('function_name',$fname);
  988.         $this->function_data[$i][0]->assign('line_number',$element->getLineNumber());
  989.         $this->function_data[$i][0]->assign('function_return',$returntype);
  990.         $this->function_data[$i][0]->assign('function_call',$element->getIntricateFunctionCall($this,$params));
  991.         $this->function_data[$i][0]->assign('function_conflicts',$this->getFormattedConflicts($element,"functions"));
  992.         $this->function_data[$i][0]->assign('params',$params);
  993.         $this->function_data[$i][0]->assign('source_location',$this->returnSee($this->getLink(basename($this->curpage->getFile())),$this->sourceloc));
  994.         $this->function_data[$i][0]->assign('id',$this->getId($element));
  995.     }
  996.     
  997.     /**
  998.      * Converts include elements for template output
  999.      * @see prepareDocBlock()
  1000.      * @param parserInclude 
  1001.      */
  1002.     function convertInclude(&$element)
  1003.     {
  1004.         parent::convertInclude($elementarray('include_file'    => '-'.strtr($element->getValue(),array('"' => ''"'" => '','.' => '-'))));
  1005.         $this->page_summary->append('includes',array('sdesc' => $docblock['sdesc'],
  1006.                                                    'desc' => $docblock['desc'],
  1007.                                                   'tags' => $docblock['tags'],
  1008.                                                   'utags' => $docblock['utags'],
  1009.                                                   'include_name'     => $element->getName(),
  1010.                                                   'include_value'    => $per,
  1011.                                                   'line_number' => $element->getLineNumber(),
  1012.                                                   'include_file'    => '-'.strtr($element->getValue(),array('"' => ''"'" => '','.' => '-'))));
  1013.     }
  1014.     
  1015.     /**
  1016.      * Converts defines for template output
  1017.      * @see prepareDocBlock(), getFormattedConflicts()
  1018.      * @param parserDefine 
  1019.      */
  1020.     function convertDefine(&$element)
  1021.     {
  1022.         $docblock $this->prepareDocBlock($element);
  1023.         parent::convertDefine($elementarray('link' => urlencode($element->getName())));
  1024.         $this->page_summary->append('defines',array('sdesc' => $docblock['sdesc'],
  1025.                                                   'desc' => $docblock['desc'],
  1026.                                                  'tags' => $docblock['tags'],
  1027.                                                  'name'     => $element->getName(),
  1028.                                                  'value'    => $element->getValue(),
  1029.                                                  'conflicts'    => $this->getFormattedConflicts($element,"defines"),
  1030.                                                  'line_number' => $element->getLineNumber(),
  1031.                                                  'id' => $this->getId($element)));
  1032.     }
  1033.     
  1034.     /**
  1035.      * Converts global variables for template output
  1036.      * @param parserGlobal 
  1037.      * @see prepareDocBlock(), getFormattedConflicts()
  1038.      */
  1039.     function convertGlobal(&$element)
  1040.     {
  1041.         parent::convertGlobal($elementarray('id' => $this->getId($element)));
  1042.         $docblock $this->prepareDocBlock($element);
  1043.         $value $this->getGlobalValue($element->getValue());
  1044.         $this->page_summary->append('globals',array('sdesc' => $docblock['sdesc'],
  1045.                                                   'desc' => $docblock['desc'],
  1046.                                                  'tags' => $docblock['tags'],
  1047.                                                  'name'     => $element->getName(),
  1048.                                                  'link'    => urlencode($element->getName()),
  1049.                                                  'value'    => $value,
  1050.                                                  'type' => $element->getDataType($this),
  1051.                                                  'line_number' => $element->getLineNumber(),
  1052.                                                  'conflicts'    => $this->getFormattedConflicts($element,"global variables"),
  1053.                                                  'id' => $this->getId($element)));
  1054.     }
  1055.     
  1056.     /**
  1057.      * converts procedural pages for template output
  1058.      * @see prepareDocBlock(), getClassesOnPage()
  1059.      * @param parserData 
  1060.      */
  1061.     function convertPage(&$element)
  1062.     {
  1063.         parent::convertPage($element);
  1064.         $this->juststarted = true;
  1065.         $this->page_dir = $element->parent->package;
  1066.         if (!empty($element->parent->subpackage)) $this->page_dir .= PATH_DELIMITER $element->parent->subpackage;
  1067.         // registering stuff on the template
  1068.         $this->page_data->assign("source_location",$element->parent->getSourceLocation($this,$this->template_options['usepear']));
  1069.         $this->page_data->assign("function_ids",array());
  1070.         if ($t $element->getTutorial())
  1071.         {
  1072.             $this->page_data->append("function_ids",$this->getId($t));
  1073.         }
  1074.  
  1075.         $this->sourceloc = $element->parent->getSourceLocation($this,$this->template_options['usepear']);
  1076.         $this->page_data->assign("id"$this->getId($element));
  1077.         if (isset($this->template_options['separatepage']&& $this->template_options['separatepage'])
  1078.         {
  1079.             $this->page_summary new Smarty;
  1080.             $this->page_summary->template_dir $this->smarty_dir . PATH_DELIMITER 'templates';
  1081.             $this->page_summary->compile_dir $this->smarty_dir . PATH_DELIMITER 'templates_c';
  1082.             $this->page_summary->config_dir $this->smarty_dir . PATH_DELIMITER 'configs';
  1083.             // registering stuff on the template
  1084.             $this->page_summary->assign("source_location",$element->parent->getSourceLocation($this,$this->template_options['usepear']));
  1085.             $this->page_summary->assign("date",date("r",time()));
  1086.             $this->page_summary->assign("functions",array());
  1087.             $this->page_summary->assign("includes",array());
  1088.             $this->page_summary->assign("defines",array());
  1089.             $this->page_summary->assign("globals",array());
  1090.             $this->page_summary->assign("classes",$this->getClassesOnPage($element));
  1091.             $this->page_summary->assign("name",$element->parent->getFile());
  1092.             $this->page_summary->assign("function_ids",array());
  1093.             if ($element->docblock)
  1094.             {
  1095.                 $docblock $this->prepareDocBlock($elementfalse);
  1096.                 $this->page_summary->assign("sdesc",$docblock['sdesc']);
  1097.                 $this->page_summary->assign("desc",$docblock['desc']);
  1098.                 $this->page_summary->assign("tags",$docblock['tags']);
  1099.                 $this->page_summary->assign("utags",$docblock['utags']);
  1100.             }
  1101.             $this->sourceloc = $element->parent->getSourceLocation($this,$this->template_options['usepear']);
  1102.             $this->page_summary->assign("name"$element->parent->getFile());
  1103.             $this->page_summary->assign("id"$this->getId($element).'.'.$this->getPageName($element->parent).'-summary');
  1104.             $this->page_data->append("function_ids",$this->getId($element).'.'.strtolower($this->getPageName($element->parent)).'-summary');
  1105.         }
  1106.     }
  1107.     
  1108.     function getPageName(&$element)
  1109.     {
  1110.         return str_replace(array('/','_','.'),array('-','-','---'),$element->getSourceLocation($this,$this->template_options['usepear']));
  1111.     }
  1112.  
  1113.     /**
  1114.      * returns an array containing the class inheritance tree from the root object to the class
  1115.      *
  1116.      * @param parserClass    class variable
  1117.      * @return array Format: array(root,child,child,child,...,$class)
  1118.      * @uses parserClass::getParentClassTree()
  1119.      */
  1120.     
  1121.     function generateFormattedClassTree($class)
  1122.     {
  1123.         $tree $class->getParentClassTree($this);
  1124.         $out '';
  1125.         if (count($tree1)
  1126.         {
  1127.             $result array($class->getName());
  1128.             $parent $tree[$class->getName()];
  1129.             while ($parent)
  1130.             {
  1131.                 $subpackage $parent->docblock->subpackage;
  1132.                 $package $parent->docblock->package;
  1133.                 $x $parent;
  1134.                 if (is_object($parent))
  1135.                 $x $parent->getLink($this);
  1136.                 if (!$x$x $parent->getName();
  1137.                 $result[
  1138.                     $x;
  1139.                 if (is_object($parent))
  1140.                 $parent $tree[$parent->getName()];
  1141.                 elseif (isset($tree[$parent]))
  1142.                 $parent $tree[$parent];
  1143.             }
  1144.             return array_reverse($result);
  1145.         else
  1146.         {
  1147.             return array($class->getName());
  1148.         }
  1149.     }
  1150.     
  1151.     /** @access private */
  1152.     function sortVar($a$b)
  1153.     {
  1154.         return strnatcasecmp($a->getName(),$b->getName());
  1155.     }
  1156.     
  1157.     /** @access private */
  1158.     function sortMethod($a$b)
  1159.     {
  1160.         if ($a->isConstructorreturn -1;
  1161.         if ($b->isConstructorreturn 1;
  1162.         return strnatcasecmp($a->getName(),$b->getName());
  1163.     }
  1164.  
  1165.     /**
  1166.      * returns a template-enabled array of class trees
  1167.      * 
  1168.      * @param    string    $package    package to generate a class tree for
  1169.      * @see $roots, HTMLConverter::getRootTree()
  1170.      */
  1171.     function generateFormattedClassTrees($package)
  1172.     {
  1173.         if (!isset($this->roots[$package])) return array();
  1174.         $roots $trees array();
  1175.         $roots $this->roots[$package];
  1176.         for($i=0;$i<count($roots);$i++)
  1177.         {
  1178.             $trees[array('class' => $roots[$i],'class_tree' => "<ul>\n".$this->getRootTree($this->getSortedClassTreeFromClass($roots[$i],$package,''),$package)."</ul>\n");
  1179.         }
  1180.         return $trees;
  1181.     }
  1182.     
  1183.     /**
  1184.      * return formatted class tree for the Class Trees page
  1185.      *
  1186.      * @param array $tree output from {@link getSortedClassTreeFromClass()}
  1187.      * @see Classes::$definitechild, generateFormattedClassTrees()
  1188.      * @return string 
  1189.      */
  1190.     function getRootTree($tree,$package)
  1191.     {
  1192.         if (!$treereturn '';
  1193.         $my_tree '';
  1194.         $cur '#root';
  1195.         $lastcur array(false);
  1196.         $kids array();
  1197.         $dopar false;
  1198.         if ($tree[$cur]['parent'])
  1199.         {
  1200.             $dopar true;
  1201.             if (!is_object($tree[$cur]['parent']))
  1202.             {
  1203. //                debug("parent ".$tree[$cur]['parent']." not found");
  1204.                 $my_tree .= '<listitem>' $tree[$cur]['parent'.'<itemizedlist>';
  1205.             }
  1206.             else
  1207.             {
  1208. //                        debug("parent ".$this->returnSee($tree[$cur]['parent'], false, false)." in other package");
  1209.                 $my_tree .= '<listitem>' $this->returnSee($tree[$cur]['parent']falsefalse);
  1210.                 if ($tree[$cur]['parent']->package != $package$my_tree .= ' <emphasis>(Different package)</emphasis><itemizedlist>';
  1211.             }
  1212.         }
  1213.         do
  1214.         {
  1215. //            fancy_debug($cur,$lastcur,$kids);
  1216.             if (count($tree[$cur]['children']))
  1217.             {
  1218. //                debug("$cur has children");
  1219.                 if (!isset($kids[$cur]))
  1220.                 {
  1221. //                    debug("set $cur kids");
  1222.                     $kids[$cur1;
  1223.                     $my_tree .= '<listitem>'.$this->returnSee($tree[$cur]['link']falsefalse);
  1224.                     $my_tree .= '<itemizedlist>'."\n";
  1225.                 }
  1226.                 array_push($lastcur,$cur);
  1227.                 list(,$cureach($tree[$cur]['children']);
  1228. //                var_dump('listed',$cur);
  1229.                 if ($cur)
  1230.                 {
  1231.                     $cur $cur['package''#' $cur['class'];
  1232. //                    debug("set cur to child $cur");
  1233. //                    $my_tree .= '<li>'.$this->returnSee($tree[$cur]['link'], false, false);
  1234.                     continue;
  1235.                 else
  1236.                 {
  1237. //                    debug("end of children for $cur");
  1238.                     $cur array_pop($lastcur);
  1239.                     $cur array_pop($lastcur);
  1240.                     $my_tree .= '</itemizedlist></listitem>'."\n";
  1241.                     if ($dopar && ($cur == '#root' || !$cur)) $my_tree .= '</itemizedlist></listitem>';
  1242.                 }
  1243.             else 
  1244.             {
  1245. //                debug("$cur has no children");
  1246.                 $my_tree .= '<listitem>'.$this->returnSee($tree[$cur]['link']falsefalse)."</listitem>";
  1247.                 if ($dopar && $cur == '#root'$my_tree .= '</itemizedlist></listitem>';
  1248.                 $cur array_pop($lastcur);
  1249.             }
  1250.         while ($cur);
  1251.         return $my_tree;
  1252.     }
  1253.     /**
  1254.      * Generate alphabetical index of all elements
  1255.      *
  1256.      * @see $elements, walk()
  1257.      */
  1258.     function generateElementIndex()
  1259.     {
  1260.         $elementindex array();
  1261.         $letters array();
  1262.         $i 0;
  1263.         foreach($this->elements as $letter => $nutoh)
  1264.         {
  1265.             $letters[]['letter'$letter;
  1266.             $elindex['letter'$letter;
  1267.             foreach($this->elements[$letteras $i => $yuh)
  1268.             {
  1269.                 switch($this->elements[$letter][$i]->type)
  1270.                 {
  1271.                     case 'class':
  1272.                         $aa '';
  1273.                         $aa $this->elements[$letter][$i]->docblock->getSDesc($this);
  1274.                         $oo['name'$this->elements[$letter][$i]->getName();
  1275.                         $oo['listing'=
  1276.                             'in file '.$this->elements[$letter][$i]->file.', class '.$this->getClassLink($this->elements[$letter][$i]->getName(),
  1277.                                                 $this->elements[$letter][$i]->docblock->package,
  1278.                                                 $this->elements[$letter][$i]->getPath(),
  1279.                                                 $this->elements[$letter][$i]->getName()
  1280.                                                 false
  1281.                                                 true);
  1282.                         $oo['sdesc'"$aa";
  1283.                         $elindex['index'][$oo
  1284.                     break;
  1285.                     case 'define':
  1286.                         $aa '';
  1287.                         $aa $this->elements[$letter][$i]->docblock->getSDesc($this);
  1288.                         $oo['name'$this->elements[$letter][$i]->getName();
  1289.                         $oo['listing'=
  1290.                             'in file '.$this->elements[$letter][$i]->file.', constant '.$this->getDefineLink($this->elements[$letter][$i]->getName(),
  1291.                                                  $this->elements[$letter][$i]->docblock->package,
  1292.                                                  $this->elements[$letter][$i]->getPath(),
  1293.                                                  $this->elements[$letter][$i]->getName()
  1294.                                                  false);
  1295.                         $oo['sdesc'"$aa";
  1296.                         $elindex['index'][$oo
  1297.                     break;
  1298.                     case 'global':
  1299.                         $aa '';
  1300.                         $aa $this->elements[$letter][$i]->docblock->getSDesc($this);
  1301.                         $oo['name'$this->elements[$letter][$i]->getName();
  1302.                         $oo['listing'=
  1303.                             'in file '.$this->elements[$letter][$i]->file.', global variable '.$this->getGlobalLink($this->elements[$letter][$i]->getName(),
  1304.                                                  $this->elements[$letter][$i]->docblock->package,
  1305.                                                  $this->elements[$letter][$i]->getPath(),
  1306.                                                  $this->elements[$letter][$i]->getName()
  1307.                                                  false);
  1308.                         $oo['sdesc'"$aa";
  1309.                         $elindex['index'][$oo
  1310.                     break;
  1311.                     case 'function':
  1312.                         $aa '';
  1313.                         $aa $this->elements[$letter][$i]->docblock->getSDesc($this);
  1314.                         $oo['name'$this->elements[$letter][$i]->getName();
  1315.                         $oo['listing'=
  1316.                             'in file '.$this->elements[$letter][$i]->file.', function '.$this->getFunctionLink($this->elements[$letter][$i]->getName(),
  1317.                                                    $this->elements[$letter][$i]->docblock->package,
  1318.                                                    $this->elements[$letter][$i]->getPath(),
  1319.                                                    $this->elements[$letter][$i]->getName().'()'
  1320.                                                    false);
  1321.                         $oo['sdesc'"$aa";
  1322.                         $elindex['index'][$oo
  1323.                     break;
  1324.                     case 'method':
  1325.                         $aa '';
  1326.                         $aa $this->elements[$letter][$i]->docblock->getSDesc($this);
  1327.                         $oo['name'$this->elements[$letter][$i]->getName();
  1328.                         $oo['listing'=
  1329.                             'in file '.$this->elements[$letter][$i]->file.', method '.$this->getMethodLink($this->elements[$letter][$i]->getName(),
  1330.                                                  $this->elements[$letter][$i]->class,
  1331.                                                  $this->elements[$letter][$i]->docblock->package,
  1332.                                                  $this->elements[$letter][$i]->getPath(),
  1333.                                                  $this->elements[$letter][$i]->class.'::'.$this->elements[$letter][$i]->getName().'()'
  1334.                                                  false);
  1335.                         $oo['sdesc'"$aa";
  1336.                         $elindex['index'][$oo
  1337.                     break;
  1338.                     case 'var':
  1339.                         $aa '';
  1340.                         $aa $this->elements[$letter][$i]->docblock->getSDesc($this);
  1341.                         $oo['name'$this->elements[$letter][$i]->getName();
  1342.                         $oo['listing'=
  1343.                             'in file '.$this->elements[$letter][$i]->file.', variable '.$this->getVarLink($this->elements[$letter][$i]->getName(),
  1344.                                               $this->elements[$letter][$i]->class,
  1345.                                               $this->elements[$letter][$i]->docblock->package,
  1346.                                               $this->elements[$letter][$i]->getPath(),
  1347.                                               $this->elements[$letter][$i]->class.'::'.$this->elements[$letter][$i]->getName()
  1348.                                               false);
  1349.                         $oo['sdesc'"$aa";
  1350.                         $elindex['index'][$oo
  1351.                     break;
  1352.                     case 'page':
  1353.                         $oo['name'$this->elements[$letter][$i]->getFile();
  1354.                         $oo['listing'=
  1355.                             'procedural page '.$this->getPageLink($this->elements[$letter][$i]->getFile(),
  1356.                                                $this->elements[$letter][$i]->package,
  1357.                                                $this->elements[$letter][$i]->getPath(),
  1358.                                                $this->elements[$letter][$i]->getFile()
  1359.                                                false);
  1360.                         $elindex['index'][$oo
  1361.                     break;
  1362.                 }
  1363.             }
  1364.             if (isset($elindex['index']))
  1365.             {
  1366.                 $elementindex[$elindex;
  1367.             else
  1368.             {
  1369.                 unset($letters[count($letters1]);
  1370.             }
  1371.             $elindex array();
  1372.         }
  1373.         return array($elementindex,$letters);
  1374.     }
  1375.     
  1376.     function setTemplateDir($dir)
  1377.     {
  1378.         Converter::setTemplateDir($dir);
  1379.         $this->smarty_dir = $this->templateDir;
  1380.     }
  1381.     
  1382.     /**
  1383.      * calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
  1384.      * @see Converter::setTargetDir()
  1385.      */
  1386.     function setTargetDir($dir)
  1387.     {
  1388.         Converter::setTargetDir($dir);
  1389.         static $wrote false;
  1390.         if ($wrotereturn;
  1391.         $wrote true;
  1392.         $template_images array();
  1393.         $stylesheets array();
  1394.         $dir $this->templateDir;
  1395.         $this->templateDir = $this->templateDir.'templates/';
  1396.         $d dir($this->templateDir)
  1397.         $template_images array();
  1398.         while($entry $d->read())
  1399.         {
  1400.             $sp explode("."$entry)
  1401.             if preg_match("/\.(gif|jpg|png)$/i"$entry) )
  1402.             {
  1403.                 $template_images[$entry;
  1404.             }
  1405.         }
  1406.         $d dir($this->templateDir)
  1407.         while($entry $d->read())
  1408.         {
  1409.             $sp explode("."$entry)
  1410.             if preg_match("/\.css$/i"$entry) )
  1411.             {
  1412.                 $stylesheets[$entry;
  1413.             }
  1414.         }
  1415.         phpDocumentor_out("Copying Any Stylesheets\n");
  1416.         flush();
  1417.         foreach($stylesheets as $image)
  1418.         {
  1419.             if (file_exists($this->templateDir.$image))
  1420.             {
  1421.                 phpDocumentor_out("Writing $image\n");
  1422.                 flush();
  1423.                 $this->copyFile($image);
  1424.             }
  1425.         }
  1426.         phpDocumentor_out("Copying Any Template Images\n");
  1427.         flush();
  1428.         foreach($template_images as $image)
  1429.         {
  1430.             if (file_exists($this->templateDir.$image))
  1431.             {
  1432.                 phpDocumentor_out("Writing $image\n");
  1433.                 flush();
  1434.                 $this->copyFile($image);
  1435.             }
  1436.         }
  1437.         $this->templateDir = $dir;
  1438.     }
  1439.     
  1440.     /**
  1441.      * Generate alphabetical index of all elements by package and subpackage
  1442.      *
  1443.      * @param string $package name of a package
  1444.      * @see $pkg_elements, walk(), generatePkgElementIndexes()
  1445.      */
  1446.     function generatePkgElementIndex($package)
  1447.     {
  1448.         $elementindex array();
  1449.         $letters array();
  1450.         $letterind array();
  1451.         $used array();
  1452.         $subp '';
  1453.         foreach($this->pkg_elements[$packageas $subpackage => $els)
  1454.         {
  1455.             if (empty($els)) continue;
  1456.             foreach($els as $letter => $yuh)
  1457.             {
  1458.                 if (!isset($used[$letter]))
  1459.                 {
  1460.                     $letters[]['letter'$letter;
  1461.                     $letterind[$lettercount($letters1;
  1462.                     $used[$letter1;
  1463.                 }
  1464.                 $elindex[$letter]['letter'$letter;
  1465.                 foreach($els[$letteras $i => $yuh)
  1466.                 {
  1467.                     switch($els[$letter][$i]->type)
  1468.                     {
  1469.                         case 'class':
  1470.                             $aa '';
  1471.                             $aa $els[$letter][$i]->docblock->getSDesc($this);
  1472.                             $oo['name'$els[$letter][$i]->getName();
  1473.                             $oo['listing'=
  1474.                                 'in file '.$els[$letter][$i]->file.', class '.$this->getClassLink($els[$letter][$i]->getName(),
  1475.                                                     $els[$letter][$i]->docblock->package,
  1476.                                                     $els[$letter][$i]->getPath(),
  1477.                                                     $els[$letter][$i]->getName()
  1478.                                                     false
  1479.                                                     true);
  1480.                             $oo['subpackage'$subpackage;
  1481.                             $oo['sdesc'$aa;
  1482.                             $elindex[$letter]['index'][$oo
  1483.                         break;
  1484.                         case 'define':
  1485.                             $aa $els[$letter][$i]->docblock->getSDesc($this);
  1486.                             $oo['name'$els[$letter][$i]->getName();
  1487.                             $oo['listing'=
  1488.                                 'in file '.$els[$letter][$i]->file.', constant '.$this->getDefineLink($els[$letter][$i]->getName(),
  1489.                                                      $els[$letter][$i]->docblock->package,
  1490.                                                      $els[$letter][$i]->getPath(),
  1491.                                                      $els[$letter][$i]->getName()
  1492.                                                      false);
  1493.                             $oo['subpackage'$subpackage;
  1494.                             $oo['sdesc'$aa;
  1495.                             $elindex[$letter]['index'][$oo
  1496.                         break;
  1497.                         case 'global':
  1498.                             $aa $els[$letter][$i]->docblock->getSDesc($this);
  1499.                             $oo['name'$els[$letter][$i]->getName();
  1500.                             $oo['listing'=
  1501.                                 'in file '.$els[$letter][$i]->file.', global variable '.$this->getGlobalLink($els[$letter][$i]->getName(),
  1502.                                                      $els[$letter][$i]->docblock->package
  1503.                                                      $els[$letter][$i]->getPath(),
  1504.                                                      $els[$letter][$i]->getName()
  1505.                                                      ,false);
  1506.                             $oo['subpackage'$subpackage;
  1507.                             $oo['sdesc'$aa;
  1508.                             $elindex[$letter]['index'][$oo
  1509.                         break;
  1510.                         case 'function':
  1511.                             $aa $els[$letter][$i]->docblock->getSDesc($this);
  1512.                             $oo['name'$els[$letter][$i]->getName();
  1513.                             $oo['listing'=
  1514.                                 'in file '.$els[$letter][$i]->file.', function '.$this->getFunctionLink($els[$letter][$i]->getName(),
  1515.                                                        $els[$letter][$i]->docblock->package,
  1516.                                                        $els[$letter][$i]->getPath(),
  1517.                                                        $els[$letter][$i]->getName().'()'
  1518.                                                        false);
  1519.                             $oo['subpackage'$subpackage;
  1520.                             $oo['sdesc'$aa;
  1521.                             $elindex[$letter]['index'][$oo
  1522.                         break;
  1523.                         case 'method':
  1524.                             $aa $els[$letter][$i]->docblock->getSDesc($this);
  1525.                             $oo['name'$els[$letter][$i]->getName();
  1526.                             $oo['listing'=
  1527.                                 'in file '.$els[$letter][$i]->file.', method '.$this->getMethodLink($els[$letter][$i]->getName(),
  1528.                                                      $els[$letter][$i]->class,
  1529.                                                      $els[$letter][$i]->docblock->package
  1530.                                                      $els[$letter][$i]->getPath(),
  1531.                                                      $els[$letter][$i]->class.'::'.$els[$letter][$i]->getName().'()'
  1532.                                                      false);
  1533.                             $oo['subpackage'$subpackage;
  1534.                             $oo['sdesc'$aa;
  1535.                             $elindex[$letter]['index'][$oo
  1536.                         break;
  1537.                         case 'var':
  1538.                             $aa $els[$letter][$i]->docblock->getSDesc($this);
  1539.                             $oo['name'$els[$letter][$i]->getName();
  1540.                             $oo['listing'=
  1541.                                 'in file '.$els[$letter][$i]->file.', variable '.$this->getVarLink($els[$letter][$i]->getName(),
  1542.                                                   $els[$letter][$i]->class,
  1543.                                                   $els[$letter][$i]->docblock->package,
  1544.                                                   $els[$letter][$i]->getPath(),
  1545.                                                   $els[$letter][$i]->class.'::'.$els[$letter][$i]->getName()
  1546.                                                   false);
  1547.                             $oo['subpackage'$subpackage;
  1548.                             $oo['sdesc'$aa;
  1549.                             $elindex[$letter]['index'][$oo
  1550.                         break;
  1551.                         case 'page':
  1552.                             $oo['name'$els[$letter][$i]->getFile();
  1553.                             $oo['listing'=
  1554.                                 'procedural page '.$this->getPageLink($els[$letter][$i]->getFile(),
  1555.                                                    $els[$letter][$i]->package,
  1556.                                                    $els[$letter][$i]->getPath(),
  1557.                                                    $els[$letter][$i]->getFile()
  1558.                                                    false);
  1559.                             $oo['subpackage'$subpackage;
  1560.                             $elindex[$letter]['index'][$oo
  1561.                         break;
  1562.                     }
  1563.                 }
  1564.             }
  1565.         }
  1566.         ksort($elindex);
  1567.         usort($letters,'XMLDocBook_lettersort');
  1568.         if (isset($elindex))
  1569.         {
  1570.             while(list($letter,$tempeleach($elindex))
  1571.             {
  1572.                 if (!isset($tempel))
  1573.                 {
  1574.                     unset($letters[$letterind[$tempel['letter']]]);
  1575.                 else
  1576.                 $elementindex[$tempel;
  1577.             }
  1578.         else $letters array();
  1579.         return array($elementindex,$letters);
  1580.     }
  1581.     
  1582.     /**
  1583.      *
  1584.      * @see generatePkgElementIndex()
  1585.      */
  1586.     function generatePkgElementIndexes()
  1587.     {
  1588.         $packages array();
  1589.         $package_names array();
  1590.         $pkg array();
  1591.         $letters array();
  1592.         foreach($this->pkg_elements as $package => $trash)
  1593.         {
  1594.             $pkgs['package'$package;
  1595.             $pkg['package'$package;
  1596.             list($pkg['pindex'],$letters[$package]$this->generatePkgElementIndex($package);
  1597.             if (count($pkg['pindex']))
  1598.             {
  1599.                 $packages[$pkg;
  1600.                 $package_names[$pkgs;
  1601.             }
  1602.             unset($pkgs);
  1603.             unset($pkg);
  1604.         }
  1605.         foreach($packages as $i => $package)
  1606.         {
  1607.             $pnames array();
  1608.             for($j=0;$j<count($package_names);$j++)
  1609.             {
  1610.                 if ($package_names[$j]['package'!= $package['package']$pnames[$package_names[$j];
  1611.             }
  1612.             $packages[$i]['packageindexes'$pnames;
  1613.         }
  1614.         return array($packages,$package_names,$letters);
  1615.     }
  1616.     
  1617.     /**
  1618.      * @param string name of class
  1619.      * @param string package name
  1620.      * @param string full path to look in (used in index generation)
  1621.      * @param boolean deprecated
  1622.      * @param boolean return just the URL, or enclose it in an html a tag
  1623.      * @return mixed false if not found, or an html a link to the class's documentation
  1624.      * @see parent::getClassLink()
  1625.      */
  1626.     function getClassLink($expr,$package$file false,$text false$local true$with_a true)
  1627.     {
  1628.         $a Converter::getClassLink($expr,$package,$file);
  1629.         if (!$areturn false;
  1630.         return $this->returnSee($a$text$local$with_a);
  1631.     }
  1632.  
  1633.     /**
  1634.      * @param string name of function
  1635.      * @param string package name
  1636.      * @param string full path to look in (used in index generation)
  1637.      * @param boolean deprecated
  1638.      * @param boolean return just the URL, or enclose it in an html a tag
  1639.      * @return mixed false if not found, or an html a link to the function's documentation
  1640.      * @see parent::getFunctionLink()
  1641.      */
  1642.     function getFunctionLink($expr,$package$file false,$text false$local true)
  1643.     {
  1644.         $a Converter::getFunctionLink($expr,$package,$file);
  1645.         if (!$areturn false;
  1646.         return $this->returnSee($a$text$local);
  1647.     }
  1648.  
  1649.     /**
  1650.      * @param string name of define
  1651.      * @param string package name
  1652.      * @param string full path to look in (used in index generation)
  1653.      * @param boolean deprecated
  1654.      * @param boolean return just the URL, or enclose it in an html a tag
  1655.      * @return mixed false if not found, or an html a link to the define's documentation
  1656.      * @see parent::getDefineLink()
  1657.      */
  1658.     function getDefineLink($expr,$package$file false,$text false$local true)
  1659.     {
  1660.         $a Converter::getDefineLink($expr,$package,$file);
  1661.         if (!$areturn false;
  1662.         return $this->returnSee($a$text$local);
  1663.     }
  1664.  
  1665.     /**
  1666.      * @param string name of global variable
  1667.      * @param string package name
  1668.      * @param string full path to look in (used in index generation)
  1669.      * @param boolean deprecated
  1670.      * @param boolean return just the URL, or enclose it in an html a tag
  1671.      * @return mixed false if not found, or an html a link to the global variable's documentation
  1672.      * @see parent::getGlobalLink()
  1673.      */
  1674.     function getGlobalLink($expr,$package$file false,$text false$local true)
  1675.     {
  1676.         $a Converter::getGlobalLink($expr,$package,$file);
  1677.         if (!$areturn false;
  1678.         return $this->returnSee($a$text$local);
  1679.     }
  1680.  
  1681.     /**
  1682.      * @param string name of procedural page
  1683.      * @param string package name
  1684.      * @param string full path to look in (used in index generation)
  1685.      * @param boolean deprecated
  1686.      * @param boolean return just the URL, or enclose it in an html a tag
  1687.      * @return mixed false if not found, or an html a link to the procedural page's documentation
  1688.      * @see parent::getPageLink()
  1689.      */
  1690.     function getPageLink($expr,$package$path false,$text false$local true)
  1691.     {
  1692.         $a Converter::getPageLink($expr,$package,$path);
  1693.         if (!$areturn false;
  1694.         return $this->returnSee($a$text$local);
  1695.     }
  1696.  
  1697.     /**
  1698.      * @param string name of method
  1699.      * @param string class containing method
  1700.      * @param string package name
  1701.      * @param string full path to look in (used in index generation)
  1702.      * @param boolean deprecated
  1703.      * @param boolean return just the URL, or enclose it in an html a tag
  1704.      * @return mixed false if not found, or an html a link to the method's documentation
  1705.      * @see parent::getMethodLink()
  1706.      */
  1707.     function getMethodLink($expr,$class,$package$file false,$text false$local true)
  1708.     {
  1709.         $a Converter::getMethodLink($expr,$class,$package,$file);
  1710.         if (!$areturn false;
  1711.         return $this->returnSee($a$text$local);
  1712.     }
  1713.  
  1714.     /**
  1715.      * @param string name of var
  1716.      * @param string class containing var
  1717.      * @param string package name
  1718.      * @param string full path to look in (used in index generation)
  1719.      * @param boolean deprecated
  1720.      * @param boolean return just the URL, or enclose it in an html a tag
  1721.      * @return mixed false if not found, or an html a link to the var's documentation
  1722.      * @see parent::getVarLink()
  1723.      */
  1724.     function getVarLink($expr,$class,$package$file false,$text false$local true)
  1725.     {
  1726.         $a Converter::getVarLink($expr,$class,$package,$file);
  1727.         if (!$areturn false;
  1728.         return $this->returnSee($a$text$local);
  1729.     }
  1730.     
  1731.     /**
  1732.      * does a nat case sort on the specified second level value of the array
  1733.      *
  1734.      * @param    mixed    $a 
  1735.      * @param    mixed    $b 
  1736.      * @return    int 
  1737.      */
  1738.     function rcNatCmp ($a$b)
  1739.     {
  1740.         $aa strtoupper($a[$this->rcnatcmpkey]);
  1741.         $bb strtoupper($b[$this->rcnatcmpkey]);
  1742.         
  1743.         return strnatcasecmp($aa$bb);
  1744.     }
  1745.     
  1746.     /**
  1747.      * does a nat case sort on the specified second level value of the array.
  1748.      * this one puts constructors first
  1749.      *
  1750.      * @param    mixed    $a 
  1751.      * @param    mixed    $b 
  1752.      * @return    int 
  1753.      */
  1754.     function rcNatCmp1 ($a$b)
  1755.     {
  1756.         $aa strtoupper($a[$this->rcnatcmpkey]);
  1757.         $bb strtoupper($b[$this->rcnatcmpkey]);
  1758.         
  1759.         if (strpos($aa,'CONSTRUCTOR'=== 0)
  1760.         {
  1761.             return -1;
  1762.         }
  1763.         if (strpos($bb,'CONSTRUCTOR'=== 0)
  1764.         {
  1765.             return 1;
  1766.         }
  1767.         if (strpos($aa,strtoupper($this->class)) === 0)
  1768.         {
  1769.             return -1;
  1770.         }
  1771.         if (strpos($bb,strtoupper($this->class)) === 0)
  1772.         {
  1773.             return -1;
  1774.         }
  1775.         return strnatcasecmp($aa$bb);
  1776.     }
  1777.     
  1778.     /**
  1779.      * This function is not used by HTMLdefaultConverter, but is required by Converter
  1780.      */
  1781.     function Output()
  1782.     {
  1783.     }
  1784. }
  1785.  
  1786. /** @access private */
  1787. function XMLDocBook_lettersort($a$b)
  1788. {
  1789.     return strnatcasecmp($a['letter'],$b['letter']);
  1790. }
  1791. ?>

Documentation generated on Tue, 24 Oct 2006 09:26:50 -0500 by phpDocumentor 1.3.1