summaryrefslogtreecommitdiff
path: root/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook')
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/XMLDocBookConverter.inc1792
-rw-r--r--buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Beautifier.php135
-rw-r--r--buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Plain.php250
-rw-r--r--buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Tokenizer.php752
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/XMLDocBookpeardoc2Converter.inc1701
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/options.ini39
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/category.tpl26
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/class.tpl29
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/class_summary.tpl53
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/constants.tpl68
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/docblock.tpl116
-rw-r--r--buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/errors.tpl21
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/globals.tpl69
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/imethods.tpl24
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/ivars.tpl26
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/method.tpl45
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/package.tpl26
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/tutorial.tpl21
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/var.tpl15
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/class_summary.tpl93
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/ivars.tpl26
-rwxr-xr-xbuildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/tutorial.tpl21
22 files changed, 5348 insertions, 0 deletions
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/XMLDocBookConverter.inc b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/XMLDocBookConverter.inc
new file mode 100755
index 00000000..c0d648d2
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/XMLDocBookConverter.inc
@@ -0,0 +1,1792 @@
+<?php
+//
+// +------------------------------------------------------------------------+
+// | phpDocumentor |
+// +------------------------------------------------------------------------+
+// | Copyright (c) 2000-2003 Joshua Eichorn, Gregory Beaver |
+// | Email jeichorn@phpdoc.org, cellog@phpdoc.org |
+// | Web http://www.phpdoc.org |
+// | Mirror http://phpdocu.sourceforge.net/ |
+// | PEAR http://pear.php.net/package/PhpDocumentor |
+// +------------------------------------------------------------------------+
+// | This source file is subject to version 3.00 of the PHP License, |
+// | that is available at http://www.php.net/license/3_0.txt. |
+// | If you did not receive a copy of the PHP license and are unable to |
+// | obtain it through the world-wide-web, please send a note to |
+// | license@php.net so we can mail you a copy immediately. |
+// +------------------------------------------------------------------------+
+//
+/**
+ * XML output converter for DocBook.
+ * This Converter takes output from the {@link Parser} and converts it to DocBook output
+ *
+ * @package Converters
+ * @subpackage XMLDocBook
+ * @see parserDocBlock, parserInclude, parserPage, parserClass, parserDefine, parserFunction, parserMethod, parserVar
+ * @author Greg Beaver <cellog@php.net>
+ * @since 1.0
+ * @version $Id: XMLDocBookConverter.inc 234145 2007-04-19 20:20:57Z ashnazg $
+ */
+/**
+ * XML DocBook converter.
+ * This Converter takes output from the {@link Parser} and converts it to DocBook output
+ *
+ * @package Converters
+ * @subpackage XMLDocBook
+ * @see parserDocBlock, parserInclude, parserPage, parserClass, parserDefine, parserFunction, parserMethod, parserVar
+ * @author Greg Beaver <cellog@php.net>
+ * @since 1.0
+ * @version $Id: XMLDocBookConverter.inc 234145 2007-04-19 20:20:57Z ashnazg $
+ * @todo indexes for other DocBook converters not based on peardoc
+ * @todo templates
+ */
+class XMLDocBookConverter extends Converter
+{
+ /**
+ * XMLDocBookConverter wants elements sorted by type as well as alphabetically
+ * @see Converter::$sort_page_contents_by_type
+ * @var boolean
+ */
+ var $sort_page_contents_by_type = true;
+ /** @var string */
+ var $outputformat = 'XML';
+ /** @var string */
+ var $name = 'DocBook';
+ /**
+ * indexes of elements by package that need to be generated
+ * @var array
+ */
+ var $leftindex = array('classes' => true, 'pages' => true, 'functions' => false, 'defines' => false, 'globals' => false);
+ /**
+ * whether a @see is going to be in the {@link $base_dir}, or in a package/subpackage subdirectory of $base_dir
+ * @var boolean
+ */
+ var $local = true;
+
+ /**
+ * name of current page being converted
+ * @var string
+ */
+ var $page;
+
+ /**
+ * path of current page being converted
+ * @var string
+ */
+ var $path;
+
+ /**
+ * name of current class being converted
+ * @var string
+ */
+ var $class;
+
+ /**
+ * template for the procedural page currently being processed
+ * @var Template
+ */
+ var $page_data;
+
+ /**
+ * output directory for the current procedural page being processed
+ * @var string
+ */
+ var $page_dir;
+
+ /**
+ * target directory passed on the command-line.
+ * {@link $targetDir} is malleable, always adding package/ and package/subpackage/ subdirectories onto it.
+ * @var string
+ */
+ var $base_dir;
+
+ /**
+ * output directory for the current class being processed
+ * @var string
+ */
+ var $class_dir;
+
+ /**
+ * template for the class currently being processed
+ * @var Template
+ */
+ var $class_data;
+
+ /**
+ * array of converted package page names.
+ * Used to link to the package page in the left index
+ * @var array Format: array(package => 1)
+ */
+ var $package_pages = array();
+
+ /**
+ * controls formatting of parser informative output
+ *
+ * Converter prints:
+ * "Converting /path/to/file.php... Procedural Page Elements... Classes..."
+ * Since HTMLdefaultConverter outputs files while converting, it needs to send a \n to start a new line. However, if there
+ * is more than one class, output is messy, with multiple \n's just between class file output. This variable prevents that
+ * and is purely cosmetic
+ * @var boolean
+ */
+ var $juststarted = false;
+
+ /**
+ * contains all of the template procedural page element loop data needed for the current template
+ * @var array
+ */
+ var $current;
+
+ /**
+ * contains all of the template class element loop data needed for the current template
+ * @var array
+ */
+ var $currentclass;
+ /**
+ * template options. Currently only 1 recognized option usepear
+ *
+ * usepear tells the getLink() function to return a package link to PEAR and PEAR_ERROR if possible, and to link directly
+ * to the fully-delimited link package#class.method or package#file.method in PEAR style, if possible, even if the
+ * package is not parsed. This will allow parsing of separate PEAR packages without parsing the entire thing at once!
+ * @var array
+ */
+ var $template_options = array('usepear' => false);
+
+ var $function_data = array();
+ var $method_data = array();
+ var $sourceloc = '';
+ /**
+ * peardoc2 Category
+ * @var string
+ */
+ var $category;
+ /**
+ * sets {@link $base_dir} to $targetDir
+ * @see Converter()
+ */
+ function XMLDocBookConverter(&$allp, &$packp, &$classes, &$procpages, $po, $pp, $qm, $targetDir, $templateDir, $title)
+ {
+ die("XMLDocBookConverter is not supported in this development version. Use XML:DocBook/peardoc2:default");
+ }
+
+ /**
+ * do that stuff in $template_options
+ */
+ function &getLink($expr, $package = false, $packages = false)
+ {
+ return Converter::getLink($expr, $package, $packages);
+ }
+
+ function unmangle($s,$sourcecode)
+ {
+ return '<programlisting role="php"><![CDATA[
+'.$sourcecode.']]></programlisting>';
+ }
+
+ function type_adjust($typename)
+ {
+ if (isset($this->template_options['typechanging'][trim($typename)]))
+ return $this->template_options['typechanging'][trim($typename)];
+ $a = $this->getLink($typename);
+ if (is_object($a))
+ {
+ if (phpDocumentor_get_class($a) == 'classlink')
+ return '<classname>'.$typename.'</classname>';
+ if (phpDocumentor_get_class($a) == 'functionlink' || phpDocumentor_get_class($a) == 'methodlink')
+ return '<function>'.$typename.'</function>';
+ if (phpDocumentor_get_class($a) == 'definelink')
+ return '<constant>'.$typename.'</constant>';
+ if (phpDocumentor_get_class($a) == 'varlink')
+ return '<varname>'.$typename.'</varname>';
+ }
+ return $typename;
+ }
+
+ function &SmartyInit(&$templ)
+ {
+ $this->makeLeft();
+ $templ->assign("packageindex",$this->package_index);
+ return $templ;
+ }
+
+ /**
+ * Writes out the template file of {@link $class_data} and unsets the template to save memory
+ * @see registerCurrentClass()
+ * @see parent::endClass()
+ */
+ function endClass()
+ {
+ $a = '../';
+ if (!empty($this->subpackage)) $a .= '../';
+ if ($this->juststarted)
+ {
+ $this->juststarted = false;
+ phpDocumentor_out("\n");
+ flush();
+ }
+ foreach($this->method_data as $func)
+ {
+ $func[0]->assign("phpdocversion",PHPDOCUMENTOR_VER);
+ $func[0]->assign("phpdocwebsite",PHPDOCUMENTOR_WEBSITE);
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->class_dir . PATH_DELIMITER . str_replace(array('_','.'),array('-','--'),$this->class)));
+ $this->writefile(strtolower($func[1] ). '.xml',$func[0]->fetch('method.tpl'));
+ }
+ if (isset($this->template_options['separatepage']) && $this->template_options['separatepage'])
+ {
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->class_dir) . PATH_DELIMITER . str_replace(array('_','.'),array('-','--'),strtolower($this->class)));
+ $this->writefile(str_replace(array('_','.'),array('-','--'),strtolower($this->class)).'-summary.xml',$this->class_summary->fetch('class_summary.tpl'));
+ }
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->class_dir));
+ $this->writefile(str_replace(array('_','.'),array('-','--'),strtolower($this->class)) . '.xml',$this->class_data->fetch('class.tpl'));
+ unset($this->class_data);
+ }
+
+ /**
+ * Writes out the template file of {@link $page_data} and unsets the template to save memory
+ * @see registerCurrent()
+ * @see parent::endPage()
+ */
+ function endPage()
+ {
+ $this->package = $this->curpage->package;
+ $this->subpackage = $this->curpage->subpackage;
+ $a = '../';
+ if (!empty($this->subpackage)) $a .= '../';
+ foreach($this->function_data as $func)
+ {
+ $func[0]->assign("phpdocversion",PHPDOCUMENTOR_VER);
+ $func[0]->assign("phpdocwebsite",PHPDOCUMENTOR_WEBSITE);
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->page_dir . PATH_DELIMITER . $this->page));
+ $this->writefile(str_replace('_','-',strtolower($func[1])) . '.xml',$func[0]->fetch('function.tpl'));
+ }
+ if (isset($this->template_options['separatepage']) && $this->template_options['separatepage'])
+ {
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->page_dir . PATH_DELIMITER . $this->page));
+ $this->writefile(strtolower($this->page).'-summary.xml',$this->page_summary->fetch('page_summary.tpl'));
+ }
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->page_dir));
+ $this->writefile(strtolower($this->page) . '.xml',$this->page_data->fetch('page.tpl'));
+ unset($this->page_data);
+ }
+
+ /**
+ * @param string
+ * @param string
+ * @return string &lt;ulink url="'.$link.'">'.$text.'</ulink&gt;
+ */
+ function returnLink($link,$text)
+ {
+ return '<ulink url="'.$link.'">'.$text.'</ulink>';
+ }
+
+ function makeLeft()
+ {
+ static $done = false;
+ if ($done) return;
+ $done = true;
+ if (!isset($this->package_index))
+ foreach($this->all_packages as $key => $val)
+ {
+ if (isset($this->pkg_elements[$key]))
+ {
+ if (!isset($start)) $start = $key;
+ $this->package_index[] = array('link' => "li_$key.html", 'title' => $key);
+ }
+ }
+ foreach($this->page_elements as $package => $o1)
+ {
+ foreach($o1 as $subpackage => $links)
+ {
+ for($i=0;$i<count($links);$i++)
+ {
+ $this->left[$package][$subpackage][] =
+ array("link" => $this->returnSee($links[$i], false, false, false), "title" => $links[$i]->name);
+ }
+ }
+ }
+ foreach($this->class_elements as $package => $o1)
+ {
+ foreach($o1 as $subpackage => $links)
+ {
+ for($i=0;$i<count($links);$i++)
+ {
+ $this->left['#class'][$package][$subpackage][] =
+ array("link" => $this->returnSee($links[$i], false, false, false), "title" => $links[$i]->name);
+ }
+ }
+ }
+ }
+
+ /**
+ * HTMLdefaultConverter chooses to format both package indexes and the complete index here
+ *
+ * This function formats output for the elementindex.html and pkgelementindex.html template files. It then
+ * writes them to the target directory
+ * @see generateElementIndex(), generatePkgElementIndex()
+ */
+ function formatPkgIndex()
+ {
+ // will implement in next release with other templates than peardoc2
+ return;
+ list($package_indexes,$packages,$mletters) = $this->generatePkgElementIndexes();
+ for($i=0;$i<count($package_indexes);$i++)
+ {
+ $template = &$this->newSmarty();
+ $this->package = $package_indexes[$i]['package'];
+ $this->subpackage = '';
+ $template->assign("compiledclassindex",$this->getClassLeft());
+ $template->assign("compiledfileindex",$this->getPageLeft());
+ $template->assign("index",$package_indexes[$i]['pindex']);
+ $template->assign("package",$package_indexes[$i]['package']);
+ $template->assign("letters",$mletters[$package_indexes[$i]['package']]);
+ $template->assign("title","Package ".$package_indexes[$i]['package']." Element Index");
+ $template->assign("date",date("r",time()));
+// $this->writefile('elementindex_'.$package_indexes[$i]['package'].'.html',$template->fetch('pkgelementindex.tpl'));
+ }
+ phpDocumentor_out("\n");
+ flush();
+ }
+
+ /**
+ * HTMLdefaultConverter uses this function to format template index.html and packages.html
+ *
+ * This function generates the package list from {@link $all_packages}, eliminating any
+ * packages that don't have any entries in their package index (no files at all, due to @ignore
+ * or other factors). Then it uses the default package name as the first package index to display.
+ * It sets the right pane to be either a blank file with instructions on making package-level docs,
+ * or the package-level docs for the default package.
+ * @global string Used to set the starting package to display
+ */
+ function formatIndex()
+ {
+ // will implement in next release with other templates than peardoc2
+ return;
+ global $phpDocumentor_DefaultPackageName;
+ list($elindex,$mletters) = $this->generateElementIndex();
+ $template = &$this->newSmarty();
+ $template->assign("index",$elindex);
+ $template->assign("letters",$mletters);
+ $template->assign("title","Element Index");
+ $template->assign("date",date("r",time()));
+ phpDocumentor_out("\n");
+ flush();
+ $this->setTargetDir($this->base_dir);
+// $this->writefile('elementindex.html',$template->fetch('elementindex.tpl'));
+ uksort($this->package_index,"strnatcasecmp");
+ $index = &$this->newSmarty();
+ foreach($this->all_packages as $key => $val)
+ {
+ if (isset($this->pkg_elements[$key]))
+ {
+ if (!isset($start)) $start = $key;
+ if (!isset($this->package_pages[$key])) $this->writeNewPPage($key);
+ }
+ }
+ // Created index.html
+ if (isset($this->package_index[$phpDocumentor_DefaultPackageName])) $start = $phpDocumentor_DefaultPackageName;
+ $this->package = $start;
+ $this->subpackage = '';
+ $index->assign("compiledclassindex",$this->getClassLeft());
+ $index->assign("compiledfileindex",$this->getPageLeft());
+ $index->assign("date",date("r",time()));
+ $index->assign("title",$this->title);
+ $index->assign("start","li_$start.html");
+ if (isset($this->package_pages[$start]))
+ {
+ $index->assign("contents",$this->package_pages[$start]);
+ }
+ phpDocumentor_out("\n");
+ flush();
+ $this->setTargetDir($this->base_dir);
+// $this->writefile("index.html",$index->fetch('index.tpl'));
+ unset($index);
+
+ }
+
+ function writeNewPPage($key)
+ {
+ // will implement in next release with other templates than peardoc2
+ return;
+ $template = &$this->newSmarty();
+ $this->package = $key;
+ $this->subpackage = '';
+ $template->assign("compiledclassindex",$this->getClassLeft());
+ $template->assign("compiledfileindex",$this->getPageLeft());
+ $template->assign("date",date("r",time()));
+ $template->assign("title",$this->title);
+ $template->assign("package",$key);
+ phpDocumentor_out("\n");
+ flush();
+ $this->setTargetDir($this->base_dir);
+// $this->writefile("li_$key.html",$template->fetch('index.tpl'));
+ unset($template);
+ }
+
+ /**
+ * Generate indexes for li_package.html and classtree output files
+ *
+ * This function generates the li_package.html files from the template file left.html. It does this by
+ * iterating through each of the $page_elements, $class_elements and $function_elements arrays to retrieve
+ * the pre-sorted {@link abstractLink} descendants needed for index generation. Conversion of these links to
+ * text is done by {@link returnSee()}. The {@link $local} parameter is set to false to ensure that paths are correct.
+ *
+ * Then it uses {@link generateFormattedClassTrees()} to create class trees from the template file classtrees.html. Output
+ * filename is classtrees_packagename.html. This function also unsets {@link $elements} and {@link $pkg_elements} to free
+ * up the considerable memory these two class vars use
+ * @see $page_elements, $class_elements, $function_elements
+ */
+ function formatLeftIndex()
+ {
+ // will implement in next release with other templates than peardoc2
+ return;
+ phpDocumentor_out("\n");
+ flush();
+ $this->setTargetDir($this->base_dir);
+ if (!isset($this->left))
+ {
+ debug("Nothing parsed, check the command-line");
+ die();
+ }
+ foreach($this->all_packages as $package => $rest)
+ {
+ if (!isset($this->pkg_elements[$package])) continue;
+ // Create class tree page
+ $template = &$this->newSmarty();
+ $template->assign("classtrees",$this->generateFormattedClassTrees($package));
+ $template->assign("package",$package);
+ $template->assign("date",date("r",time()));
+ $template->assign("title","Class Trees for Package $package");
+// $this->writefile("classtrees_$package.html",$template->fetch('classtrees.tpl'));
+ phpDocumentor_out("\n");
+ flush();
+ }
+ // free up considerable memory
+ unset($this->elements);
+ unset($this->pkg_elements);
+ }
+
+ /**
+ * This function takes an {@link abstractLink} descendant and returns an html link
+ *
+ * @param abstractLink a descendant of abstractlink should be passed, and never text
+ * @param string text to display in the link
+ * @param boolean this parameter is not used, and is deprecated
+ * @param boolean determines whether the returned text is enclosed in an &lt;a> tag
+ */
+ function returnSee(&$element, $eltext = false, $local = true, $with_a = true)
+ {
+ if (!$element) return false;
+ if (!$eltext)
+ {
+ $eltext = '';
+ switch($element->type)
+ {
+ case 'tutorial' :
+ $eltext = $element->title;
+ break;
+ case 'class' :
+ $eltext = '<classname>'.$element->name.'</classname>';
+ break;
+ case 'method' :
+ $eltext .= '<function>';
+ case 'var' :
+ if ($element->type == 'var') $eltext .= '<varname>';
+ $eltext .= $element->class.'::';
+ case 'page' :
+ case 'define' :
+ if ($element->type == 'define')
+ $eltext .= '<constant>';
+ case 'function' :
+ if ($element->type == 'function')
+ $eltext .= '<function>';
+ case 'global' :
+ default :
+ $eltext .= $element->name;
+ if ($element->type == 'function' || $element->type == 'method') $eltext .= '()</function>';
+ if ($element->type == 'var') $eltext .= '</varname>';
+ if ($element->type == 'define') $eltext .= '</constant>';
+ break;
+ }
+ }
+ $a = '';
+ if (!empty($element->subpackage))
+ {
+ $a = $element->subpackage.'.';
+ }
+ switch ($element->type)
+ {
+ case 'page' :
+ if ($with_a)
+ return '<link linkend="package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'">'.$eltext.'</link>';
+ else
+ return 'package.'.strtolower($element->package.'.'.$a).$element->fileAlias;
+ break;
+ case 'define' :
+ if ($with_a)
+ return '<link linkend="package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'.'.urlencode($element->name).'">'.$eltext.'</link>';
+ else
+ return 'package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'.'.urlencode($element->name);
+ break;
+ case 'global' :
+ if ($with_a)
+ return '<link linkend="package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'.'.urlencode($element->name).'">'.$eltext.'</link>';
+ else
+ return 'package.'.strtolower($element->package.'.'.$a).$element->fileAlias.'.'.urlencode($element->name);
+ break;
+ case 'class' :
+ if ($with_a)
+ return '<link linkend="package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name)).'">'.$eltext.'</link>';
+ else
+ return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name));
+ break;
+ case 'function' :
+ if ($with_a)
+ return '<link linkend="package.'.strtolower($element->package.'.'.$a.$element->fileAlias.'.'.str_replace('_','-',$element->name)).'">'.$eltext.'</link>';
+ else
+ return 'package.'.strtolower($element->package.'.'.$a.$element->fileAlias.'.'.str_replace('_','-',$element->name));
+ break;
+ case 'method' :
+ if ($with_a)
+ return '<link linkend="package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.str_replace('_','-',$element->name)).'">'.$eltext.'</link>';
+ else
+ return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.str_replace('_','-',$element->name));
+ break;
+ case 'var' :
+ if ($with_a)
+ return '<link linkend="package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.$element->name).'">'.$eltext.'</link>';
+ else
+ return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.$element->name);
+ break;
+ case 'tutorial' :
+ if ($with_a)
+ return '<link linked="package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name).'-tutorial">'.$eltext).'</link>';
+ else
+ return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name)).'-tutorial';
+ }
+ }
+
+ /**
+ * Get the id value needed to allow linking
+ * @param mixed descendant of parserElement or parserData/parserPage
+ * @see parserElement, parserData, parserPage
+ * @return string the id value for this element type
+ */
+ function getId(&$el)
+ {
+ if (phpDocumentor_get_class($el) == 'parserdata')
+ {
+ $element = $this->addLink($el->parent);
+ $elp = $el->parent;
+ } else
+ {
+ $elp = $el;
+ $element = $this->addLink($el);
+ }
+ $a = '';
+ if (!empty($element->subpackage))
+ {
+ $a = $element->subpackage.'.';
+ }
+ switch ($element->type)
+ {
+ case 'page' :
+ return 'package.'.strtolower($element->package.'.'.$a.$element->fileAlias);
+ break;
+ case 'define' :
+ return 'package.'.$element->package.'.'.strtolower($a.$element->fileAlias.'.'.str_replace(array('$','_','"',"'"),array('var--','-','-','-'),$element->name));
+ break;
+ case 'global' :
+ return 'package.'.strtolower($element->package.'.'.$a.$element->fileAlias.'.'.str_replace(array('$','_','"',"'"),array('var--','-','-','-'),$element->name));
+ break;
+ case 'class' :
+ return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name));
+ break;
+ case 'function' :
+ return 'package.'.strtolower($element->package.'.'.$a.$element->fileAlias.'.'.str_replace('_','-',$element->name));
+ break;
+ case 'method' :
+ return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.str_replace('_','-',$element->name));
+ break;
+ case 'var' :
+ return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'-summary.vars.'.str_replace(array('$','_'),array('var--','-'),$element->name));
+ break;
+ case 'tutorial' :
+ return 'package.'.strtolower($element->package.'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name)).'-tutorial';
+ break;
+ }
+ }
+
+ /**
+ * Create errors.html template file output
+ *
+ * This method takes all parsing errors and warnings and spits them out ordered by file and line number.
+ * @global ErrorTracker We'll be using it's output facility
+ */
+ function ConvertErrorLog()
+ {
+ global $phpDocumentor_errors;
+ $allfiles = array();
+ $files = array();
+ $warnings = $phpDocumentor_errors->returnWarnings();
+ $errors = $phpDocumentor_errors->returnErrors();
+ $template = &$this->newSmarty();
+ foreach($warnings as $warning)
+ {
+ $file = '##none';
+ $linenum = 'Warning';
+ if ($warning->file)
+ {
+ $file = $warning->file;
+ $allfiles[$file] = 1;
+ $linenum .= ' on line '.$warning->linenum;
+ }
+ $files[$file]['warnings'][] = array('name' => $linenum, 'listing' => $warning->data);
+ }
+ foreach($errors as $error)
+ {
+ $file = '##none';
+ $linenum = 'Error';
+ if ($error->file)
+ {
+ $file = $error->file;
+ $allfiles[$file] = 1;
+ $linenum .= ' on line '.$error->linenum;
+ }
+ $files[$file]['errors'][] = array('name' => $linenum, 'listing' => $error->data);
+ }
+ $i=1;
+ $af = array();
+ foreach($allfiles as $file => $num)
+ {
+ $af[$i++] = $file;
+ }
+ $allfiles = $af;
+ usort($allfiles,'strnatcasecmp');
+ $allfiles[0] = "Post-parsing";
+ foreach($allfiles as $i => $a)
+ {
+ $allfiles[$i] = array('file' => $a);
+ }
+ $out = array();
+ foreach($files as $file => $data)
+ {
+ if ($file == '##none') $file = 'Post-parsing';
+ $out[$file] = $data;
+ }
+ $template->assign("files",$allfiles);
+ $template->assign("all",$out);
+ $template->assign("title","phpDocumentor Parser Errors and Warnings");
+ $this->setTargetDir($this->base_dir);
+ $this->writefile("errors.html",$template->fetch('errors.tpl'));
+ unset($template);
+ phpDocumentor_out("\n\nTo view errors and warnings, look at ".$this->base_dir. PATH_DELIMITER . "errors.html\n");
+ flush();
+ }
+
+ function postProcess($text)
+ {
+ return htmlentities($text);
+ }
+
+ function prepareDocBlock(&$element, $nopackage = true)
+ {
+ return parent::prepareDocBlock($element, array('staticvar' => 'staticvar','deprec' => 'deprecated','abstract' => 'abstract','TODO' => 'todo', 'uses' => 'see', 'usedby' => 'see', 'tutorial' => 'see'), $nopackage);
+ }
+
+ function getTutorialId($package,$subpackage,$tutorial,$id)
+ {
+ $subpackage = (empty($subpackage) ? '' : '.'.$subpackage);
+ $id = (empty($id) ? '' : '.'.$id);
+ return 'package.'.strtolower($package.$subpackage.str_replace(array('_','.'),array('-','--'),$tutorial).$id);
+ }
+
+ function getCData($value)
+ {
+ return '<!CDATA['.$value.']]>';
+ }
+
+ /**
+ * Converts package page and sets its package as used in {@link $package_pages}
+ * @param parserPackagePage
+ */
+ function convertPackagePage(&$element)
+ {
+ return;
+ phpDocumentor_out("\n");
+ flush();
+ $template = &$this->newSmarty();
+ $this->package = $element->package;
+ $this->subpackage = '';
+ $template->assign("compiledclassindex",$this->getClassLeft());
+ $template->assign("compiledfileindex",$this->getPageLeft());
+ $template->assign("date",date("r",time()));
+ $template->assign("title",$this->title);
+ $template->assign("package",$element->package);
+ $x = $element->Convert($this);
+ $x = substr($x,strpos($x,'<body'));
+ $template->assign("contents",trim(substr($x,strpos($x,'>') + 1)));
+ phpDocumentor_out("\n");
+ flush();
+ $this->setTargetDir($this->base_dir);
+// $this->writefile("li_".$element->package.".html",$template->fetch('index.tpl'));
+ unset($template);
+ $this->package_pages[$element->package] = trim(substr($x,strpos($x,'>') + 1));
+ }
+
+ function convertTutorial(&$element)
+ {
+ $template = &parent::convertTutorial($element);
+ phpDocumentor_out("\n");
+ flush();
+ $x = $element->Convert($this,false);
+ if ($element->ini)
+ { // add child tutorial list to the tutorial through a slight hack :)
+ $subtutorials = '';
+ $b = '';
+ if (!empty($element->subpackage)) $b = '.'.$element->subpackage;
+ foreach($element->ini['Linked Tutorials'] as $child)
+ {
+ $subtutorials .= ' &'.$element->package.$b.'.'.str_replace(array('_','.'),array('-','--'),$child).'-'.$element->tutorial_type."-tutorial;\n";
+ }
+ $x = str_replace('</refsect1></refentry>','</refsect1>
+ <refsect1>
+ <title>Related Docs</title>
+ <para>
+'.$subtutorials.
+' </para>
+ </refsect1></refentry>',$x);
+ }
+ $template->assign('contents',$x);
+ $contents = $template->fetch('tutorial.tpl');
+ $a = '';
+ if ($element->subpackage) $a = PATH_DELIMITER . $element->subpackage;
+ phpDocumentor_out("\n");
+ flush();
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($element->package . $a));
+ $this->writeFile(str_replace(array('_','.'),array('-','--'),strtolower($element->name)).'-tutorial.xml',$contents);
+ }
+
+ /**
+ * Converts class variables for template output.
+ * @see prepareDocBlock(), getFormattedOverrides()
+ * @param parserVar
+ */
+ function convertVar(&$element)
+ {
+ $docblock = $this->prepareDocBlock($element);
+ $b = 'mixed';
+ if ($element->docblock->var)
+ {
+ $b = $element->docblock->var->converted_returnType;
+ }
+// var_dump($this->getFormattedOverrides($element));
+ if (isset($this->template_options['separatepage']) && $this->template_options['separatepage'])
+ $this->class_summary->append('vars',array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'var_name' => $this->type_adjust($element->getName()),
+ 'var_default' => htmlspecialchars($element->getValue()),
+ 'var_type' => $b,
+ 'var_overrides' => $this->getFormattedOverrides($element),
+ 'line_number' => $element->getLineNumber(),
+ 'id' => $this->getId($element)));
+ else
+ $this->class_data->append('vars',array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'var_name' => $this->type_adjust($element->getName()),
+ 'var_default' => htmlspecialchars($element->getValue()),
+ 'var_type' => $b,
+ 'var_overrides' => $this->getFormattedOverrides($element),
+ 'line_number' => $element->getLineNumber(),
+ 'id' => $this->getId($element)));
+ }
+
+ /**
+ * Converts class for template output
+ * @see prepareDocBlock(), generateChildClassList(), generateFormattedClassTree(), getFormattedConflicts()
+ * @see getFormattedInheritedMethods(), getFormattedInheritedVars()
+ * @param parserClass
+ */
+ function convertClass(&$element)
+ {
+ parent::convertClass($element);
+ $docblock = $this->prepareDocBlock($element);
+ $this->class_dir = $element->docblock->package;
+ if (!empty($element->docblock->subpackage)) $this->class_dir .= PATH_DELIMITER . $element->docblock->subpackage;
+ $docblock = $this->prepareDocBlock($element,false);
+
+ $this->class_data->assign("sdesc",$docblock['sdesc']);
+ $this->class_data->assign("desc",$docblock['desc']);
+ $this->class_data->assign("tags",$docblock['tags']);
+
+ $this->class_data->assign("source_location",$element->getSourceLocation($this,$this->template_options['usepear']));
+ $this->class_data->assign("id",$this->getId($element));
+ $this->class_data->assign("method_ids",array());
+ if ($t = $element->getTutorial())
+ {
+ $this->class_data->append("method_ids",$this->getId($t));
+ }
+
+ if (isset($this->template_options['separatepage']) && $this->template_options['separatepage'])
+ {
+ $this->class_summary = &$this->newSmarty(true);
+ if ($t = $element->getTutorial())
+ {
+ $this->class_summary->assign("tutorial",$this->returnSee($t));
+ }
+
+ $this->class_summary->assign("class_name",$this->type_adjust($element->getName()));
+ $this->class_summary->assign("sdesc",$docblock['sdesc']);
+ $this->class_summary->assign("desc",$docblock['desc']);
+ $this->class_summary->assign("tags",$docblock['tags']);
+ $this->class_summary->assign("vars",array());
+ $this->class_summary->assign("methods",array());
+ $this->class_summary->assign("package",$element->docblock->package);
+
+ $this->class_summary->assign("children", $this->generateChildClassList($element));
+ $this->class_summary->assign("class_tree", $this->generateFormattedClassTree($element));
+ $this->class_summary->assign("conflicts", $this->getFormattedConflicts($element,"classes"));
+
+ $this->class_summary->assign("source_location",$element->getSourceLocation($this,$this->template_options['usepear']));
+ $this->class_summary->assign("id",$this->getId($element).'-summary');
+ $this->class_data->append("method_ids",$this->getId($element).'.'.strtolower(str_replace('_','-',$element->getName())).'-summary');
+ $inherited_methods = $this->getFormattedInheritedMethods($element);
+ if (!empty($inherited_methods))
+ {
+ $this->class_summary->assign("imethods",$inherited_methods);
+ }
+ $inherited_vars = $this->getFormattedInheritedVars($element);
+ if (!empty($inherited_vars))
+ {
+ $this->class_summary->assign("ivars",$inherited_vars);
+ }
+ }
+ $this->sourceloc = $element->getSourceLocation($this,$this->template_options['usepear']);
+ }
+
+ /**
+ * Converts method for template output
+ * @see prepareDocBlock(), parserMethod::getFunctionCall(), getFormattedDescMethods(), getFormattedOverrides()
+ * @param parserMethod
+ */
+ function convertMethod(&$element)
+ {
+ $fname = $element->getName();
+ if ($element->isConstructor)
+ {
+ $fname = 'constructor '.$element->getName();
+ }
+ $docblock = $this->prepareDocBlock($element);
+ $returntype = 'void';
+ if ($element->docblock->return)
+ {
+ $a = $element->docblock->return->Convert($this);
+ $returntype = $element->docblock->return->converted_returnType;
+ if ($returntype != $element->docblock->return->returnType)
+ {
+ $returntype = "<replaceable>$returntype</replaceable>";
+ }
+ }
+ $params = array();
+ if (count($element->docblock->params))
+ foreach($element->docblock->params as $param => $val)
+ {
+ $a = $val->Convert($this);
+ $params[$param] = array("var" => $param,"datatype" => $val->converted_returnType,"data" => $a);
+ }
+
+ if (isset($this->template_options['separatepage']) && $this->template_options['separatepage'])
+ {
+ $this->class_data->append('method_ids',$this->getId($element));
+ $this->class_summary->append('methods',array('id' => $this->getId($element),
+ 'sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'is_constructor' => $element->isConstructor,
+ 'function_name' => $element->getName(),
+ 'function_return' => $returntype,
+ 'function_call' => $element->getIntricateFunctionCall($this,$params),
+ 'descmethod' => $this->getFormattedDescMethods($element),
+ 'method_overrides' => $this->getFormattedOverrides($element),
+ 'line_number' => $element->getLineNumber(),
+ 'params' => $params));
+ } else
+ {
+ $this->class_data->append('method_ids',$this->getId($element));
+ $this->class_data->append('methods',array('id' => $this->getId($element),
+ 'sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'is_constructor' => $element->isConstructor,
+ 'function_name' => $element->getName(),
+ 'function_return' => $returntype,
+ 'function_call' => $element->getIntricateFunctionCall($this,$params),
+ 'descmethod' => $this->getFormattedDescMethods($element),
+ 'method_overrides' => $this->getFormattedOverrides($element),
+ 'line_number' => $element->getLineNumber(),
+ 'params' => $params));
+ }
+ if (!isset($this->method_data)) $this->method_data = array();
+ $this->method_data[$i = count($this->method_data) - 1][0] = $this->newSmarty(true);
+ $this->method_data[$i][1] = $element->getName();
+ $this->method_data[$i][0]->assign('class',$this->class);
+ $this->method_data[$i][0]->assign('source_location',$this->returnSee($this->getLink(basename($this->curpage->getFile())),$this->sourceloc));
+ $this->method_data[$i][0]->assign('sdesc',$docblock['sdesc']);
+ $this->method_data[$i][0]->assign('desc',$docblock['desc']);
+ $this->method_data[$i][0]->assign('tags',$docblock['tags']);
+ $this->method_data[$i][0]->assign('function_name',$fname);
+ $this->method_data[$i][0]->assign('function_return',$returntype);
+ $this->method_data[$i][0]->assign('function_call',$element->getIntricateFunctionCall($this,$params));
+ $this->method_data[$i][0]->assign('descmethod',$this->getFormattedDescMethods($element));
+ $this->method_data[$i][0]->assign('method_overrides',$this->getFormattedOverrides($element));
+ $this->method_data[$i][0]->assign('params',$params);
+ $this->method_data[$i][0]->assign('id',$this->getId($element));
+ }
+
+ /**
+ * Converts function for template output
+ * @see prepareDocBlock(), parserFunction::getFunctionCall(), getFormattedConflicts()
+ * @param parserFunction
+ */
+ function convertFunction(&$element)
+ {
+ parent::convertFunction($element);
+ $docblock = $this->prepareDocBlock($element);
+ $fname = $element->getName();
+ $params = array();
+ if (count($element->docblock->params))
+ foreach($element->docblock->params as $param => $val)
+ {
+ $a = $val->Convert($this);
+ $params[$param] = array("var" => $param,"datatype" => $val->converted_returnType,"data" => $a);
+ }
+ $returntype = 'void';
+ if ($element->docblock->return)
+ {
+ $a = $element->docblock->return->Convert($this);
+ $returntype = $element->docblock->return->converted_returnType;
+ }
+
+ $this->page_data->append("function_ids",$this->getId($element));
+ $this->page_summary->append("function_ids",$this->getId($element));
+ $this->page_summary->append('functions',array('id' => $this->getId($element),
+ 'sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'function_name' => $element->getName(),
+ 'line_number' => $element->getLineNumber(),
+ 'function_return' => $returntype,
+ 'function_call' => $element->getIntricateFunctionCall($this,$params),
+ 'function_conflicts' => $this->getFormattedConflicts($element,'functions'),
+ 'params' => $params));
+ $this->function_data[$i = count($this->function_data) - 1][0] = $this->newSmarty(true);
+ $this->function_data[$i][1] = $element->getName();
+ $this->function_data[$i][0]->assign('sdesc',$docblock['sdesc']);
+ $this->function_data[$i][0]->assign('desc',$docblock['desc']);
+ $this->function_data[$i][0]->assign('tags',$docblock['tags']);
+ $this->function_data[$i][0]->assign('function_name',$fname);
+ $this->function_data[$i][0]->assign('line_number',$element->getLineNumber());
+ $this->function_data[$i][0]->assign('function_return',$returntype);
+ $this->function_data[$i][0]->assign('function_call',$element->getIntricateFunctionCall($this,$params));
+ $this->function_data[$i][0]->assign('function_conflicts',$this->getFormattedConflicts($element,"functions"));
+ $this->function_data[$i][0]->assign('params',$params);
+ $this->function_data[$i][0]->assign('source_location',$this->returnSee($this->getLink(basename($this->curpage->getFile())),$this->sourceloc));
+ $this->function_data[$i][0]->assign('id',$this->getId($element));
+ }
+
+ /**
+ * Converts include elements for template output
+ * @see prepareDocBlock()
+ * @param parserInclude
+ */
+ function convertInclude(&$element)
+ {
+ parent::convertInclude($element, array('include_file' => '-'.strtr($element->getValue(),array('"' => '', "'" => '','.' => '-'))));
+ $this->page_summary->append('includes',array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'utags' => $docblock['utags'],
+ 'include_name' => $element->getName(),
+ 'include_value' => $per,
+ 'line_number' => $element->getLineNumber(),
+ 'include_file' => '-'.strtr($element->getValue(),array('"' => '', "'" => '','.' => '-'))));
+ }
+
+ /**
+ * Converts defines for template output
+ * @see prepareDocBlock(), getFormattedConflicts()
+ * @param parserDefine
+ */
+ function convertDefine(&$element)
+ {
+ $docblock = $this->prepareDocBlock($element);
+ parent::convertDefine($element, array('link' => urlencode($element->getName())));
+ $this->page_summary->append('defines',array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'name' => $element->getName(),
+ 'value' => $element->getValue(),
+ 'conflicts' => $this->getFormattedConflicts($element,"defines"),
+ 'line_number' => $element->getLineNumber(),
+ 'id' => $this->getId($element)));
+ }
+
+ /**
+ * Converts global variables for template output
+ * @param parserGlobal
+ * @see prepareDocBlock(), getFormattedConflicts()
+ */
+ function convertGlobal(&$element)
+ {
+ parent::convertGlobal($element, array('id' => $this->getId($element)));
+ $docblock = $this->prepareDocBlock($element);
+ $value = $this->getGlobalValue($element->getValue());
+ $this->page_summary->append('globals',array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'name' => $element->getName(),
+ 'link' => urlencode($element->getName()),
+ 'value' => $value,
+ 'type' => $element->getDataType($this),
+ 'line_number' => $element->getLineNumber(),
+ 'conflicts' => $this->getFormattedConflicts($element,"global variables"),
+ 'id' => $this->getId($element)));
+ }
+
+ /**
+ * converts procedural pages for template output
+ * @see prepareDocBlock(), getClassesOnPage()
+ * @param parserData
+ */
+ function convertPage(&$element)
+ {
+ parent::convertPage($element);
+ $this->juststarted = true;
+ $this->page_dir = $element->parent->package;
+ if (!empty($element->parent->subpackage)) $this->page_dir .= PATH_DELIMITER . $element->parent->subpackage;
+ // registering stuff on the template
+ $this->page_data->assign("source_location",$element->parent->getSourceLocation($this,$this->template_options['usepear']));
+ $this->page_data->assign("function_ids",array());
+ if ($t = $element->getTutorial())
+ {
+ $this->page_data->append("function_ids",$this->getId($t));
+ }
+
+ $this->sourceloc = $element->parent->getSourceLocation($this,$this->template_options['usepear']);
+ $this->page_data->assign("id", $this->getId($element));
+ if (isset($this->template_options['separatepage']) && $this->template_options['separatepage'])
+ {
+ $this->page_summary = new Smarty;
+ $this->page_summary->template_dir = $this->smarty_dir . PATH_DELIMITER . 'templates';
+ $this->page_summary->compile_dir = $this->smarty_dir . PATH_DELIMITER . 'templates_c';
+ $this->page_summary->config_dir = $this->smarty_dir . PATH_DELIMITER . 'configs';
+ // registering stuff on the template
+ $this->page_summary->assign("source_location",$element->parent->getSourceLocation($this,$this->template_options['usepear']));
+ $this->page_summary->assign("date",date("r",time()));
+ $this->page_summary->assign("functions",array());
+ $this->page_summary->assign("includes",array());
+ $this->page_summary->assign("defines",array());
+ $this->page_summary->assign("globals",array());
+ $this->page_summary->assign("classes",$this->getClassesOnPage($element));
+ $this->page_summary->assign("name",$element->parent->getFile());
+ $this->page_summary->assign("function_ids",array());
+ if ($element->docblock)
+ {
+ $docblock = $this->prepareDocBlock($element, false);
+ $this->page_summary->assign("sdesc",$docblock['sdesc']);
+ $this->page_summary->assign("desc",$docblock['desc']);
+ $this->page_summary->assign("tags",$docblock['tags']);
+ $this->page_summary->assign("utags",$docblock['utags']);
+ }
+ $this->sourceloc = $element->parent->getSourceLocation($this,$this->template_options['usepear']);
+ $this->page_summary->assign("name", $element->parent->getFile());
+ $this->page_summary->assign("id", $this->getId($element).'.'.$this->getPageName($element->parent).'-summary');
+ $this->page_data->append("function_ids",$this->getId($element).'.'.strtolower($this->getPageName($element->parent)).'-summary');
+ }
+ }
+
+ function getPageName(&$element)
+ {
+ return str_replace(array('/','_','.'),array('-','-','---'),$element->getSourceLocation($this,$this->template_options['usepear']));
+ }
+
+ /**
+ * returns an array containing the class inheritance tree from the root object to the class
+ *
+ * @param parserClass class variable
+ * @return array Format: array(root,child,child,child,...,$class)
+ * @uses parserClass::getParentClassTree()
+ */
+
+ function generateFormattedClassTree($class)
+ {
+ $tree = $class->getParentClassTree($this);
+ $out = '';
+ if (count($tree) - 1)
+ {
+ $result = array($class->getName());
+ $parent = $tree[$class->getName()];
+ while ($parent)
+ {
+ $subpackage = $parent->docblock->subpackage;
+ $package = $parent->docblock->package;
+ $x = $parent;
+ if (is_object($parent))
+ $x = $parent->getLink($this);
+ if (!$x) $x = $parent->getName();
+ $result[] =
+ $x;
+ if (is_object($parent))
+ $parent = $tree[$parent->getName()];
+ elseif (isset($tree[$parent]))
+ $parent = $tree[$parent];
+ }
+ return array_reverse($result);
+ } else
+ {
+ return array($class->getName());
+ }
+ }
+
+ /** @access private */
+ function sortVar($a, $b)
+ {
+ return strnatcasecmp($a->getName(),$b->getName());
+ }
+
+ /** @access private */
+ function sortMethod($a, $b)
+ {
+ if ($a->isConstructor) return -1;
+ if ($b->isConstructor) return 1;
+ return strnatcasecmp($a->getName(),$b->getName());
+ }
+
+ /**
+ * returns a template-enabled array of class trees
+ *
+ * @param string $package package to generate a class tree for
+ * @see $roots, HTMLConverter::getRootTree()
+ */
+ function generateFormattedClassTrees($package)
+ {
+ if (!isset($this->roots[$package])) return array();
+ $roots = $trees = array();
+ $roots = $this->roots[$package];
+ for($i=0;$i<count($roots);$i++)
+ {
+ $trees[] = array('class' => $roots[$i],'class_tree' => "<ul>\n".$this->getRootTree($this->getSortedClassTreeFromClass($roots[$i],$package,''),$package)."</ul>\n");
+ }
+ return $trees;
+ }
+
+ /**
+ * return formatted class tree for the Class Trees page
+ *
+ * @param array $tree output from {@link getSortedClassTreeFromClass()}
+ * @see Classes::$definitechild, generateFormattedClassTrees()
+ * @return string
+ */
+ function getRootTree($tree,$package)
+ {
+ if (!$tree) return '';
+ $my_tree = '';
+ $cur = '#root';
+ $lastcur = array(false);
+ $kids = array();
+ $dopar = false;
+ if ($tree[$cur]['parent'])
+ {
+ $dopar = true;
+ if (!is_object($tree[$cur]['parent']))
+ {
+// debug("parent ".$tree[$cur]['parent']." not found");
+ $my_tree .= '<listitem>' . $tree[$cur]['parent'] .'<itemizedlist>';
+ }
+ else
+ {
+// debug("parent ".$this->returnSee($tree[$cur]['parent'], false, false)." in other package");
+ $my_tree .= '<listitem>' . $this->returnSee($tree[$cur]['parent'], false, false);
+ if ($tree[$cur]['parent']->package != $package) $my_tree .= ' <emphasis>(Different package)</emphasis><itemizedlist>';
+ }
+ }
+ do
+ {
+// fancy_debug($cur,$lastcur,$kids);
+ if (count($tree[$cur]['children']))
+ {
+// debug("$cur has children");
+ if (!isset($kids[$cur]))
+ {
+// debug("set $cur kids");
+ $kids[$cur] = 1;
+ $my_tree .= '<listitem>'.$this->returnSee($tree[$cur]['link'], false, false);
+ $my_tree .= '<itemizedlist>'."\n";
+ }
+ array_push($lastcur,$cur);
+ list(,$cur) = each($tree[$cur]['children']);
+// var_dump('listed',$cur);
+ if ($cur)
+ {
+ $cur = $cur['package'] . '#' . $cur['class'];
+// debug("set cur to child $cur");
+// $my_tree .= '<li>'.$this->returnSee($tree[$cur]['link'], false, false);
+ continue;
+ } else
+ {
+// debug("end of children for $cur");
+ $cur = array_pop($lastcur);
+ $cur = array_pop($lastcur);
+ $my_tree .= '</itemizedlist></listitem>'."\n";
+ if ($dopar && ($cur == '#root' || !$cur)) $my_tree .= '</itemizedlist></listitem>';
+ }
+ } else
+ {
+// debug("$cur has no children");
+ $my_tree .= '<listitem>'.$this->returnSee($tree[$cur]['link'], false, false)."</listitem>";
+ if ($dopar && $cur == '#root') $my_tree .= '</itemizedlist></listitem>';
+ $cur = array_pop($lastcur);
+ }
+ } while ($cur);
+ return $my_tree;
+ }
+ /**
+ * Generate alphabetical index of all elements
+ *
+ * @see $elements, walk()
+ */
+ function generateElementIndex()
+ {
+ $elementindex = array();
+ $letters = array();
+ $i = 0;
+ foreach($this->elements as $letter => $nutoh)
+ {
+ $letters[]['letter'] = $letter;
+ $elindex['letter'] = $letter;
+ foreach($this->elements[$letter] as $i => $yuh)
+ {
+ switch($this->elements[$letter][$i]->type)
+ {
+ case 'class':
+ $aa = '';
+ $aa = $this->elements[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $this->elements[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$this->elements[$letter][$i]->file.', class '.$this->getClassLink($this->elements[$letter][$i]->getName(),
+ $this->elements[$letter][$i]->docblock->package,
+ $this->elements[$letter][$i]->getPath(),
+ $this->elements[$letter][$i]->getName()
+ , false
+ , true);
+ $oo['sdesc'] = "$aa";
+ $elindex['index'][] = $oo;
+ break;
+ case 'define':
+ $aa = '';
+ $aa = $this->elements[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $this->elements[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$this->elements[$letter][$i]->file.', constant '.$this->getDefineLink($this->elements[$letter][$i]->getName(),
+ $this->elements[$letter][$i]->docblock->package,
+ $this->elements[$letter][$i]->getPath(),
+ $this->elements[$letter][$i]->getName()
+ , false);
+ $oo['sdesc'] = "$aa";
+ $elindex['index'][] = $oo;
+ break;
+ case 'global':
+ $aa = '';
+ $aa = $this->elements[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $this->elements[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$this->elements[$letter][$i]->file.', global variable '.$this->getGlobalLink($this->elements[$letter][$i]->getName(),
+ $this->elements[$letter][$i]->docblock->package,
+ $this->elements[$letter][$i]->getPath(),
+ $this->elements[$letter][$i]->getName()
+ , false);
+ $oo['sdesc'] = "$aa";
+ $elindex['index'][] = $oo;
+ break;
+ case 'function':
+ $aa = '';
+ $aa = $this->elements[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $this->elements[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$this->elements[$letter][$i]->file.', function '.$this->getFunctionLink($this->elements[$letter][$i]->getName(),
+ $this->elements[$letter][$i]->docblock->package,
+ $this->elements[$letter][$i]->getPath(),
+ $this->elements[$letter][$i]->getName().'()'
+ , false);
+ $oo['sdesc'] = "$aa";
+ $elindex['index'][] = $oo;
+ break;
+ case 'method':
+ $aa = '';
+ $aa = $this->elements[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $this->elements[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$this->elements[$letter][$i]->file.', method '.$this->getMethodLink($this->elements[$letter][$i]->getName(),
+ $this->elements[$letter][$i]->class,
+ $this->elements[$letter][$i]->docblock->package,
+ $this->elements[$letter][$i]->getPath(),
+ $this->elements[$letter][$i]->class.'::'.$this->elements[$letter][$i]->getName().'()'
+ , false);
+ $oo['sdesc'] = "$aa";
+ $elindex['index'][] = $oo;
+ break;
+ case 'var':
+ $aa = '';
+ $aa = $this->elements[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $this->elements[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$this->elements[$letter][$i]->file.', variable '.$this->getVarLink($this->elements[$letter][$i]->getName(),
+ $this->elements[$letter][$i]->class,
+ $this->elements[$letter][$i]->docblock->package,
+ $this->elements[$letter][$i]->getPath(),
+ $this->elements[$letter][$i]->class.'::'.$this->elements[$letter][$i]->getName()
+ , false);
+ $oo['sdesc'] = "$aa";
+ $elindex['index'][] = $oo;
+ break;
+ case 'page':
+ $oo['name'] = $this->elements[$letter][$i]->getFile();
+ $oo['listing'] =
+ 'procedural page '.$this->getPageLink($this->elements[$letter][$i]->getFile(),
+ $this->elements[$letter][$i]->package,
+ $this->elements[$letter][$i]->getPath(),
+ $this->elements[$letter][$i]->getFile()
+ , false);
+ $elindex['index'][] = $oo;
+ break;
+ }
+ }
+ if (isset($elindex['index']))
+ {
+ $elementindex[] = $elindex;
+ } else
+ {
+ unset($letters[count($letters) - 1]);
+ }
+ $elindex = array();
+ }
+ return array($elementindex,$letters);
+ }
+
+ function setTemplateDir($dir)
+ {
+ Converter::setTemplateDir($dir);
+ $this->smarty_dir = $this->templateDir;
+ }
+
+ /**
+ * calls the converter setTargetDir, and then copies any template images and the stylesheet if they haven't been copied
+ * @see Converter::setTargetDir()
+ */
+ function setTargetDir($dir)
+ {
+ Converter::setTargetDir($dir);
+ static $wrote = false;
+ if ($wrote) return;
+ $wrote = true;
+ $template_images = array();
+ $stylesheets = array();
+ $dir = $this->templateDir;
+ $this->templateDir = $this->templateDir.'templates/';
+ $d = dir($this->templateDir);
+ $template_images = array();
+ while($entry = $d->read())
+ {
+ $sp = explode(".", $entry);
+ if ( preg_match("/\.(gif|jpg|png)$/i", $entry) )
+ {
+ $template_images[] = $entry;
+ }
+ }
+ $d = dir($this->templateDir);
+ while($entry = $d->read())
+ {
+ $sp = explode(".", $entry);
+ if ( preg_match("/\.css$/i", $entry) )
+ {
+ $stylesheets[] = $entry;
+ }
+ }
+ phpDocumentor_out("Copying Any Stylesheets\n");
+ flush();
+ foreach($stylesheets as $image)
+ {
+ if (file_exists($this->templateDir.$image))
+ {
+ phpDocumentor_out("Writing $image\n");
+ flush();
+ $this->copyFile($image);
+ }
+ }
+ phpDocumentor_out("Copying Any Template Images\n");
+ flush();
+ foreach($template_images as $image)
+ {
+ if (file_exists($this->templateDir.$image))
+ {
+ phpDocumentor_out("Writing $image\n");
+ flush();
+ $this->copyFile($image);
+ }
+ }
+ $this->templateDir = $dir;
+ }
+
+ /**
+ * Generate alphabetical index of all elements by package and subpackage
+ *
+ * @param string $package name of a package
+ * @see $pkg_elements, walk(), generatePkgElementIndexes()
+ */
+ function generatePkgElementIndex($package)
+ {
+ $elementindex = array();
+ $letters = array();
+ $letterind = array();
+ $used = array();
+ $subp = '';
+ foreach($this->pkg_elements[$package] as $subpackage => $els)
+ {
+ if (empty($els)) continue;
+ foreach($els as $letter => $yuh)
+ {
+ if (!isset($used[$letter]))
+ {
+ $letters[]['letter'] = $letter;
+ $letterind[$letter] = count($letters) - 1;
+ $used[$letter] = 1;
+ }
+ $elindex[$letter]['letter'] = $letter;
+ foreach($els[$letter] as $i => $yuh)
+ {
+ switch($els[$letter][$i]->type)
+ {
+ case 'class':
+ $aa = '';
+ $aa = $els[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $els[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$els[$letter][$i]->file.', class '.$this->getClassLink($els[$letter][$i]->getName(),
+ $els[$letter][$i]->docblock->package,
+ $els[$letter][$i]->getPath(),
+ $els[$letter][$i]->getName()
+ , false
+ , true);
+ $oo['subpackage'] = $subpackage;
+ $oo['sdesc'] = $aa;
+ $elindex[$letter]['index'][] = $oo;
+ break;
+ case 'define':
+ $aa = $els[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $els[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$els[$letter][$i]->file.', constant '.$this->getDefineLink($els[$letter][$i]->getName(),
+ $els[$letter][$i]->docblock->package,
+ $els[$letter][$i]->getPath(),
+ $els[$letter][$i]->getName()
+ , false);
+ $oo['subpackage'] = $subpackage;
+ $oo['sdesc'] = $aa;
+ $elindex[$letter]['index'][] = $oo;
+ break;
+ case 'global':
+ $aa = $els[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $els[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$els[$letter][$i]->file.', global variable '.$this->getGlobalLink($els[$letter][$i]->getName(),
+ $els[$letter][$i]->docblock->package,
+ $els[$letter][$i]->getPath(),
+ $els[$letter][$i]->getName()
+ ,false);
+ $oo['subpackage'] = $subpackage;
+ $oo['sdesc'] = $aa;
+ $elindex[$letter]['index'][] = $oo;
+ break;
+ case 'function':
+ $aa = $els[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $els[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$els[$letter][$i]->file.', function '.$this->getFunctionLink($els[$letter][$i]->getName(),
+ $els[$letter][$i]->docblock->package,
+ $els[$letter][$i]->getPath(),
+ $els[$letter][$i]->getName().'()'
+ , false);
+ $oo['subpackage'] = $subpackage;
+ $oo['sdesc'] = $aa;
+ $elindex[$letter]['index'][] = $oo;
+ break;
+ case 'method':
+ $aa = $els[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $els[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$els[$letter][$i]->file.', method '.$this->getMethodLink($els[$letter][$i]->getName(),
+ $els[$letter][$i]->class,
+ $els[$letter][$i]->docblock->package,
+ $els[$letter][$i]->getPath(),
+ $els[$letter][$i]->class.'::'.$els[$letter][$i]->getName().'()'
+ , false);
+ $oo['subpackage'] = $subpackage;
+ $oo['sdesc'] = $aa;
+ $elindex[$letter]['index'][] = $oo;
+ break;
+ case 'var':
+ $aa = $els[$letter][$i]->docblock->getSDesc($this);
+ $oo['name'] = $els[$letter][$i]->getName();
+ $oo['listing'] =
+ 'in file '.$els[$letter][$i]->file.', variable '.$this->getVarLink($els[$letter][$i]->getName(),
+ $els[$letter][$i]->class,
+ $els[$letter][$i]->docblock->package,
+ $els[$letter][$i]->getPath(),
+ $els[$letter][$i]->class.'::'.$els[$letter][$i]->getName()
+ , false);
+ $oo['subpackage'] = $subpackage;
+ $oo['sdesc'] = $aa;
+ $elindex[$letter]['index'][] = $oo;
+ break;
+ case 'page':
+ $oo['name'] = $els[$letter][$i]->getFile();
+ $oo['listing'] =
+ 'procedural page '.$this->getPageLink($els[$letter][$i]->getFile(),
+ $els[$letter][$i]->package,
+ $els[$letter][$i]->getPath(),
+ $els[$letter][$i]->getFile()
+ , false);
+ $oo['subpackage'] = $subpackage;
+ $elindex[$letter]['index'][] = $oo;
+ break;
+ }
+ }
+ }
+ }
+ ksort($elindex);
+ usort($letters,'XMLDocBook_lettersort');
+ if (isset($elindex))
+ {
+ while(list($letter,$tempel) = each($elindex))
+ {
+ if (!isset($tempel))
+ {
+ unset($letters[$letterind[$tempel['letter']]]);
+ } else
+ $elementindex[] = $tempel;
+ }
+ } else $letters = array();
+ return array($elementindex,$letters);
+ }
+
+ /**
+ *
+ * @see generatePkgElementIndex()
+ */
+ function generatePkgElementIndexes()
+ {
+ $packages = array();
+ $package_names = array();
+ $pkg = array();
+ $letters = array();
+ foreach($this->pkg_elements as $package => $trash)
+ {
+ $pkgs['package'] = $package;
+ $pkg['package'] = $package;
+ list($pkg['pindex'],$letters[$package]) = $this->generatePkgElementIndex($package);
+ if (count($pkg['pindex']))
+ {
+ $packages[] = $pkg;
+ $package_names[] = $pkgs;
+ }
+ unset($pkgs);
+ unset($pkg);
+ }
+ foreach($packages as $i => $package)
+ {
+ $pnames = array();
+ for($j=0;$j<count($package_names);$j++)
+ {
+ if ($package_names[$j]['package'] != $package['package']) $pnames[] = $package_names[$j];
+ }
+ $packages[$i]['packageindexes'] = $pnames;
+ }
+ return array($packages,$package_names,$letters);
+ }
+
+ /**
+ * @param string name of class
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the class's documentation
+ * @see parent::getClassLink()
+ */
+ function getClassLink($expr,$package, $file = false,$text = false, $local = true, $with_a = true)
+ {
+ $a = Converter::getClassLink($expr,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local, $with_a);
+ }
+
+ /**
+ * @param string name of function
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the function's documentation
+ * @see parent::getFunctionLink()
+ */
+ function getFunctionLink($expr,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getFunctionLink($expr,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of define
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the define's documentation
+ * @see parent::getDefineLink()
+ */
+ function getDefineLink($expr,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getDefineLink($expr,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of global variable
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the global variable's documentation
+ * @see parent::getGlobalLink()
+ */
+ function getGlobalLink($expr,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getGlobalLink($expr,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of procedural page
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the procedural page's documentation
+ * @see parent::getPageLink()
+ */
+ function getPageLink($expr,$package, $path = false,$text = false, $local = true)
+ {
+ $a = Converter::getPageLink($expr,$package,$path);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of method
+ * @param string class containing method
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the method's documentation
+ * @see parent::getMethodLink()
+ */
+ function getMethodLink($expr,$class,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getMethodLink($expr,$class,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of var
+ * @param string class containing var
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the var's documentation
+ * @see parent::getVarLink()
+ */
+ function getVarLink($expr,$class,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getVarLink($expr,$class,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * does a nat case sort on the specified second level value of the array
+ *
+ * @param mixed $a
+ * @param mixed $b
+ * @return int
+ */
+ function rcNatCmp ($a, $b)
+ {
+ $aa = strtoupper($a[$this->rcnatcmpkey]);
+ $bb = strtoupper($b[$this->rcnatcmpkey]);
+
+ return strnatcasecmp($aa, $bb);
+ }
+
+ /**
+ * does a nat case sort on the specified second level value of the array.
+ * this one puts constructors first
+ *
+ * @param mixed $a
+ * @param mixed $b
+ * @return int
+ */
+ function rcNatCmp1 ($a, $b)
+ {
+ $aa = strtoupper($a[$this->rcnatcmpkey]);
+ $bb = strtoupper($b[$this->rcnatcmpkey]);
+
+ if (strpos($aa,'CONSTRUCTOR') === 0)
+ {
+ return -1;
+ }
+ if (strpos($bb,'CONSTRUCTOR') === 0)
+ {
+ return 1;
+ }
+ if (strpos($aa,strtoupper($this->class)) === 0)
+ {
+ return -1;
+ }
+ if (strpos($bb,strtoupper($this->class)) === 0)
+ {
+ return -1;
+ }
+ return strnatcasecmp($aa, $bb);
+ }
+
+ /**
+ * This function is not used by HTMLdefaultConverter, but is required by Converter
+ */
+ function Output()
+ {
+ }
+}
+
+/** @access private */
+function XMLDocBook_lettersort($a, $b)
+{
+ return strnatcasecmp($a['letter'],$b['letter']);
+}
+?>
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Beautifier.php b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Beautifier.php
new file mode 100644
index 00000000..81b2e782
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Beautifier.php
@@ -0,0 +1,135 @@
+<?PHP
+/**
+ * XML/Beautifier.php
+ *
+ * Format XML files containing unknown entities (like all of peardoc)
+ *
+ * phpDocumentor :: automatic documentation generator
+ *
+ * PHP versions 4 and 5
+ *
+ * Copyright (c) 2004-2006 Gregory Beaver
+ *
+ * LICENSE:
+ *
+ * This library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General
+ * Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any
+ * later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package phpDocumentor
+ * @subpackage Parsers
+ * @author Greg Beaver <cellog@php.net>
+ * @copyright 2004-2006 Gregory Beaver
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @version CVS: $Id: Beautifier.php 212211 2006-04-30 22:18:14Z cellog $
+ * @filesource
+ * @link http://www.phpdoc.org
+ * @link http://pear.php.net/PhpDocumentor
+ * @since 1.3.0
+ */
+
+
+/**
+ * This is just like XML_Beautifier, but uses {@link phpDocumentor_XML_Beautifier_Tokenizer}
+ * @package phpDocumentor
+ * @subpackage Parsers
+ * @since 1.3.0
+ */
+class phpDocumentor_peardoc2_XML_Beautifier extends XML_Beautifier {
+
+ /**
+ * format a file or URL
+ *
+ * @access public
+ * @param string $file filename
+ * @param mixed $newFile filename for beautified XML file (if none is given, the XML string will be returned.)
+ * if you want overwrite the original file, use XML_BEAUTIFIER_OVERWRITE
+ * @param string $renderer Renderer to use, default is the plain xml renderer
+ * @return mixed XML string of no file should be written, true if file could be written
+ * @throws PEAR_Error
+ * @uses _loadRenderer() to load the desired renderer
+ */
+ function formatFile($file, $newFile = null, $renderer = "Plain")
+ {
+ if ($this->apiVersion() != '1.0') {
+ return $this->raiseError('API version must be 1.0');
+ }
+ /**
+ * Split the document into tokens
+ * using the XML_Tokenizer
+ */
+ require_once dirname(__FILE__) . '/Tokenizer.php';
+ $tokenizer = new phpDocumentor_XML_Beautifier_Tokenizer();
+
+ $tokens = $tokenizer->tokenize( $file, true );
+
+ if (PEAR::isError($tokens)) {
+ return $tokens;
+ }
+
+ include_once dirname(__FILE__) . '/Plain.php';
+ $renderer = new PHPDoc_XML_Beautifier_Renderer_Plain($this->_options);
+
+ $xml = $renderer->serialize($tokens);
+
+ if ($newFile == null) {
+ return $xml;
+ }
+
+ $fp = @fopen($newFile, "w");
+ if (!$fp) {
+ return PEAR::raiseError("Could not write to output file", XML_BEAUTIFIER_ERROR_NO_OUTPUT_FILE);
+ }
+
+ flock($fp, LOCK_EX);
+ fwrite($fp, $xml);
+ flock($fp, LOCK_UN);
+ fclose($fp);
+ return true; }
+
+ /**
+ * format an XML string
+ *
+ * @access public
+ * @param string $string XML
+ * @return string formatted XML string
+ * @throws PEAR_Error
+ */
+ function formatString($string, $renderer = "Plain")
+ {
+ if ($this->apiVersion() != '1.0') {
+ return $this->raiseError('API version must be 1.0');
+ }
+ /**
+ * Split the document into tokens
+ * using the XML_Tokenizer
+ */
+ require_once dirname(__FILE__) . '/Tokenizer.php';
+ $tokenizer = new phpDocumentor_XML_Beautifier_Tokenizer();
+
+ $tokens = $tokenizer->tokenize( $string, false );
+
+ if (PEAR::isError($tokens)) {
+ return $tokens;
+ }
+
+ include_once dirname(__FILE__) . '/Plain.php';
+ $renderer = new PHPDoc_XML_Beautifier_Renderer_Plain($this->_options);
+
+ $xml = $renderer->serialize($tokens);
+
+ return $xml;
+ }
+}
+?> \ No newline at end of file
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Plain.php b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Plain.php
new file mode 100644
index 00000000..b99ced18
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Plain.php
@@ -0,0 +1,250 @@
+<?PHP
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+// +----------------------------------------------------------------------+
+// | PHP Version 4 |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2002 The PHP Group |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.0 of the PHP license, |
+// | that is bundled with this package in the file LICENSE, and is |
+// | available at through the world-wide-web at |
+// | http://www.php.net/license/2_02.txt. |
+// | If you did not receive a copy of the PHP license and are unable to |
+// | obtain it through the world-wide-web, please send a note to |
+// | license@php.net so we can mail you a copy immediately. |
+// +----------------------------------------------------------------------+
+// | Authors: Stephan Schmidt <schst@php.net> |
+// +----------------------------------------------------------------------+
+
+/**
+ * XML/Beautifier/Renderer/Plain.php
+ *
+ * @package XML_Beautifier
+ * @author Stephan Schmidt <schst@php.net>
+ */
+
+/**
+ * XML_Util is needed to create the tags
+ */
+require_once 'XML/Util.php';
+
+/**
+ * Renderer base class
+ */
+require_once 'XML/Beautifier/Renderer.php';
+
+/**
+ * Basic XML Renderer for XML Beautifier
+ *
+ * @package XML_Beautifier
+ * @author Stephan Schmidt <schst@php.net>
+ * @todo option to specify inline tags
+ * @todo option to specify treatment of whitespac in data sections
+ * @todo automatically create <![CDATA[ ]]> sections
+ */
+class PHPDoc_XML_Beautifier_Renderer_Plain extends XML_Beautifier_Renderer {
+
+ /**
+ * Serialize the XML tokens
+ *
+ * @access public
+ * @param array XML tokens
+ * @return string XML document
+ */
+ function serialize($tokens)
+ {
+ $tokens = $this->normalize($tokens);
+
+ $xml = '';
+ $cnt = count($tokens);
+ for($i = 0; $i < $cnt; $i++ )
+ {
+ $xml .= $this->_serializeToken($tokens[$i]);
+ }
+ return $xml;
+ }
+
+ /**
+ * serialize a token
+ *
+ * This method does the actual beautifying.
+ *
+ * @access private
+ * @param array $token structure that should be serialized
+ * @todo split this method into smaller methods
+ */
+ function _serializeToken($token)
+ {
+ switch ($token["type"]) {
+
+ /*
+ * serialize XML Element
+ */
+ case XML_BEAUTIFIER_ELEMENT:
+ $indent = $this->_getIndentString($token["depth"]);
+
+ // adjust tag case
+ if ($this->_options["caseFolding"] === true) {
+ switch ($this->_options["caseFoldingTo"]) {
+ case "uppercase":
+ $token["tagname"] = strtoupper($token["tagname"]);
+ $token["attribs"] = array_change_key_case($token["attribs"], CASE_UPPER);
+ break;
+ case "lowercase":
+ $token["tagname"] = strtolower($token["tagname"]);
+ $token["attribs"] = array_change_key_case($token["attribs"], CASE_LOWER);
+ break;
+ }
+ }
+
+ if ($this->_options["multilineTags"] == true) {
+ $attIndent = $indent . str_repeat(" ", (2+strlen($token["tagname"])));
+ } else {
+ $attIndent = null;
+ }
+ // check for children
+ switch ($token["contains"]) {
+
+ // contains only CData or is empty
+ case XML_BEAUTIFIER_CDATA:
+ case XML_BEAUTIFIER_EMPTY:
+ if (sizeof($token["children"]) >= 1) {
+ $data = $token["children"][0]["data"];
+ } else {
+ $data = '';
+ }
+
+ if( strstr( $data, "\n" ) && $token['contains'] != PHPDOC_BEAUTIFIER_CDATA)
+ {
+ $data = "\n" . $this->_indentTextBlock( $data, $token['depth']+1, true );
+ }
+
+ $xml = $indent . XML_Util::createTag($token["tagname"], $token["attribs"], $data, null, false, $this->_options["multilineTags"], $attIndent)
+ . $this->_options["linebreak"];
+ break;
+ // contains mixed content
+ default:
+ $xml = $indent . XML_Util::createStartElement($token["tagname"], $token["attribs"], null, $this->_options["multilineTags"], $attIndent)
+ . $this->_options["linebreak"];
+
+ $cnt = count($token["children"]);
+ for ($i = 0; $i < $cnt; $i++) {
+ $xml .= $this->_serializeToken($token["children"][$i]);
+ }
+ $xml .= $indent . XML_Util::createEndElement($token["tagname"])
+ . $this->_options["linebreak"];
+ break;
+ break;
+ }
+ break;
+
+ /*
+ * serialize <![CDATA
+ */
+ case PHPDOC_BEAUTIFIER_CDATA:
+ $xml = $token['data'] . $this->_options['linebreak'];
+ break;
+
+ /*
+ * serialize CData
+ */
+ case XML_BEAUTIFIER_CDATA:
+ if ($token["depth"] > 0) {
+ $xml = str_repeat($this->_options["indent"], $token["depth"]);
+ } else {
+ $xml = "";
+ }
+
+ $xml .= $token["data"] . $this->_options["linebreak"];
+ break;
+
+ /*
+ * serialize Processing instruction
+ */
+ case XML_BEAUTIFIER_PI:
+ $indent = $this->_getIndentString($token["depth"]);
+
+ $xml = $indent."<?".$token["target"].$this->_options["linebreak"]
+ . $this->_indentTextBlock(rtrim($token["data"]), $token["depth"])
+ . $indent."?>".$this->_options["linebreak"];
+ break;
+
+ /*
+ * comments
+ */
+ case XML_BEAUTIFIER_COMMENT:
+ $lines = count(explode("\n",$token["data"]));
+
+ /*
+ * normalize comment, i.e. combine it to one
+ * line and remove whitespace
+ */
+ if ($this->_options["normalizeComments"] && $lines > 1){
+ $comment = preg_replace("/\s\s+/s", " ", str_replace( "\n" , " ", $token["data"]));
+ $lines = 1;
+ } else {
+ $comment = $token["data"];
+ }
+
+ /*
+ * check for the maximum length of one line
+ */
+ if ($this->_options["maxCommentLine"] > 0) {
+ if ($lines > 1) {
+ $commentLines = explode("\n", $comment);
+ } else {
+ $commentLines = array($comment);
+ }
+
+ $comment = "";
+ for ($i = 0; $i < $lines; $i++) {
+ if (strlen($commentLines[$i]) <= $this->_options["maxCommentLine"]) {
+ $comment .= $commentLines[$i];
+ continue;
+ }
+ $comment .= wordwrap($commentLines[$i], $this->_options["maxCommentLine"] );
+ if ($i != ($lines-1)) {
+ $comment .= "\n";
+ }
+ }
+ $lines = count(explode("\n",$comment));
+ }
+
+ $indent = $this->_getIndentString($token["depth"]);
+
+ if ($lines > 1) {
+ $xml = $indent . "<!--" . $this->_options["linebreak"]
+ . $this->_indentTextBlock($comment, $token["depth"]+1, true)
+ . $indent . "-->" . $this->_options["linebreak"];
+ } else {
+ $xml = $indent . sprintf( "<!-- %s -->", trim($comment) ) . $this->_options["linebreak"];
+ }
+ break;
+
+ /*
+ * xml declaration
+ */
+ case XML_BEAUTIFIER_XML_DECLARATION:
+ $indent = $this->_getIndentString($token["depth"]);
+ $xml = $indent . XML_Util::getXMLDeclaration($token["version"], $token["encoding"], $token["standalone"]);
+ break;
+
+ /*
+ * xml declaration
+ */
+ case XML_BEAUTIFIER_DT_DECLARATION:
+ $xml = $token["data"];
+ break;
+
+ /*
+ * all other elements
+ */
+ case XML_BEAUTIFIER_DEFAULT:
+ default:
+ $xml = XML_Util::replaceEntities( $token["data"] );
+ break;
+ }
+ return $xml;
+ }
+}
+?> \ No newline at end of file
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Tokenizer.php b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Tokenizer.php
new file mode 100644
index 00000000..f1f19e9c
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/Tokenizer.php
@@ -0,0 +1,752 @@
+<?php
+/**
+ * XML/Beautifier.php
+ *
+ * Format XML files containing unknown entities (like all of peardoc)
+ *
+ * phpDocumentor :: automatic documentation generator
+ *
+ * PHP versions 4 and 5
+ *
+ * Copyright (c) 2004-2006 Gregory Beaver
+ *
+ * LICENSE:
+ *
+ * This library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General
+ * Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any
+ * later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package phpDocumentor
+ * @subpackage Parsers
+ * @author Greg Beaver <cellog@php.net>
+ * @copyright 2004-2006 Gregory Beaver
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @version CVS: $Id: Tokenizer.php 238276 2007-06-22 14:58:30Z ashnazg $
+ * @filesource
+ * @link http://www.phpdoc.org
+ * @link http://pear.php.net/PhpDocumentor
+ * @since 1.3.0
+ */
+/**
+ * From the XML_Beautifier package
+ */
+require_once 'XML/Beautifier/Tokenizer.php';
+/**
+ * Highlights source code using {@link parse()}
+ * @package phpDocumentor
+ * @subpackage Parsers
+ */
+class phpDocumentor_XML_Beautifier_Tokenizer extends XML_Beautifier_Tokenizer
+{
+ /**#@+
+ * @access private
+ */
+ var $_curthing;
+ var $_tag;
+ var $_attrs;
+ var $_attr;
+
+ /**#@-*/
+ /**
+ * @var array
+ */
+ var $eventHandlers = array(
+ PHPDOC_XMLTOKEN_EVENT_NOEVENTS => 'normalHandler',
+ PHPDOC_XMLTOKEN_EVENT_XML => 'parseXMLHandler',
+ PHPDOC_XMLTOKEN_EVENT_PI => 'parsePiHandler',
+ PHPDOC_XMLTOKEN_EVENT_ATTRIBUTE => 'attrHandler',
+ PHPDOC_XMLTOKEN_EVENT_OPENTAG => 'tagHandler',
+ PHPDOC_XMLTOKEN_EVENT_IN_CDATA => 'realcdataHandler',
+ PHPDOC_XMLTOKEN_EVENT_DEF => 'defHandler',
+ PHPDOC_XMLTOKEN_EVENT_CLOSETAG => 'closetagHandler',
+ PHPDOC_XMLTOKEN_EVENT_ENTITY => 'entityHandler',
+ PHPDOC_XMLTOKEN_EVENT_COMMENT => 'commentHandler',
+ PHPDOC_XMLTOKEN_EVENT_SINGLEQUOTE => 'stringHandler',
+ PHPDOC_XMLTOKEN_EVENT_DOUBLEQUOTE => 'stringHandler',
+ PHPDOC_XMLTOKEN_EVENT_CDATA => 'parseCdataHandler',
+ );
+
+ /**
+ * Parse a new file
+ *
+ * The parse() method is a do...while() loop that retrieves tokens one by
+ * one from the {@link $_event_stack}, and uses the token event array set up
+ * by the class constructor to call event handlers.
+ *
+ * The event handlers each process the tokens passed to them, and use the
+ * {@link _addoutput()} method to append the processed tokens to the
+ * {@link $_line} variable. The word parser calls {@link newLineNum()}
+ * every time a line is reached.
+ *
+ * In addition, the event handlers use special linking functions
+ * {@link _link()} and its cousins (_classlink(), etc.) to create in-code
+ * hyperlinks to the documentation for source code elements that are in the
+ * source code.
+ *
+ * @uses setupStates() initialize parser state variables
+ * @uses configWordParser() pass $parse_data to prepare retrieval of tokens
+ * @param string
+ * @param Converter
+ * @param false|string full path to file with @filesource tag, if this
+ * is a @filesource parse
+ * @param false|integer starting line number from {@}source linenum}
+ * @staticvar integer used for recursion limiting if a handler for
+ * an event is not found
+ * @return bool
+ */
+ function parseString ($parse_data)
+ {
+ static $endrecur = 0;
+ $parse_data = str_replace(array("\r\n", "\t"), array("\n", ' '), $parse_data);
+ $this->setupStates($parse_data);
+
+ $this->configWordParser(PHPDOC_XMLTOKEN_EVENT_NOEVENTS);
+ // initialize variables so E_ALL error_reporting doesn't complain
+ $pevent = 0;
+ $word = 0;
+ $this->_curthing = '';
+
+ do
+ {
+ $lpevent = $pevent;
+ $pevent = $this->_event_stack->getEvent();
+ if ($lpevent != $pevent)
+ {
+ $this->_last_pevent = $lpevent;
+ $this->configWordParser($pevent);
+ }
+ $this->_wp->setWhitespace(true);
+
+ $dbg_linenum = $this->_wp->linenum;
+ $dbg_pos = $this->_wp->getPos();
+ $this->_pv_last_word = $word;
+ $this->_pv_curline = $this->_wp->linenum;
+ $word = $this->_wp->getWord();
+
+ if (PHPDOCUMENTOR_DEBUG == true)
+ {
+ echo "LAST: ";
+ echo "|" . $this->_pv_last_word;
+ echo "|\n";
+ echo "PEVENT: " . $this->getParserEventName($pevent) . "\n";
+ echo "LASTPEVENT: " . $this->getParserEventName($this->_last_pevent) . "\n";
+// echo "LINE: ".$this->_line."\n";
+// echo "OUTPUT: ".$this->_output."\n";
+ echo $dbg_linenum.'-'.$dbg_pos . ": ";
+ echo '|'.htmlspecialchars($word);
+ echo "|\n";
+ echo "-------------------\n\n\n";
+ flush();
+ }
+ if (isset($this->eventHandlers[$pevent]))
+ {
+ $handle = $this->eventHandlers[$pevent];
+ $this->$handle($word, $pevent);
+ } else
+ {
+ echo ('WARNING: possible error, no handler for event number '.$pevent);
+ if ($endrecur++ == 25)
+ {
+ return $this->raiseError("FATAL ERROR, recursion limit reached");
+ }
+ }
+ } while (!($word === false));
+ return true;
+ }
+
+ /**#@+
+ * Event Handlers
+ *
+ * All Event Handlers use {@link checkEventPush()} and
+ * {@link checkEventPop()} to set up the event stack and parser state.
+ * @access private
+ * @param string|array token value
+ * @param integer parser event from {@link Parser.inc}
+ */
+ /**
+ * Most tokens only need highlighting, and this method handles them
+ */
+ function normalHandler($word, $pevent)
+ {
+ if ($this->checkEventPush($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ $this->_addoutput($pevent);
+ $this->_curthing = '';
+ return;
+ }
+ $this->_curthing .= $word;
+
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_curthing = '';
+ }
+ }
+
+ /**
+ * handle <!-- comments -->
+ */
+ function commentHandler($word, $pevent)
+ {
+ if ($this->checkEventPush($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ return;
+ }
+
+ $this->_curthing .= $word;
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_curthing = '';
+ }
+ }
+
+ /**
+ * handle <?Processor instructions?>
+ */
+ function parsePiHandler($word, $pevent)
+ {
+ if ($this->checkEventPush($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ return;
+ }
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_curthing = '';
+ $this->_attrs = null;
+ return;
+ }
+ if (!strlen($this->_curthing)) {
+ $this->_curthing .= str_replace('<?', '', $word);
+ } else {
+ if (!isset($this->_attrs) || !is_string($this->_attrs)) {
+ $this->_attrs = '';
+ }
+ $this->_attrs .= $word;
+ }
+ }
+
+ /**
+ * handle <?xml Processor instructions?>
+ */
+ function parseXMLHandler($word, $pevent)
+ {
+ if ($this->checkEventPush($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ return;
+ }
+
+ $this->_curthing .= $word;
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_curthing = '';
+ }
+ }
+
+ /**
+ * handle <![CDATA[ unescaped text ]]>
+ */
+ function realcdataHandler($word, $pevent)
+ {
+ $this->_curthing .= $word;
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_curthing = '';
+ }
+ }
+
+ /**
+ * handle <tags>
+ */
+ function tagHandler($word, $pevent)
+ {
+ if ($this->checkEventPush($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ $this->_curthing = '';
+ return;
+ }
+
+ if ($word{0} == '<') {
+ $this->_tag = substr($word, 1);
+ }
+
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_tag = null;
+ $this->_attrs = null;
+ if ($word == '>') {
+ $this->_event_stack->pushEvent(PHPDOC_XMLTOKEN_EVENT_CDATA);
+ return;
+ }
+ }
+ }
+
+ /**
+ * handle </tags>
+ */
+ function closetagHandler($word, $pevent)
+ {
+ if ($this->checkEventPush($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ return;
+ }
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_tag = '';
+ return;
+ }
+ $this->_tag = trim(str_replace('</', '', $word));
+ }
+
+ /**
+ * handle <!def>
+ */
+ function defHandler($word, $pevent)
+ {
+ if ($this->checkEventPush($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ return;
+ }
+
+ $this->_curthing .= $word;
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_curthing = '';
+ }
+ }
+
+ /**
+ * Most tokens only need highlighting, and this method handles them
+ */
+ function attrHandler($word, $pevent)
+ {
+ if ($e = $this->checkEventPush($word, $pevent)) {
+ return;
+ }
+ if (!isset($this->_attrs) || !is_array($this->_attrs)) {
+ $this->_attrs = array();
+ }
+ if (strpos($word, '=')) {
+ $this->_attrs[$this->_attr = trim(str_replace('=', '', $word))] = '';
+ }
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ return;
+ }
+ }
+
+ /**
+ * handle attribute values
+ */
+ function stringHandler($word, $pevent)
+ {
+ if ($this->checkEventPop($word, $pevent)) {
+ return;
+ }
+ $this->_attrs[$this->_attr] = $word;
+ }
+
+ /**
+ * handle &entities;
+ */
+ function entityHandler($word, $pevent)
+ {
+ if ($this->checkEventPop($word, $pevent)) {
+ $this->_addoutput($pevent);
+ $this->_curthing = '';
+ return;
+ }
+ if (strlen($word) && $word{0} == '&') {
+ $word = substr($word, 1);
+ }
+ $this->_curthing .= $word;
+ }
+
+ /**
+ * handle tag contents
+ */
+ function parseCdataHandler($word, $pevent)
+ {
+ if ($this->checkEventPush($word, $pevent)) {
+ $this->_wp->backupPos($word);
+ if (strlen($this->_curthing)) {
+ $this->_addoutput($pevent);
+ }
+ $this->_curthing = '';
+ return;
+ }
+ if ($this->checkEventPop($word, $pevent)) {
+ if (strlen($this->_curthing)) {
+ $this->_addoutput($pevent);
+ }
+ $this->_curthing = '';
+ $this->_event_stack->pushEvent(PHPDOC_XMLTOKEN_EVENT_CLOSETAG);
+ return;
+ }
+ $this->_curthing .= $word;
+ }
+
+ /**#@-*/
+
+ /**
+ * Handler for real character data
+ *
+ * @access protected
+ * @param object XML parser object
+ * @param string CDATA
+ * @return void
+ */
+ function incdataHandler($parser, $cdata)
+ {
+ if ((string)$cdata === '') {
+ return true;
+ }
+
+ $struct = array(
+ "type" => PHPDOC_BEAUTIFIER_CDATA,
+ "data" => $cdata,
+ "depth" => $this->_depth
+ );
+
+ $this->_appendToParent($struct);
+ }
+ /**#@+
+ * Output Methods
+ * @access private
+ */
+ /**
+ * This method adds output to {@link $_line}
+ *
+ * If a string with variables like "$test this" is present, then special
+ * handling is used to allow processing of the variable in context.
+ * @see _flush_save()
+ */
+ function _addoutput($event)
+ {
+ $type =
+ array(
+ PHPDOC_XMLTOKEN_EVENT_NOEVENTS => '_handleXMLDefault',
+ PHPDOC_XMLTOKEN_EVENT_CLOSETAG => 'endHandler',
+ PHPDOC_XMLTOKEN_EVENT_ENTITY => 'entityrefHandler',
+ PHPDOC_XMLTOKEN_EVENT_DEF => '_handleXMLDefault',
+ PHPDOC_XMLTOKEN_EVENT_PI => 'parsePiHandler',
+ PHPDOC_XMLTOKEN_EVENT_XML => '_handleXMLDefault',
+ PHPDOC_XMLTOKEN_EVENT_OPENTAG => 'startHandler',
+ PHPDOC_XMLTOKEN_EVENT_COMMENT => '_handleXMLDefault',
+ PHPDOC_XMLTOKEN_EVENT_CDATA => 'cdataHandler',
+ PHPDOC_XMLTOKEN_EVENT_IN_CDATA => 'incdataHandler',
+ );
+ $method = $type[$event];
+ switch ($event) {
+ case PHPDOC_XMLTOKEN_EVENT_COMMENT :
+// echo "comment: $this->_curthing\n";
+ $this->$method(false, $this->_curthing);
+ break;
+ case PHPDOC_XMLTOKEN_EVENT_OPENTAG :
+// echo "open tag: $this->_tag\n";
+// var_dump($this->_attrs);
+ $this->$method(false, $this->_tag, $this->_attrs);
+ break;
+ case PHPDOC_XMLTOKEN_EVENT_CLOSETAG :
+// echo "close tag: $this->_tag\n";
+ $this->$method(false, $this->_curthing);
+ break;
+ case PHPDOC_XMLTOKEN_EVENT_NOEVENTS :
+ if (!strlen($this->_curthing)) {
+ return;
+ }
+// echo "default: $this->_curthing\n";
+ $this->$method(false, $this->_curthing);
+ break;
+ case PHPDOC_XMLTOKEN_EVENT_DEF :
+// echo "<!definition: $this->_curthing\n";
+ $this->$method(false, $this->_curthing);
+ break;
+ case PHPDOC_XMLTOKEN_EVENT_PI :
+// echo "<?pi: $this->_curthing\n";
+// echo "<?pi attrs: $this->_attrs\n";
+ $this->$method(false, $this->_curthing, $this->_attrs);
+ break;
+ case PHPDOC_XMLTOKEN_EVENT_XML :
+// echo "<?xml: $this->_curthing\n";
+ $this->$method(false, $this->_curthing, $this->_attrs);
+ break;
+ case PHPDOC_XMLTOKEN_EVENT_CDATA :
+ case PHPDOC_XMLTOKEN_EVENT_IN_CDATA :
+// echo "cdata: $this->_curthing\n";
+ $this->$method(false, $this->_curthing);
+ break;
+ case PHPDOC_XMLTOKEN_EVENT_ENTITY :
+// echo "entity: $this->_curthing\n";
+ $this->$method(false, $this->_curthing, false, false, false);
+ break;
+ }
+ }
+ /**#@-*/
+
+ /**
+ * tell the parser's WordParser {@link $wp} to set up tokens to parse words by.
+ * tokens are word separators. In English, a space or punctuation are examples of tokens.
+ * In PHP, a token can be a ;, a parenthesis, or even the word "function"
+ * @param $value integer an event number
+ * @see WordParser
+ */
+
+ function configWordParser($e)
+ {
+ $this->_wp->setSeperator($this->tokens[($e + 100)]);
+ }
+ /**
+ * this function checks whether parameter $word is a token for pushing a new event onto the Event Stack.
+ * @return mixed returns false, or the event number
+ */
+
+ function checkEventPush($word,$pevent)
+ {
+ $e = false;
+ if (isset($this->pushEvent[$pevent]))
+ {
+ if (isset($this->pushEvent[$pevent][strtolower($word)]))
+ $e = $this->pushEvent[$pevent][strtolower($word)];
+ }
+ if ($e)
+ {
+ $this->_event_stack->pushEvent($e);
+ return $e;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * this function checks whether parameter $word is a token for popping the current event off of the Event Stack.
+ * @return mixed returns false, or the event number popped off of the stack
+ */
+
+ function checkEventPop($word,$pevent)
+ {
+ if (!isset($this->popEvent[$pevent])) return false;
+ if (in_array(strtolower($word),$this->popEvent[$pevent]))
+ {
+ return $this->_event_stack->popEvent();
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Initialize all parser state variables
+ * @param boolean true if we are highlighting an inline {@}source} tag's
+ * output
+ * @param false|string name of class we are going to start from
+ * @uses $_wp sets to a new {@link phpDocumentor_HighlightWordParser}
+ */
+ function setupStates($parsedata)
+ {
+ $this->_output = '';
+ $this->_line = '';
+ unset($this->_wp);
+ $this->_wp = new WordParser;
+ $this->_wp->setup($parsedata);
+ $this->_event_stack = @(new EventStack);
+ $this->_event_stack->popEvent();
+ $this->_event_stack->pushEvent(PHPDOC_XMLTOKEN_EVENT_NOEVENTS);
+ $this->_pv_linenum = null;
+ $this->_pv_next_word = false;
+ }
+
+ /**
+ * Initialize the {@link $tokenpushEvent, $wordpushEvent} arrays
+ */
+ function phpDocumentor_XML_Beautifier_Tokenizer()
+ {
+ $this->tokens[STATE_XMLTOKEN_CDATA] =
+ $this->tokens[STATE_XMLTOKEN_NOEVENTS] = array('<?xml', '<!--', '<![CDATA[', '<!', '</', '<?', '<');//, '&');
+ $this->tokens[STATE_XMLTOKEN_OPENTAG] = array("\n","\t"," ", '>', '/>');
+ $this->tokens[STATE_XMLTOKEN_XML] =
+ $this->tokens[STATE_XMLTOKEN_PI] = array("\n","\t"," ", '?>');
+ $this->tokens[STATE_XMLTOKEN_IN_CDATA] = array(']]>');
+ $this->tokens[STATE_XMLTOKEN_CLOSETAG] = array("\n",'>');
+ $this->tokens[STATE_XMLTOKEN_COMMENT] = array("\n",'-->');
+ $this->tokens[STATE_XMLTOKEN_DEF] = array("\n",']>','>');
+ $this->tokens[STATE_XMLTOKEN_ENTITY] = array("\n",';');
+ $this->tokens[STATE_XMLTOKEN_ATTRIBUTE] = array("\n",'"',"'",'>','/>');
+ $this->tokens[STATE_XMLTOKEN_DOUBLEQUOTE] = array("\n",'"');
+ $this->tokens[STATE_XMLTOKEN_SINGLEQUOTE] = array("\n","'");
+/**************************************************************/
+
+ $this->pushEvent[PHPDOC_XMLTOKEN_EVENT_NOEVENTS] =
+ array(
+ '<' => PHPDOC_XMLTOKEN_EVENT_OPENTAG,
+ '<?' => PHPDOC_XMLTOKEN_EVENT_PI,
+ '<?xml' => PHPDOC_XMLTOKEN_EVENT_XML,
+ '</' => PHPDOC_XMLTOKEN_EVENT_CLOSETAG,
+// '&' => PHPDOC_XMLTOKEN_EVENT_ENTITY,
+ '<![cdata[' => PHPDOC_XMLTOKEN_EVENT_IN_CDATA,
+ '<!--' => PHPDOC_XMLTOKEN_EVENT_COMMENT,
+ '<!' => PHPDOC_XMLTOKEN_EVENT_DEF,
+ );
+/**************************************************************/
+
+ $this->pushEvent[PHPDOC_XMLTOKEN_EVENT_OPENTAG] =
+ array(
+ " " => PHPDOC_XMLTOKEN_EVENT_ATTRIBUTE,
+ "\n" => PHPDOC_XMLTOKEN_EVENT_ATTRIBUTE,
+ );
+/**************************************************************/
+
+ $this->pushEvent[PHPDOC_XMLTOKEN_EVENT_ATTRIBUTE] =
+ array(
+ "'" => PHPDOC_XMLTOKEN_EVENT_SINGLEQUOTE,
+ '"' => PHPDOC_XMLTOKEN_EVENT_DOUBLEQUOTE,
+ );
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_IN_CDATA] = array(']]>');
+/**************************************************************/
+
+ $this->pushEvent[PHPDOC_XMLTOKEN_EVENT_CDATA] =
+ array(
+ '<' => PHPDOC_XMLTOKEN_EVENT_OPENTAG,
+ '<?' => PHPDOC_XMLTOKEN_EVENT_PI,
+// '&' => PHPDOC_XMLTOKEN_EVENT_ENTITY,
+ '<!--' => PHPDOC_XMLTOKEN_EVENT_COMMENT,
+ '<!' => PHPDOC_XMLTOKEN_EVENT_DEF,
+ '<![cdata[' => PHPDOC_XMLTOKEN_EVENT_IN_CDATA,
+ );
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_XML] =
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_PI] = array('?>');
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_ENTITY] = array(';');
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_SINGLEQUOTE] = array("'");
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_DOUBLEQUOTE] = array('"');
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_OPENTAG] = array('>', '/>');
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_CLOSETAG] = array('>');
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_COMMENT] = array('-->');
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_DEF] = array('>',']>');
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_ATTRIBUTE] = array('>','/>');
+/**************************************************************/
+
+ $this->popEvent[PHPDOC_XMLTOKEN_EVENT_CDATA] =
+ array('</');
+/**************************************************************/
+ }
+
+ function getParserEventName ($value)
+ {
+ $lookup = array(
+ PHPDOC_XMLTOKEN_EVENT_NOEVENTS => "PHPDOC_XMLTOKEN_EVENT_NOEVENTS",
+ PHPDOC_XMLTOKEN_EVENT_PI => "PHPDOC_XMLTOKEN_EVENT_PI",
+ PHPDOC_XMLTOKEN_EVENT_OPENTAG => "PHPDOC_XMLTOKEN_EVENT_OPENTAG",
+ PHPDOC_XMLTOKEN_EVENT_ATTRIBUTE => "PHPDOC_XMLTOKEN_EVENT_ATTRIBUTE",
+ PHPDOC_XMLTOKEN_EVENT_CLOSETAG => "PHPDOC_XMLTOKEN_EVENT_CLOSETAG",
+ PHPDOC_XMLTOKEN_EVENT_ENTITY => "PHPDOC_XMLTOKEN_EVENT_ENTITY",
+ PHPDOC_XMLTOKEN_EVENT_COMMENT => "PHPDOC_XMLTOKEN_EVENT_COMMENT",
+ PHPDOC_XMLTOKEN_EVENT_SINGLEQUOTE => "PHPDOC_XMLTOKEN_EVENT_SINGLEQUOTE",
+ PHPDOC_XMLTOKEN_EVENT_DOUBLEQUOTE => "PHPDOC_XMLTOKEN_EVENT_DOUBLEQUOTE",
+ PHPDOC_XMLTOKEN_EVENT_CDATA => 'PHPDOC_XMLTOKEN_EVENT_CDATA',
+ PHPDOC_XMLTOKEN_EVENT_DEF => 'PHPDOC_XMLTOKEN_EVENT_DEF',
+ PHPDOC_XMLTOKEN_EVENT_XML => 'PHPDOC_XMLTOKEN_EVENT_XML',
+ PHPDOC_XMLTOKEN_EVENT_IN_CDATA => 'PHPDOC_XMLTOKEN_EVENT_IN_CDATA',
+ );
+ if (isset($lookup[$value]))
+ return $lookup[$value];
+ else return $value;
+ }
+}
+
+
+/** starting state */
+define("PHPDOC_XMLTOKEN_EVENT_NOEVENTS" , 1);
+/** currently in starting state */
+define("STATE_XMLTOKEN_NOEVENTS" , 101);
+
+/** used when a processor instruction is found */
+define("PHPDOC_XMLTOKEN_EVENT_PI" , 2);
+/** currently in processor instruction */
+define("STATE_XMLTOKEN_PI" , 102);
+
+/** used when an open <tag> is found */
+define("PHPDOC_XMLTOKEN_EVENT_OPENTAG" , 3);
+/** currently parsing an open <tag> */
+define("STATE_XMLTOKEN_OPENTAG" , 103);
+
+/** used when a <tag attr="attribute"> is found */
+define("PHPDOC_XMLTOKEN_EVENT_ATTRIBUTE" , 4);
+/** currently parsing an open <tag> */
+define("STATE_XMLTOKEN_ATTRIBUTE" , 104);
+
+/** used when a close </tag> is found */
+define("PHPDOC_XMLTOKEN_EVENT_CLOSETAG" , 5);
+/** currently parsing a close </tag> */
+define("STATE_XMLTOKEN_CLOSETAG" , 105);
+
+/** used when an &entity; is found */
+define("PHPDOC_XMLTOKEN_EVENT_ENTITY" , 6);
+/** currently parsing an &entity; */
+define("STATE_XMLTOKEN_ENTITY" , 106);
+
+/** used when a <!-- comment --> is found */
+define("PHPDOC_XMLTOKEN_EVENT_COMMENT" , 7);
+/** currently parsing a <!-- comment --> */
+define("STATE_XMLTOKEN_COMMENT" , 107);
+
+/** used when a <!-- comment --> is found */
+define("PHPDOC_XMLTOKEN_EVENT_SINGLEQUOTE" , 8);
+/** currently parsing a <!-- comment --> */
+define("STATE_XMLTOKEN_SINGLEQUOTE" , 108);
+
+/** used when a <!-- comment --> is found */
+define("PHPDOC_XMLTOKEN_EVENT_DOUBLEQUOTE" , 9);
+/** currently parsing a <!-- comment --> */
+define("STATE_XMLTOKEN_DOUBLEQUOTE" , 109);
+
+/** used when a <! is found */
+define("PHPDOC_XMLTOKEN_EVENT_DEF" , 10);
+/** currently parsing a <! */
+define("STATE_XMLTOKEN_DEF" , 110);
+
+/** used when a <! is found */
+define("PHPDOC_XMLTOKEN_EVENT_CDATA" , 11);
+/** currently parsing a <! */
+define("STATE_XMLTOKEN_CDATA" , 111);
+
+/** used when a <?xml is found */
+define("PHPDOC_XMLTOKEN_EVENT_XML" , 12);
+/** currently parsing a <?xml */
+define("STATE_XMLTOKEN_XML" , 112);
+
+/** used when a <![CDATA[ section is found */
+define('PHPDOC_XMLTOKEN_EVENT_IN_CDATA', 13);
+/** currently parsing a <![CDATA[ ]]> */
+define('STATE_XMLTOKEN_IN_CDATA', 113);
+
+/** do not remove, needed in plain renderer */
+define('PHPDOC_BEAUTIFIER_CDATA', 100000);
+?>
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/XMLDocBookpeardoc2Converter.inc b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/XMLDocBookpeardoc2Converter.inc
new file mode 100755
index 00000000..f359d7d5
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/XMLDocBookpeardoc2Converter.inc
@@ -0,0 +1,1701 @@
+<?php
+/**
+ * Outputs documentation in XML DocBook format, in the version expected by
+ * pear.php.net's documentation team
+ *
+ * phpDocumentor :: automatic documentation generator
+ *
+ * PHP versions 4 and 5
+ *
+ * Copyright (c) 2002-2006 Gregory Beaver
+ *
+ * LICENSE:
+ *
+ * This library is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General
+ * Public License as published by the Free Software Foundation;
+ * either version 2.1 of the License, or (at your option) any
+ * later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package Converters
+ * @subpackage XMLDocBook
+ * @author Greg Beaver <cellog@php.net>
+ * @copyright 2002-2006 Gregory Beaver
+ * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
+ * @version CVS: $Id: XMLDocBookpeardoc2Converter.inc 234423 2007-04-24 21:32:15Z ashnazg $
+ * @filesource
+ * @link http://www.phpdoc.org
+ * @link http://pear.php.net/PhpDocumentor
+ * @since 1.2
+ */
+/**
+ * XML DocBook converter.
+ * This Converter takes output from the {@link Parser} and converts it to DocBook
+ * output for PEAR documentation.
+ *
+ * This Converter differs from the parent DocBook Converter in that it does not
+ * recognize the possibility of procedural pages or of functions! All functions
+ * must be defined as static methods for namespace purposes. In addition, all
+ * constants and global variables for a package are grouped together as per
+ * peardoc2 requirements. Include statements are not documented. If you want
+ * to document a normal project, don't use the peardoc2 converter, use the
+ * DocBook converter.
+ * @package Converters
+ * @subpackage XMLDocBook
+ * @author Greg Beaver <cellog@php.net>
+ * @since 1.2
+ * @version $Id: XMLDocBookpeardoc2Converter.inc 234423 2007-04-24 21:32:15Z ashnazg $
+ */
+class XMLDocBookpeardoc2Converter extends Converter
+{
+ /**
+ * This converter knows about the new root tree processing
+ * In order to fix PEAR Bug #6389
+ * @var boolean
+ */
+ var $processSpecialRoots = true;
+ /**
+ * XMLDocBookConverter wants elements sorted by type as well as alphabetically
+ * @see Converter::$sort_page_contents_by_type
+ * @var boolean
+ */
+ var $sort_page_contents_by_type = true;
+ /** @var string */
+ var $outputformat = 'XML';
+ /** @var string */
+ var $name = 'DocBook/peardoc2';
+ /**
+ * indexes of elements by package that need to be generated
+ * @var array
+ */
+ var $leftindex = array('classes' => true, 'pages' => false, 'functions' => false, 'defines' => true, 'globals' => true);
+ /**
+ * whether a @see is going to be in the {@link $base_dir}, or in a package/subpackage subdirectory of $base_dir
+ * @var boolean
+ */
+ var $local = true;
+
+ /**
+ * name of current page being converted
+ * @var string
+ */
+ var $page;
+
+ /**
+ * path of current page being converted
+ * @var string
+ */
+ var $path;
+
+ /**
+ * name of current class being converted
+ * @var string
+ */
+ var $class;
+
+ /**
+ * template for the procedural page currently being processed
+ * @var Template
+ */
+ var $page_data;
+
+ /**
+ * output directory for the current procedural page being processed
+ * @var string
+ */
+ var $page_dir;
+
+ /**
+ * Constants, used for constants.tpl
+ * @var array
+ */
+ var $_peardoc2_constants = false;
+
+ /**
+ * Global Variables, used for globals.tpl
+ * @var array
+ */
+ var $_peardoc2_globals = false;
+
+ /**
+ * target directory passed on the command-line.
+ * {@link $targetDir} is malleable, always adding package/ and package/subpackage/ subdirectories onto it.
+ * @var string
+ */
+ var $base_dir;
+
+ /**
+ * output directory for the current class being processed
+ * @var string
+ */
+ var $class_dir;
+
+ /**
+ * template for the class currently being processed
+ * @var Template
+ */
+ var $class_data;
+
+ /**
+ * array of converted package page names.
+ * Used to link to the package page in the left index
+ * @var array Format: array(package => 1)
+ */
+ var $package_pages = array();
+
+ /**
+ * Contents of the packagename.xml file are stored in this template variable
+ * @var Smarty
+ */
+ var $packagexml;
+ /**
+ * controls formatting of parser informative output
+ *
+ * Converter prints:
+ * "Converting /path/to/file.php... Procedural Page Elements... Classes..."
+ * Since HTMLdefaultConverter outputs files while converting, it needs to send a \n to start a new line. However, if there
+ * is more than one class, output is messy, with multiple \n's just between class file output. This variable prevents that
+ * and is purely cosmetic
+ * @var boolean
+ */
+ var $juststarted = false;
+
+ /**
+ * contains all of the template procedural page element loop data needed for the current template
+ * @var array
+ */
+ var $current;
+
+ /**
+ * contains all of the template class element loop data needed for the current template
+ * @var array
+ */
+ var $currentclass;
+
+ /**
+ * Pass elements by package, simplifies generation of package.xml/category.xml
+ */
+ var $sort_absolutely_everything = true;
+ /**
+ * template options. Currently only 1 recognized option usepear
+ *
+ * usepear tells the getLink() function to return a package link to PEAR and PEAR_ERROR if possible, and to link directly
+ * to the fully-delimited link package#class.method or package#file.method in PEAR style, if possible, even if the
+ * package is not parsed. This will allow parsing of separate PEAR packages without parsing the entire thing at once!
+ * @var array
+ */
+ var $template_options = array('usepear' => false);
+
+ var $function_data = array();
+ var $method_data = array();
+ var $_write_constants_xml = array();
+ var $_write_globals_xml = array();
+ var $sourceloc = '';
+ /**
+ * peardoc2 Category
+ * @var string
+ */
+ var $category;
+ /**
+ * Used to re-format output so that it's easy for translators to handle
+ *
+ * @var XML_Beautifier|false
+ * @access private
+ */
+ var $_beautifier = false;
+
+ /**
+ * sets {@link $base_dir} to $targetDir
+ * @see Converter()
+ */
+ function XMLDocBookpeardoc2Converter(&$allp, &$packp, &$classes, &$procpages, $po, $pp, $qm, $targetDir, $templateDir, $title)
+ {
+ if (!class_exists('XML_Beautifier')) {
+ @include_once 'XML/Beautifier.php';
+ }
+ Converter::Converter($allp, $packp, $classes, $procpages,$po, $pp, $qm, $targetDir, $templateDir, $title);
+ if (class_exists('XML_Beautifier')) {
+ require_once 'phpDocumentor/Converters/XML/DocBook/peardoc2/Beautifier.php';
+ $this->_beautifier = new phpDocumentor_peardoc2_XML_Beautifier;
+ $this->_beautifier->setOption('indent', ' ');
+ }
+ $this->base_dir = $targetDir;
+ }
+
+ /**
+ * do that stuff in $template_options
+ */
+ function &getLink($expr, $package = false, $packages = false)
+ {
+ return Converter::getLink($expr, $package, $packages);
+ }
+
+ function unmangle($s,$sourcecode)
+ {
+ return '<programlisting role="php"><![CDATA[
+'.$sourcecode.']]></programlisting>';
+ }
+
+ /**
+ * Writes a file to target dir, beautify any .xml files first
+ * @param string filename
+ * @param string file contents
+ * @param boolean true if the data is binary and not text
+ */
+ function writeFile($file,$data,$binary = false)
+ {
+ if ($this->_beautifier && substr($file, -4) == '.xml') {
+ $ret = $this->_beautifier->formatString($data);
+ if (PEAR::isError($ret)) {
+ addWarning(PDERROR_BEAUTIFYING_FAILED, $ret->getMessage());
+ $ret = $data;
+ }
+ $data = $ret;
+ }
+ return parent::writeFile($file, $data, $binary);
+ }
+
+ /**
+ * Used to convert the {@}example} inline tag in a docblock.
+ *
+ * By default, this just wraps ProgramExample
+ * @see XMLDocBookpeardoc2Converter::exampleProgramExample
+ * @param string
+ * @param boolean true if this is to highlight a tutorial <programlisting>
+ * @return string
+ */
+ function exampleProgramExample($example, $tutorial = false, $inlinesourceparse = null/*false*/,
+ $class = null/*false*/, $linenum = null/*false*/, $filesourcepath = null/*false*/)
+ {
+ return '<example><title>Example</title><programlisting role="php"><![CDATA[' .
+ $example . ']]></programlisting></example>';
+ $this->ProgramExample($example, $tutorial, $inlinesourceparse, $class, $linenum, $filesourcepath)
+ . '</example>';
+ }
+
+ function writeExample($title, $path, $source)
+ {
+ $this->_save_example = array($title, $source);
+ }
+
+ function getExampleLink($unused, $title)
+ {
+ $source = $this->_save_example[1];
+ return '<para><example><title>' . $title . '</title>' . $source . '</example></para>';
+ }
+
+ function type_adjust($typename)
+ {
+ if (isset($this->template_options['typechanging'][trim($typename)]))
+ return $this->template_options['typechanging'][trim($typename)];
+ $a = $this->getLink($typename);
+ if (is_object($a))
+ {
+ if (phpDocumentor_get_class($a) == 'classlink')
+ return '<classname>'.$typename.'</classname>';
+ if (phpDocumentor_get_class($a) == 'functionlink' || phpDocumentor_get_class($a) == 'methodlink')
+ return '<function>'.$typename.'</function>';
+ if (phpDocumentor_get_class($a) == 'definelink')
+ return '<constant>'.$typename.'</constant>';
+ if (phpDocumentor_get_class($a) == 'varlink')
+ return '<varname>'.$typename.'</varname>';
+ }
+ return $typename;
+ }
+
+ /**
+ * Writes out the template file of {@link $class_data} and unsets the template to save memory
+ * @see registerCurrentClass()
+ * @see parent::endClass()
+ * @todo move class summary into an array to be written out at the end
+ * of parsing each package
+ */
+ function endClass()
+ {
+ $a = '../';
+ if (!empty($this->subpackage)) $a .= '../';
+ if ($this->juststarted)
+ {
+ $this->juststarted = false;
+ phpDocumentor_out("\n");
+ flush();
+ }
+ foreach($this->method_data as $func)
+ {
+ $func[0]->assign("phpdocversion",PHPDOCUMENTOR_VER);
+ $func[0]->assign("phpdocwebsite",PHPDOCUMENTOR_WEBSITE);
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->category) . PATH_DELIMITER . strtolower($this->class_dir . PATH_DELIMITER . str_replace(array('_','.'),array('-','--'),$this->class)));
+ $this->writefile(strtolower($func[1] ). '.xml','<!-- $' . "Revision$ -->\n" . $func[0]->fetch('method.tpl'));
+ }
+ // code below is in packagename.xml handling, see Output()
+/* $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->category) . PATH_DELIMITER . strtolower($this->class_dir));
+ $this->writefile(str_replace(array('_','.'),array('-','--'),strtolower($this->class)) . '.xml',$this->class_data->fetch('class.tpl'));*/
+ unset($this->class_data);
+ }
+
+ function addSummaryToPackageXml($template_output)
+ {
+ $this->packagexml->append('ids',$template_output);
+ }
+
+ /**
+ * @param parserClass|false $element is false if this is the end of all conversion
+ */
+ function flushPackageXml($element)
+ {
+ if (isset($this->packagexml))
+ {
+ if (!$element || $element->docblock->package != $this->package) // finished with package
+ {
+ if (isset($this->_write_constants_xml[$this->category][$this->package]) &&
+ $this->_write_constants_xml[$this->category][$this->package])
+ {
+ $this->packagexml->append('ids',
+ '&package.' .
+ strtolower($this->category.'.' .
+ str_replace(array('_','.'),array('-','--'),$this->package).'.constants;'));
+ $this->_write_constants_xml[$this->category][$this->package] = false;
+ }
+ if (isset($this->_write_globals_xml[$this->category][$this->package]) &&
+ $this->_write_globals_xml[$this->category][$this->package])
+ {
+ $this->packagexml->append('ids',
+ '&package.'.strtolower($this->category.'.' .
+ str_replace(array('_','.'),array('-','--'),$this->package).'.globals;'));
+ $this->_write_globals_xml[$this->category][$this->package] = false;
+ }
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . strtolower($this->category));
+ $this->writefile(str_replace('_','-',strtolower($this->package)).'.xml',
+ '<!-- $' . "Revision$ -->\n" . $this->packagexml->fetch('package.tpl'));
+ $this->packagexml->clear_all_assign();
+ if ($element) {
+ $this->packagexml->assign('package',$element->docblock->package);
+ $this->packagexml->assign('ids',array());
+ $this->packagexml->assign('id',$this->getId($element, true));
+ }
+ }
+ } else
+ {
+ $this->packagexml = $this->newSmarty();
+ $this->packagexml->assign('package',$element->docblock->package);
+ $this->packagexml->assign('ids',array());
+ $this->packagexml->assign('id',$this->getId($element, true));
+ }
+ }
+
+ /**
+ * @param string
+ * @param string
+ * @return string <ulink url="'.$link.'">'.$text.'</ulink>
+ */
+ function returnLink($link,$text)
+ {
+ return '<ulink url="'.$link.'">'.$text.'</ulink>';
+ }
+
+ function makeLeft()
+ {
+ }
+
+ /**
+ * Does nothing
+ */
+ function formatPkgIndex()
+ {
+ }
+
+ /**
+ * Does nothing
+ */
+ function formatIndex()
+ {
+ }
+
+ /**
+ * Does nothing
+ */
+ function writeNewPPage($key)
+ {
+ }
+
+ /**
+ * Does nothing
+ */
+ function writeSource()
+ {
+ }
+
+ /**
+ * Creates package/lang/categoryname/packagename.xml for each package
+ */
+ function formatLeftIndex()
+ {
+ $this->makeLeft();
+ }
+
+ /**
+ * This function takes an {@link abstractLink} descendant and returns an html link
+ *
+ * @param abstractLink a descendant of abstractlink should be passed, and never text
+ * @param string text to display in the link
+ * @param boolean this parameter is not used, and is deprecated
+ * @param boolean determines whether the returned text is enclosed in an <link> tag
+ */
+ function returnSee(&$element, $eltext = false, $local = true, $with_a = true)
+ {
+ if (!$element) return false;
+ if (!$eltext)
+ {
+ $eltext = '';
+ switch($element->type)
+ {
+ case 'tutorial' :
+ $eltext = $element->title;
+ break;
+ case 'class' :
+ $eltext = '<classname>'.$element->name.'</classname>';
+ break;
+ case 'method' :
+ $eltext .= '<function>';
+ case 'var' :
+ if ($element->type == 'var') $eltext .= '<varname>';
+ $eltext .= $element->class.'::';
+ case 'page' :
+ case 'define' :
+ if ($element->type == 'define')
+ $eltext .= '<constant>';
+ case 'function' :
+ if ($element->type == 'function')
+ $eltext .= '<function>';
+ case 'global' :
+ default :
+ $eltext .= $element->name;
+ if ($element->type == 'function' || $element->type == 'method') $eltext .= '</function>';
+ if ($element->type == 'var') $eltext .= '</varname>';
+ if ($element->type == 'define') $eltext .= '</constant>';
+ break;
+ }
+ } elseif (!is_object($element)) {
+ return false;
+ } elseif ($element->type == 'method')
+ {
+ $eltext = str_replace($element->name . '()', $element->name, $eltext);
+ }
+
+ if ($element->type == 'page' || $element->type == 'function' || $element->type == 'var')
+ { // we ignore all procedural pages, instead, constant, function and
+ // global variable pages are output
+ return $eltext;
+ }
+ if ($element->type == 'class')
+ {
+ return '<link linkend="'.$this->getId($element).'-summary">'.$eltext.'</link>';
+ }
+ return '<link linkend="'.$this->getId($element).'">'.$eltext.'</link>';
+ }
+
+ /**
+ * Get the id value needed to allow linking
+ * @param mixed descendant of parserElement or parserData/parserPage
+ * @param boolean true to return the id for the package page
+ * @see parserElement, parserData, parserPage
+ * @return string the id value for this element type
+ */
+ function getId(&$el, $returnpackage = false)
+ {
+ if (phpDocumentor_get_class($el) == 'parserdata')
+ {
+ $element = $this->addLink($el->parent);
+ $elp = $el->parent;
+ } elseif (!is_a($el,'abstractlink'))
+ {
+ $elp = $el;
+ $element = $this->addLink($el);
+ } else $element = $el;
+ $a = '';
+ if (!empty($element->subpackage))
+ {
+ $a = str_replace(array('_','.'),array('-','--'),$element->subpackage).'.';
+ }
+ if ($returnpackage) return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package));
+ switch ($element->type)
+ {
+ case 'page' :
+ return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package).'.'.$a.$element->fileAlias);
+ break;
+ case 'define' :
+ return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package).'.constants.details.'.$element->fileAlias);
+ break;
+ case 'global' :
+ return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package).'.globals.details.'.$element->fileAlias);
+ break;
+ case 'class' :
+ return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package).'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name));
+ break;
+ case 'function' :
+ return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package).'.'.$a.$element->fileAlias.'.'.str_replace('_','-',$element->name));
+ break;
+ case 'method' :
+ return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package).'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'.'.str_replace('_','-',$element->name));
+ break;
+ case 'var' :
+ return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package).'.'.$a.str_replace(array('_','.'),array('-','--'),$element->class).'-summary.vars.'.str_replace(array('$','_'),array('var--','-'),$element->name));
+ break;
+ case 'tutorial' :
+ return 'package.'.strtolower($element->category.'.'.str_replace(array('_','.'),array('-','--'),$element->package).'.'.$a.str_replace(array('_','.'),array('-','--'),$element->name)).'-tutorial';
+ break;
+ }
+ }
+
+ /**
+ * Create errors.html template file output
+ *
+ * This method takes all parsing errors and warnings and spits them out ordered by file and line number.
+ * @global ErrorTracker We'll be using it's output facility
+ */
+ function ConvertErrorLog()
+ {
+ global $phpDocumentor_errors;
+ $allfiles = array();
+ $files = array();
+ $warnings = $phpDocumentor_errors->returnWarnings();
+ $errors = $phpDocumentor_errors->returnErrors();
+ $template = &$this->newSmarty();
+ foreach($warnings as $warning)
+ {
+ $file = '##none';
+ $linenum = 'Warning';
+ if ($warning->file)
+ {
+ $file = $warning->file;
+ $allfiles[$file] = 1;
+ $linenum .= ' on line '.$warning->linenum;
+ }
+ $files[$file]['warnings'][] = array('name' => $linenum, 'listing' => $warning->data);
+ }
+ foreach($errors as $error)
+ {
+ $file = '##none';
+ $linenum = 'Error';
+ if ($error->file)
+ {
+ $file = $error->file;
+ $allfiles[$file] = 1;
+ $linenum .= ' on line '.$error->linenum;
+ }
+ $files[$file]['errors'][] = array('name' => $linenum, 'listing' => $error->data);
+ }
+ $i=1;
+ $af = array();
+ foreach($allfiles as $file => $num)
+ {
+ $af[$i++] = $file;
+ }
+ $allfiles = $af;
+ usort($allfiles,'strnatcasecmp');
+ $allfiles[0] = "Post-parsing";
+ foreach($allfiles as $i => $a)
+ {
+ $allfiles[$i] = array('file' => $a);
+ }
+ $out = array();
+ foreach($files as $file => $data)
+ {
+ if ($file == '##none') $file = 'Post-parsing';
+ $out[$file] = $data;
+ }
+ $template->assign("files",$allfiles);
+ $template->assign("all",$out);
+ $template->assign("title","phpDocumentor Parser Errors and Warnings");
+ $this->setTargetDir($this->base_dir);
+ $this->writefile("errors.html",$template->fetch('errors.tpl'));
+ unset($template);
+ phpDocumentor_out("\n\nTo view errors and warnings, look at ".$this->base_dir. PATH_DELIMITER . "errors.html\n");
+ flush();
+ }
+
+ function postProcess($text)
+ {
+ return str_replace("'", '&apos;', htmlentities($text));
+ }
+
+ function prepareDocBlock(&$element, $nopackage = true)
+ {
+ $a = new parserStringWithInlineTags;
+ $a->add('no exceptions thrown');
+ if (!$element->docblock->getKeyword('throws')) $element->docblock->addKeyword('throws',$a);
+ $tags = parent::prepareDocBlock($element,
+ array('staticvar' => 'note','deprec' => 'deprecated',
+ 'abstract' => 'abstract','TODO' => 'note', 'link' => 'see',
+ 'uses' => 'see', 'usedby' => 'see', 'tutorial' => 'see',
+ 'return' => 'returns', 'access' => false), $nopackage);
+ $ret = array();
+ foreach($tags['tags'] as $tag)
+ {
+ if ($tag['keyword'] == 'return')
+ {
+ // hack because stupid Converter isn't doing its job
+ $tag['keyword'] = 'returns';
+ }
+ $ret[$tag['keyword']][] = $tag;
+ }
+ $tags['tags'] = $ret;
+ $tags['sdesc'] = $this->wordwrap($tags['sdesc']);
+ return $tags;
+ }
+
+ function getTutorialId($package,$subpackage,$tutorial,$id,$category)
+ {
+ $subpackage = (empty($subpackage) ? '' : '.'.$subpackage);
+ $id = (empty($id) ? '' : '.'.$id);
+ return 'package.'.strtolower($category.'.'.$package.$subpackage.str_replace(array('_','.'),array('-','--'),$tutorial).$id);
+ }
+
+
+ /**
+ * Retrieve a Converter-specific anchor to a segment of a source code file
+ * parsed via a {@tutorial tags.filesource.pkg} tag.
+ *
+ * NOTE: unused
+ * @param string full path to source file
+ * @param string name of anchor
+ * @param string link text, if this is a link
+ * @param boolean returns either a link or a destination based on this
+ * parameter
+ * @return string link to an anchor, or the anchor
+ */
+ function getSourceAnchor($sourcefile,$anchor,$text = '',$link = false)
+ {
+ return '';
+ }
+
+ function Br($input)
+ {
+ return "$input\n";
+ }
+
+ function getCData($value)
+ {
+ return '<![CDATA['.$value.']]>';
+ }
+
+ function ProgramExample($listing, $tutorial = false, $inlinesourceparse = null/*false*/,
+ $class = null/*false*/, $linenum = null/*false*/, $filesourcepath = null/*false*/, $origsource = null)
+ {
+ if ($origsource !== null) {
+ $listing = $origsource;
+ }
+ if (!tokenizer_ext)
+ {
+ $listing = $this->getCData($listing);
+ }
+ return '<programlisting role="php">' . $this->getCData($listing) . '</programlisting>';
+ }
+
+ /**
+ * Does nothing - use tutorials for DocBook
+ * @param parserPackagePage
+ */
+ function convertPackagePage(&$element)
+ {
+ }
+
+ /**
+ * Convert tutorials for output
+ * @param parserTutorial
+ */
+ function convertTutorial(&$element)
+ {
+ $template = &parent::convertTutorial($element);
+ phpDocumentor_out("\n");
+ flush();
+ $x = $element->Convert($this,false);
+ if ($element->ini)
+ { // add child tutorial list to the tutorial through a slight hack :)
+ $subtutorials = '';
+ $b = '';
+ if (!empty($element->subpackage)) $b = '.'.$element->subpackage;
+ foreach($element->ini['Linked Tutorials'] as $child)
+ {
+ $subtutorials .= ' &'.$element->category.'.'.$element->package.$b.'.'.str_replace(array('_','.'),array('-','--'),$child).'-'.$element->tutorial_type."-tutorial;\n";
+ }
+ $x = str_replace('</refsect1></refentry>','</refsect1>
+ <refsect1>
+ <title>Related Docs</title>
+ <para>
+'.$subtutorials.
+' </para>
+ </refsect1></refentry>',$x);
+ }
+ $template->assign('contents',$x);
+ $contents = $template->fetch('tutorial.tpl');
+ $a = '';
+ if ($element->subpackage) $a = PATH_DELIMITER . $element->subpackage;
+ phpDocumentor_out("\n");
+ flush();
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . str_replace(array('_','.'),array('-','--'),strtolower($element->category))
+ . PATH_DELIMITER . strtolower(str_replace(array('_','.'),array('-','--'),$element->package) . $a));
+ $this->writeFile(str_replace(array('_','.'),array('-','--'),strtolower($element->name)).'-tutorial.xml',
+ '<!-- $' . "Revision$ -->\n" . $contents);
+ }
+
+ /**
+ * Does nothing in this converter
+ * @param parserVar
+ */
+ function convertVar(&$element)
+ {
+ return;
+ $docblock = $this->prepareDocBlock($element);
+ $b = 'mixed';
+ if ($element->docblock->var)
+ {
+ $b = $element->docblock->var->converted_returnType;
+ }
+// var_dump($this->getFormattedOverrides($element));
+ if (isset($this->template_options['separatepage']) && $this->template_options['separatepage'])
+ $this->class_summary->append('vars',array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'var_name' => $this->type_adjust($element->getName()),
+ 'var_default' => htmlspecialchars($element->getValue()),
+ 'var_type' => $b,
+ 'var_overrides' => $this->getFormattedOverrides($element),
+ 'line_number' => $element->getLineNumber(),
+ 'id' => $this->getId($element)));
+ else
+ $this->class_data->append('vars',array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'var_name' => $this->type_adjust($element->getName()),
+ 'var_default' => htmlspecialchars($element->getValue()),
+ 'var_type' => $b,
+ 'var_overrides' => $this->getFormattedOverrides($element),
+ 'line_number' => $element->getLineNumber(),
+ 'id' => $this->getId($element)));
+ }
+
+ /**
+ * Converts class for template output
+ * @param parserClass
+ * @uses flushPackageXml() creates packagename.xml file when all classes in
+ * a package have been converted
+ */
+ function convertClass(&$element)
+ {
+ $this->flushPackageXml($element);
+ parent::convertClass($element);
+ $docblock = $this->prepareDocBlock($element);
+ $this->method_data = array();
+ $this->class_dir = str_replace(array('_','.'),array('-','--'),$element->docblock->package);
+ $this->package = $element->docblock->package;
+ $this->category = strtolower($element->docblock->category);
+ if (!empty($element->docblock->subpackage)) $this->class_dir .= PATH_DELIMITER . $element->docblock->subpackage;
+ $docblock = $this->prepareDocBlock($element,false);
+ $this->class_data->assign("sdesc",$docblock['sdesc']);
+ $this->class_data->assign("desc",$docblock['desc']);
+ $this->class_data->assign("tags",$docblock['tags']);
+
+ $this->class_data->assign("source_location",$element->getSourceLocation($this,$this->template_options['usepear']));
+ $this->class_data->assign("id",$this->getId($element));
+ $this->class_data->assign("method_ids",array());
+ $this->left[$this->package][] = array('link' => $this->getId($element).'-summary');
+ if ($t = $element->getTutorial())
+ {
+ $this->class_data->append("method_ids",$this->getId($t));
+ }
+
+ if (isset($this->template_options['separatepage']) && $this->template_options['separatepage'])
+ {
+ $this->class_summary = &$this->newSmarty(true);
+ if ($t = $element->getTutorial())
+ {
+ $this->class_summary->assign("tutorial",$this->returnSee($t));
+ }
+
+ $this->class_summary->assign("class_name",$this->type_adjust($element->getName()));
+ $this->class_summary->assign("sdesc",$docblock['sdesc']);
+ $this->class_summary->assign("desc",$docblock['desc']);
+ $this->class_summary->assign("tags",$docblock['tags']);
+ $this->class_summary->assign("vars",array());
+ $this->class_summary->assign("methods",array());
+ $this->class_summary->assign("package",$element->docblock->package);
+
+ $this->class_summary->assign("children", $this->generateChildClassList($element));
+ $this->class_summary->assign("class_tree", $this->generateFormattedClassTree($element));
+ $this->class_summary->assign("conflicts", $this->getFormattedConflicts($element,"classes"));
+
+ $this->class_summary->assign("source_location",$element->getSourceLocation($this,$this->template_options['usepear']));
+ $this->class_summary->assign("id",$this->getId($element).'-summary');
+ $this->class_data->append("method_ids",$this->getId($element).'.'.strtolower(str_replace('_','-',$element->getName())).'-summary');
+ $inherited_methods = $this->getFormattedInheritedMethods($element);
+ if (!empty($inherited_methods))
+ {
+ $this->class_summary->assign("imethods",$inherited_methods);
+ }
+ $inherited_vars = $this->getFormattedInheritedVars($element);
+ // variables are irrelevant in peardoc2
+ if (false)//!empty($inherited_vars))
+ {
+ $this->class_summary->assign("ivars",$inherited_vars);
+ }
+ $this->addSummaryToPackageXml($this->class_summary->fetch('class_summary.tpl'));
+ }
+ $this->sourceloc = $element->getSourceLocation($this,$this->template_options['usepear']);
+ }
+
+ /**
+ * Converts method for template output
+ * @see prepareDocBlock(), parserMethod::getFunctionCall(), getFormattedDescMethods(), getFormattedOverrides()
+ * @param parserMethod
+ */
+ function convertMethod(&$element)
+ {
+ $docblock = $this->prepareDocBlock($element);
+ $returntype = 'void';
+ if ($element->docblock->return)
+ {
+ $a = $element->docblock->return->Convert($this);
+ $returntype = $element->docblock->return->converted_returnType;
+ if ($returntype != $element->docblock->return->returnType)
+ {
+ $returntype = "<replaceable>$returntype</replaceable>";
+ }
+ }
+ $params = array();
+ if (count($element->docblock->params))
+ foreach($element->docblock->params as $param => $val)
+ {
+ $a = $val->Convert($this);
+ $b = explode(' ',$a);
+ $c = '';
+ foreach($b as $blah) {
+ if (!empty($c)) {
+ $c .= ' ';
+ }
+ $c .= str_replace(array('true', 'false', 'null'), array('&true;', '&false;', '&null;'), $blah);
+ }
+ $params[$param] = array("var" => $param,"datatype" => str_replace(array('true', 'false', 'null'), array('&true;', '&false;', '&null;'),
+ $val->returnType), "cdatatype" => $val->converted_returnType,"data" => $this->wordwrap($c));
+ }
+
+ $call = $element->getIntricateFunctionCall($this, $params);
+ if (isset($call['params']))
+ {
+ foreach($call['params'] as $i => $param)
+ {
+ if (!is_string($call['params'][$i]['default']))
+ {
+ continue;
+ }
+ $call['params'][$i]['default'] = str_replace(array('true', 'false', 'null'), array('&true;', '&false;', '&null;'), $param['default']);
+ }
+ }
+ $this->packagexml->append('ids','&'.$this->getId($element).';');
+ $this->class_data->append('method_ids',$this->getId($element));
+ $this->class_summary->append('methods',array('id' => $this->getId($element),
+ 'sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'is_constructor' => $element->isConstructor,
+ 'function_name' => $element->getName(),
+ 'function_return' => $returntype,
+ 'function_call' => $call,
+ 'descmethod' => $this->getFormattedDescMethods($element),
+ 'method_overrides' => $this->getFormattedOverrides($element),
+ 'line_number' => $element->getLineNumber(),
+ 'params' => $params));
+ $this->method_data[$i = count($this->method_data) - 1][0] = &$this->newSmarty(true);
+ $this->method_data[$i][1] = str_replace(array('_','.'),array('-','--'),$element->getName());
+ $this->method_data[$i][0]->assign('class',$this->class);
+ $this->method_data[$i][0]->assign('source_location',$this->returnSee($this->getLink(basename($this->curpage->getFile())),$this->sourceloc));
+ $this->method_data[$i][0]->assign('sdesc',$docblock['sdesc']);
+ $this->method_data[$i][0]->assign('desc',$docblock['desc']);
+ $this->method_data[$i][0]->assign('tags',$docblock['tags']);
+ $this->method_data[$i][0]->assign('function_name',$element->getName());
+ $this->method_data[$i][0]->assign('function_return',$returntype);
+ $this->method_data[$i][0]->assign('function_call',$call);
+ $this->method_data[$i][0]->assign('descmethod',$this->getFormattedDescMethods($element));
+ $this->method_data[$i][0]->assign('method_overrides',$this->getFormattedOverrides($element));
+ $this->method_data[$i][0]->assign('params',$params);
+ $this->method_data[$i][0]->assign('id',$this->getId($element));
+ }
+
+ /**
+ * Converts function for template output - does nothing in peardoc2!
+ * @param parserFunction
+ */
+ function convertFunction(&$element)
+ {
+/* parent::convertFunction($element);
+ $docblock = $this->prepareDocBlock($element);
+ $fname = $element->getName();
+ $params = array();
+ if (count($element->docblock->params))
+ foreach($element->docblock->params as $param => $val)
+ {
+ $a = $val->Convert($this);
+ $params[$param] = array("var" => $param,"datatype" => $val->converted_returnType,"data" => $a);
+ }
+ $returntype = 'void';
+ if ($element->docblock->return)
+ {
+ $a = $element->docblock->return->Convert($this);
+ $returntype = $element->docblock->return->converted_returnType;
+ }
+
+ $this->page_data->append("function_ids",$this->getId($element));
+ $this->page_summary->append("function_ids",$this->getId($element));
+ $this->page_summary->append('functions',array('id' => $this->getId($element),
+ 'sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'function_name' => $element->getName(),
+ 'line_number' => $element->getLineNumber(),
+ 'function_return' => $returntype,
+ 'function_call' => $element->getIntricateFunctionCall($this,$params),
+ 'function_conflicts' => $this->getFormattedConflicts($element,'functions'),
+ 'params' => $params));
+ $this->function_data[$i = count($this->function_data) - 1][0] = $this->newSmarty(true);
+ $this->function_data[$i][1] = $element->getName();
+ $this->function_data[$i][0]->assign('sdesc',$docblock['sdesc']);
+ $this->function_data[$i][0]->assign('desc',$docblock['desc']);
+ $this->function_data[$i][0]->assign('tags',$docblock['tags']);
+ $this->function_data[$i][0]->assign('function_name',$fname);
+ $this->function_data[$i][0]->assign('line_number',$element->getLineNumber());
+ $this->function_data[$i][0]->assign('function_return',$returntype);
+ $this->function_data[$i][0]->assign('function_call',$element->getIntricateFunctionCall($this,$params));
+ $this->function_data[$i][0]->assign('function_conflicts',$this->getFormattedConflicts($element,"functions"));
+ $this->function_data[$i][0]->assign('params',$params);
+ $this->function_data[$i][0]->assign('source_location',$this->returnSee($this->getLink(basename($this->curpage->getFile())),$this->sourceloc));
+ $this->function_data[$i][0]->assign('id',$this->getId($element));*/
+ }
+
+ /**
+ * Converts include elements for template output
+ *
+ * Completely ignored by this converter
+ * @param parserInclude
+ */
+ function convertInclude(&$element)
+ {
+/* parent::convertInclude($element, array('include_file' => '-'.strtr($element->getValue(),array('"' => '', "'" => '','.' => '-'))));
+ $docblock = $this->prepareDocBlock($element);
+ $per = $this->getIncludeValue($element->getValue(), $element->getPath());
+ $this->page_summary->append('includes',array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'utags' => $docblock['utags'],
+ 'include_name' => $element->getName(),
+ 'include_value' => $per,
+ 'line_number' => $element->getLineNumber(),
+ 'include_file' => '-'.strtr($element->getValue(),array('"' => '', "'" => '','.' => '-'))));*/
+ }
+
+ /**
+ * Converts defines for template output
+ * @see prepareDocBlock(), getFormattedConflicts()
+ * @param parserDefine
+ */
+ function convertDefine(&$element)
+ {
+ $docblock = $this->prepareDocBlock($element);
+ $this->_appendDefines(array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'name' => $this->postProcess($element->getName()),
+ 'value' => $this->postProcess($element->getValue()),
+ 'conflicts' => $this->getFormattedConflicts($element,"defines"),
+ 'line_number' => $element->getLineNumber(),
+ 'id' => $this->getId($element)));
+ }
+
+ /**
+ * Append the constant information to the Smarty information
+ *
+ * Uses category, package, and current file to organize constants defined
+ * in a package for the constants.xml output file
+ * @param array
+ * @uses $_peardoc2_constants appends $define to them
+ * @access private
+ */
+ function _appendDefines($define)
+ {
+ if (!isset($this->_peardoc2_constants[$this->category][$this->package][$this->sourceloc]))
+ {
+ $this->_peardoc2_constants[$this->category][$this->package][$this->sourceloc]['name'] =
+ $this->sourceloc;
+ $this->_peardoc2_constants[$this->category][$this->package][$this->sourceloc]['page'] =
+ $this->page;
+ }
+ $this->_write_constants_xml[$this->category][$this->package] = true;
+ $this->_peardoc2_constants[$this->category][$this->package][$this->sourceloc]['defines'][] = $define;
+ }
+
+ /**
+ * Converts global variables for template output
+ * @param parserGlobal
+ * @see prepareDocBlock(), getFormattedConflicts()
+ */
+ function convertGlobal(&$element)
+ {
+ $docblock = $this->prepareDocBlock($element);
+ $value = $this->getGlobalValue($element->getValue());
+ if ($value == $element->getValue())
+ {
+ $value = $this->ProgramExample($value);
+ } else
+ {
+ $value = $this->getGlobalValue('<![CDATA[' .$element->getValue() . ']]>');
+ }
+ $this->_appendGlobals(array('sdesc' => $docblock['sdesc'],
+ 'desc' => $docblock['desc'],
+ 'tags' => $docblock['tags'],
+ 'name' => $this->postProcess($element->getName()),
+ 'link' => $element->getName(),
+ 'value' => $value,
+ 'type' => $element->getDataType($this),
+ 'line_number' => $element->getLineNumber(),
+ 'conflicts' => $this->getFormattedConflicts($element,"global variables"),
+ 'id' => $this->getId($element)));
+ }
+
+ /**
+ * Append the global variable information to the Smarty information
+ *
+ * Uses category, package, and current file to organize globals defined
+ * in a package for the globals.xml output file
+ * @param array
+ * @uses $_peardoc2_globals appends $global to them
+ * @access private
+ */
+ function _appendGlobals($global)
+ {
+ if (!isset($this->_peardoc2_globals[$this->category][$this->package][$this->sourceloc]))
+ {
+ $this->_peardoc2_globals[$this->category][$this->package][$this->sourceloc]['name'] =
+ $this->sourceloc;
+ $this->_peardoc2_globals[$this->category][$this->package][$this->sourceloc]['page'] =
+ $this->page;
+ }
+ $this->_write_globals_xml[$this->category][$this->package] = true;
+ $this->_peardoc2_globals[$this->category][$this->package][$this->sourceloc]['globals'][] = $global;
+ }
+
+ /**
+ * converts procedural pages for template output
+ * @see prepareDocBlock(), getClassesOnPage()
+ * @param parserData
+ */
+ function convertPage(&$element)
+ {
+ parent::convertPage($element);
+ $this->juststarted = true;
+ $this->page_dir = $element->parent->package;
+ $this->page = $this->getPageName($element->parent);
+ $this->category = strtolower($element->parent->category);
+ $this->sourceloc = $element->parent->getSourceLocation($this,true);
+ if (!empty($element->parent->subpackage)) $this->page_dir .= PATH_DELIMITER . $element->parent->subpackage;
+ // registering stuff on the template
+ }
+
+ function getPageName(&$element)
+ {
+ return str_replace(array('/','_','.'),array('-','-','---'),$element->getSourceLocation($this,true));
+ }
+
+ /**
+ * returns an array containing the class inheritance tree from the root object to the class
+ *
+ * @param parserClass class variable
+ * @return array Format: array(root,child,child,child,...,$class)
+ * @uses parserClass::getParentClassTree()
+ */
+
+ function generateFormattedClassTree($class)
+ {
+ $tree = $class->getParentClassTree($this);
+ $out = '';
+ if (count($tree) - 1)
+ {
+ $result = array($class->getName());
+ $parent = $tree[$class->getName()];
+ while ($parent)
+ {
+ if (is_string($parent)) {
+ $result[] = $parent;
+ break;
+ }
+ $subpackage = $parent->docblock->subpackage;
+ $package = $parent->docblock->package;
+ $x = $parent;
+ if (is_object($parent))
+ $x = $parent->getLink($this);
+ if (!$x) $x = $parent->getName();
+ $result[] =
+ $x;
+ if (is_object($parent))
+ $parent = $tree[$parent->getName()];
+ elseif (isset($tree[$parent]))
+ $parent = $tree[$parent];
+ }
+ return array_reverse($result);
+ } else
+ {
+ return array($class->getName());
+ }
+ }
+
+ /**
+ * returns a list of child classes
+ *
+ * @param parserClass class variable
+ * @uses parserClass::getChildClassList()
+ */
+
+ function generateChildClassList($class)
+ {
+ $kids = $class->getChildClassList($this);
+ $list = array();
+ if (count($kids))
+ {
+ for($i=0; $i<count($kids); $i++)
+ {
+ $lt['link'] = '<link linkend="'.$this->getId($kids[$i]) . '-summary">'. $kids[$i]->getName().'</link>';
+ $lt['sdesc'] = $kids[$i]->docblock->getSDesc($this);
+ $list[] = $lt;
+ }
+ } else return false;
+ return $list;
+ }
+
+ /** @access private */
+ function sortVar($a, $b)
+ {
+ return strnatcasecmp($a->getName(),$b->getName());
+ }
+
+ /** @access private */
+ function sortMethod($a, $b)
+ {
+ if ($a->isConstructor) return -1;
+ if ($b->isConstructor) return 1;
+ return strnatcasecmp($a->getName(),$b->getName());
+ }
+
+ /**
+ * returns a template-enabled array of class trees
+ *
+ * @param string $package package to generate a class tree for
+ * @see $roots, HTMLConverter::getRootTree()
+ */
+ function generateFormattedClassTrees($package)
+ {
+ if (!isset($this->roots['normal'][$package]) &&
+ !isset($this->roots['special'][$package])) {
+ return array();
+ }
+ $trees = array();
+ if (isset($this->roots['normal'][$package])) {
+ $roots = $this->roots['normal'][$package];
+ for($i=0;$i<count($roots);$i++)
+ {
+ $root = $this->classes->getClassByPackage($roots[$i], $package);
+ if ($root && $root->isInterface()) {
+ continue;
+ }
+ $trees[] = array('class' => $roots[$i],'class_tree' => "<ul>\n".$this->getRootTree($this->getSortedClassTreeFromClass($roots[$i],$package,''),$package)."</ul>\n");
+ }
+ }
+ if (isset($this->roots['special'][$package])) {
+ $roots = $this->roots['special'][$package];
+ foreach ($roots as $parent => $classes) {
+ $thistree = '';
+ foreach ($classes as $classinfo) {
+ $root = $this->classes->getClassByPackage($classinfo, $package);
+ if ($root && $root->isInterface()) {
+ continue;
+ }
+ $thistree .=
+ $this->getRootTree(
+ $this->getSortedClassTreeFromClass(
+ $classinfo,
+ $package,
+ ''),
+ $package,
+ true);
+ }
+ if (!$thistree) {
+ continue;
+ }
+ $trees[] = array(
+ 'class' => $parent,
+ 'class_tree' => "<ul>\n" . $thistree . "</ul>\n"
+ );
+ }
+ }
+ return $trees;
+ }
+
+ /**
+ * returns a template-enabled array of interface inheritance trees
+ *
+ * @param string $package package to generate a class tree for
+ * @see $roots, HTMLConverter::getRootTree()
+ */
+ function generateFormattedInterfaceTrees($package)
+ {
+ if (!isset($this->roots['normal'][$package]) &&
+ !isset($this->roots['special'][$package])) {
+ return array();
+ }
+ $trees = array();
+ if (isset($this->roots['normal'][$package])) {
+ $roots = $this->roots['normal'][$package];
+ for($i=0;$i<count($roots);$i++)
+ {
+ $root = $this->classes->getClassByPackage($roots[$i], $package);
+ if ($root && !$root->isInterface()) {
+ continue;
+ }
+ $trees[] = array('class' => $roots[$i],'class_tree' => "<ul>\n".$this->getRootTree($this->getSortedClassTreeFromClass($roots[$i],$package,''),$package)."</ul>\n");
+ }
+ }
+ if (isset($this->roots['special'][$package])) {
+ $roots = $this->roots['special'][$package];
+ foreach ($roots as $parent => $classes) {
+ $thistree = '';
+ foreach ($classes as $classinfo) {
+ $root = $this->classes->getClassByPackage($classinfo, $package);
+ if ($root && !$root->isInterface()) {
+ continue;
+ }
+ $thistree .=
+ $this->getRootTree(
+ $this->getSortedClassTreeFromClass(
+ $classinfo,
+ $package,
+ ''),
+ $package,
+ true);
+ }
+ if (!$thistree) {
+ continue;
+ }
+ $trees[] = array(
+ 'class' => $parent,
+ 'class_tree' => "<ul>\n" . $thistree . "</ul>\n"
+ );
+ }
+ }
+ return $trees;
+ }
+
+ /**
+ * return formatted class tree for the Class Trees page
+ *
+ * @param array $tree output from {@link getSortedClassTreeFromClass()}
+ * @param string $package package
+ * @param boolean $nounknownparent if true, an object's parent will not be checked
+ * @see Classes::$definitechild, generateFormattedClassTrees()
+ * @return string
+ */
+ function getRootTree($tree, $package, $noparent = false)
+ {
+ if (!$tree) return '';
+ $my_tree = '';
+ $cur = '#root';
+ $lastcur = array(false);
+ $kids = array();
+ $dopar = false;
+ if (!$noparent && $tree[$cur]['parent'])
+ {
+ $dopar = true;
+ if (!is_object($tree[$cur]['parent']))
+ {
+// debug("parent ".$tree[$cur]['parent']." not found");
+ $my_tree .= '<listitem>' . $tree[$cur]['parent'] .'<itemizedlist>';
+ }
+ else
+ {
+// debug("parent ".$this->returnSee($tree[$cur]['parent'], false, false)." in other package");
+ $my_tree .= '<listitem>' . $this->returnSee($tree[$cur]['parent'], false, false);
+ if ($tree[$cur]['parent']->package != $package) $my_tree .= ' <emphasis>(Different package)</emphasis><itemizedlist>';
+ }
+ }
+ do
+ {
+// fancy_debug($cur,$lastcur,$kids);
+ if (count($tree[$cur]['children']))
+ {
+// debug("$cur has children");
+ if (!isset($kids[$cur]))
+ {
+// debug("set $cur kids");
+ $kids[$cur] = 1;
+ $my_tree .= '<listitem>'.$this->returnSee($tree[$cur]['link'], false, false);
+ $my_tree .= '<itemizedlist>'."\n";
+ }
+ array_push($lastcur,$cur);
+ list(,$cur) = each($tree[$cur]['children']);
+// var_dump('listed',$cur);
+ if ($cur)
+ {
+ $cur = $cur['package'] . '#' . $cur['class'];
+// debug("set cur to child $cur");
+// $my_tree .= '<li>'.$this->returnSee($tree[$cur]['link'], false, false);
+ continue;
+ } else
+ {
+// debug("end of children for $cur");
+ $cur = array_pop($lastcur);
+ $cur = array_pop($lastcur);
+ $my_tree .= '</itemizedlist></listitem>'."\n";
+ if ($dopar && ($cur == '#root' || !$cur)) $my_tree .= '</itemizedlist></listitem>';
+ }
+ } else
+ {
+// debug("$cur has no children");
+ $my_tree .= '<listitem>'.$this->returnSee($tree[$cur]['link'], false, false)."</listitem>";
+ if ($dopar && $cur == '#root') $my_tree .= '</itemizedlist></listitem>';
+ $cur = array_pop($lastcur);
+ }
+ } while ($cur);
+ return $my_tree;
+ }
+ /**
+ * does nothing
+ */
+ function generateElementIndex()
+ {
+ }
+
+ function setTemplateDir($dir)
+ {
+ Converter::setTemplateDir($dir);
+ $this->smarty_dir = $this->templateDir;
+ }
+
+ /**
+ * Generate alphabetical index of all elements by package and subpackage
+ *
+ * @param string $package name of a package
+ * @see $pkg_elements, walk(), generatePkgElementIndexes()
+ */
+ function generatePkgElementIndex($package)
+ {
+ }
+
+ /**
+ *
+ * @see generatePkgElementIndex()
+ */
+ function generatePkgElementIndexes()
+ {
+ }
+
+ /**
+ * @param string name of class
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the class's documentation
+ * @see parent::getClassLink()
+ */
+ function getClassLink($expr,$package, $file = false,$text = false, $local = true, $with_a = true)
+ {
+ $a = Converter::getClassLink($expr,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local, $with_a);
+ }
+
+ /**
+ * @param string name of function
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the function's documentation
+ * @see parent::getFunctionLink()
+ */
+ function getFunctionLink($expr,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getFunctionLink($expr,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of define
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the define's documentation
+ * @see parent::getDefineLink()
+ */
+ function getDefineLink($expr,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getDefineLink($expr,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of global variable
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the global variable's documentation
+ * @see parent::getGlobalLink()
+ */
+ function getGlobalLink($expr,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getGlobalLink($expr,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of procedural page
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the procedural page's documentation
+ * @see parent::getPageLink()
+ */
+ function getPageLink($expr,$package, $path = false,$text = false, $local = true)
+ {
+ $a = Converter::getPageLink($expr,$package,$path);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of method
+ * @param string class containing method
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the method's documentation
+ * @see parent::getMethodLink()
+ */
+ function getMethodLink($expr,$class,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getMethodLink($expr,$class,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * @param string name of var
+ * @param string class containing var
+ * @param string package name
+ * @param string full path to look in (used in index generation)
+ * @param boolean deprecated
+ * @param boolean return just the URL, or enclose it in an html a tag
+ * @return mixed false if not found, or an html a link to the var's documentation
+ * @see parent::getVarLink()
+ */
+ function getVarLink($expr,$class,$package, $file = false,$text = false, $local = true)
+ {
+ $a = Converter::getVarLink($expr,$class,$package,$file);
+ if (!$a) return false;
+ return $this->returnSee($a, $text, $local);
+ }
+
+ /**
+ * does a nat case sort on the specified second level value of the array
+ *
+ * @param mixed $a
+ * @param mixed $b
+ * @return int
+ */
+ function rcNatCmp ($a, $b)
+ {
+ $aa = strtoupper($a[$this->rcnatcmpkey]);
+ $bb = strtoupper($b[$this->rcnatcmpkey]);
+
+ return strnatcasecmp($aa, $bb);
+ }
+
+ /**
+ * does a nat case sort on the specified second level value of the array.
+ * this one puts constructors first
+ *
+ * @param mixed $a
+ * @param mixed $b
+ * @return int
+ */
+ function rcNatCmp1 ($a, $b)
+ {
+ $aa = strtoupper($a[$this->rcnatcmpkey]);
+ $bb = strtoupper($b[$this->rcnatcmpkey]);
+
+ if (strpos($aa,'CONSTRUCTOR') === 0)
+ {
+ return -1;
+ }
+ if (strpos($bb,'CONSTRUCTOR') === 0)
+ {
+ return 1;
+ }
+ if (strpos($aa,strtoupper($this->class)) === 0)
+ {
+ return -1;
+ }
+ if (strpos($bb,strtoupper($this->class)) === 0)
+ {
+ return -1;
+ }
+ return strnatcasecmp($aa, $bb);
+ }
+
+ function wordwrap($string)
+ {
+ return wordwrap($string);
+ }
+
+ /**
+ * Generate the constants.xml, packagename.xml, and globals.xml files
+ */
+ function Output()
+ {
+ $this->flushPackageXml(false);
+ $templ = &$this->newSmarty();
+ $categories = array();
+ $packages = array_flip($this->all_packages);
+ foreach($this->packagecategories as $package => $category)
+ {
+ $categories[$category]['package.'.$category.'.'.str_replace('_','-',strtolower($package ))] = 1;
+ if (isset($packages[$package])) unset($packages[$package]);
+ }
+ $category = $GLOBALS['phpDocumentor_DefaultCategoryName'];
+ foreach($packages as $package)
+ {
+ $categories[$category]['package.'.$category.'.'.str_replace('_','-',strtolower($package ))] = 1;
+ }
+ foreach($categories as $category => $ids)
+ {
+ $templ->assign('id','package.'.$category);
+ $templ->assign('ids',array());
+ $templ->assign('category',$category);
+ $this->setTargetDir($this->base_dir);
+ if (file_exists($this->base_dir . PATH_DELIMITER . strtolower($category ) . '.xml'))
+ {
+ $contents = @file($this->base_dir . PATH_DELIMITER . strtolower($category ) . '.xml');
+ if (is_array($contents))
+ {
+ $found = false;
+ foreach($contents as $i => $line)
+ {
+ $line = trim($line);
+ if (strlen($line) && $line{0} == '&')
+ {
+ $found = $i;
+ if (in_array(str_replace(array ('&', ';'), array ('', ''), trim($line )), array_keys($ids )))
+ {
+ unset($ids[str_replace(array('&', ';'), array('', ''), trim($line))]);
+ }
+ }
+ if ($found !== false && (!strlen($line) || $line{0} != '&'))
+ {
+ break;
+ }
+ }
+ $newids = array();
+ foreach($ids as $id => $unll)
+ {
+ $newids[] = ' &' . $id . ";\n";
+ }
+ $newcontents = array_merge(array_slice($contents, 0, $i), $newids);
+ $newcontents = array_merge($newcontents, array_slice($contents, $i));
+ }
+ $categorycontents = implode($newcontents, '');
+ } else
+ {
+ foreach($ids as $id => $unll)
+ {
+ if (!in_array($id, $templ->_tpl_vars['ids']))
+ {
+ $templ->append('ids',$id);
+ }
+ }
+ $categorycontents = '<!-- $' . "Revision$ -->\n" . $templ->fetch('category.tpl');
+ }
+ $this->writefile(strtolower($category) . '.xml',
+ $categorycontents);
+ phpDocumentor_out("\n");
+ flush();
+ }
+ $my = &$this->newSmarty();
+ if ($this->_peardoc2_constants)
+ {
+ foreach($this->_peardoc2_constants as $category => $r)
+ {
+ foreach($r as $package => $s)
+ {
+ $my->assign('id','package.'.strtolower($category.'.'.str_replace('_','-',strtolower($package ))).'.constants');
+ $my->assign('package',$package);
+ $defines = array();
+ foreach($s as $file => $t)
+ {
+ $arr = array();
+ $arr['name'] = $file;
+ $arr['page'] = strtolower($t['page']);
+ $arr['defines'] = $t['defines'];
+ $defines[] = $arr;
+ }
+ $my->assign('defines',$defines);
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . $category
+ . PATH_DELIMITER . strtolower(str_replace('_','-',strtolower($package ))));
+ $this->writefile('constants.xml',
+ '<!-- $' . "Revision$ -->\n" . $my->fetch('constants.tpl'));
+ $my->clear_all_assign();
+ }
+ }
+ $this->_peardoc2_constants = false;
+ }
+ if ($this->_peardoc2_globals)
+ {
+ foreach($this->_peardoc2_globals as $category => $r)
+ {
+ foreach($r as $package => $s)
+ {
+ $my->assign('id','package.'.strtolower($category.'.'.str_replace('_','-',strtolower($package ))).'.globals');
+ $my->assign('package',$package);
+ $defines = array();
+ foreach($s as $file => $t)
+ {
+ $arr = array();
+ $arr['name'] = $file;
+ $arr['page'] = strtolower($t['page']);
+ $arr['globals'] = $t['globals'];
+ $defines[] = $arr;
+ }
+ $my->assign('globals',$defines);
+ $this->setTargetDir($this->base_dir . PATH_DELIMITER . $category
+ . PATH_DELIMITER . strtolower(str_replace('_','-',strtolower($package ))));
+ $this->writefile('globals.xml',
+ '<!-- $' . "Revision$ -->\n" . $my->fetch('globals.tpl'));
+ $my->clear_all_assign();
+ }
+ }
+ $this->_peardoc2_globals = false;
+ }
+ }
+}
+?>
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/options.ini b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/options.ini
new file mode 100755
index 00000000..cdb08f38
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/options.ini
@@ -0,0 +1,39 @@
+;; XML DocBook peardoc2 options
+usepear = true
+
+;; preserve package page docbook tags that don't have an entry in the ppage section
+;; we preserve every tag, as this is how it works
+;; this is after all a docbook converter!
+preservedocbooktags = true
+
+;; separate file for class and page docblocks and minor details (variables, globals, defines)
+separatepage = true
+
+[typechanging]
+true = &true;
+false = &false;
+null = &null;
+
+[desctranslate]
+ul = "\n<itemizedlist>"
+/ul = "</itemizedlist>\n"
+ol = "\n<orderedlist>"
+/ol = "</orderedlist>\n"
+li = "\n<listitem><para>"
+/li = "</para></listitem>\n"
+code = <programlisting role="php-highlighted">
+/code = "</programlisting>\n"
+pre = <![CDATA[
+/pre = ]]>
+p = <para>
+/p = "</para>\n"
+b = <emphasis>
+/b = </emphasis>
+i = <important>
+/i = </important>
+var = <varname>
+/var = </varname>
+kbd = <screen>
+/kbd = </screen>
+samp = <example>
+/samp = "</example>\n"
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/category.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/category.tpl
new file mode 100755
index 00000000..7c95b11e
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/category.tpl
@@ -0,0 +1,26 @@
+<chapter id="{$id}">
+<title>{$category}</title>
+{section name=ids loop=$ids}
+&{$ids[ids]};
+{/section}
+</chapter>
+<!-- Generated by phpDocumentor v {$phpdocversion} {$phpdocwebsite} -->
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+--> \ No newline at end of file
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/class.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/class.tpl
new file mode 100755
index 00000000..72b9fea2
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/class.tpl
@@ -0,0 +1,29 @@
+<refentry id="{$id}">
+ <refnamediv>
+ <refname>{$class_name}</refname>
+ <refpurpose>{$classname}</refpurpose>
+ </refnamediv>
+{section name=methods loop=$method_ids}
+&{$method_ids[methods]};
+{/section}
+</refentry>
+<!-- Generated by phpDocumentor v {$phpdocversion} {$phpdocwebsite} -->
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+--> \ No newline at end of file
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/class_summary.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/class_summary.tpl
new file mode 100755
index 00000000..03b42703
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/class_summary.tpl
@@ -0,0 +1,53 @@
+<refentry id="{$id}">
+ <refnamediv>
+ <refname>Class Summary {$class_name}</refname>
+ <refpurpose>{$sdesc}</refpurpose>
+ </refnamediv>
+<refsect1>
+ <title>{$sdesc}</title>
+ {$desc|default:"&notdocumented;"}
+</refsect1>
+<refsect1>
+<title>Class Trees for {$class_name}</title>
+ <para>
+ {section name=tree loop=$class_tree}
+ {section name=mine loop=$class_tree[tree]} {/section}<itemizedlist>
+ {section name=mine loop=$class_tree[tree]} {/section} <listitem><para>
+ {section name=mine loop=$class_tree[tree]} {/section} {$class_tree[tree]}
+ {/section}
+ {section name=tree loop=$class_tree}
+ {section name=mine loop=$class_tree[tree]} {/section}</para></listitem>
+ </itemizedlist>
+ {/section}
+ </para>
+{if $children}
+ <para>
+ <table>
+ <title>Classes that extend {$class_name}</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Class</entry>
+ <entry>Summary</entry>
+ </row>
+ </thead>
+ <tbody>
+{section name=kids loop=$children}
+ <row>
+ <entry>{$children[kids].link}</entry>
+ <entry>{$children[kids].sdesc}</entry>
+ </row>
+{/section}
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+{/if}
+{if $imethods}
+ <para>
+ {$class_name} Inherited Methods
+ </para>
+{include file="imethods.tpl" ivars=$ivars}
+{/if}
+</refsect1>
+</refentry>
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/constants.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/constants.tpl
new file mode 100755
index 00000000..24588e88
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/constants.tpl
@@ -0,0 +1,68 @@
+<refentry id="{$id}">
+ <refnamediv>
+ <refname>Package {$package} Constants</refname>
+ <refpurpose>Constants defined in and used by {$package}</refpurpose>
+ </refnamediv>
+ <refsect1 id="{$id}.details">
+ <title>All Constants</title>
+{section name=files loop=$defines}
+ <refsect2 id="{$id}.details.{$defines[files].page}">
+ <title>
+ Constants defined in {$defines[files].name}
+ </title>
+ <para>
+ <table>
+ <title>Constants defined in {$defines[files].name}</title>
+{section name=d loop=$defines[files].defines}
+{if $defines[files].defines[d].conflicts}{assign var="defineconflict" value=true}{/if}
+{/section}
+ <tgroup cols="{if $defineconflict}4{else}3{/if}">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Value</entry>
+ <entry>Line Number</entry>
+{if $defineconflict}
+ <entry>Conflicts with other packages</entry>
+{/if}
+ </row>
+ </thead>
+ <tbody>
+{section name=d loop=$defines[files].defines}
+ <row>
+ <entry>{$defines[files].defines[d].name}</entry>
+ <entry>{$defines[files].defines[d].value}</entry>
+ <entry>{$defines[files].defines[d].line_number}</entry>
+{if $defineconflict}
+ <entry>{$defines[files].defines[d].conflicts}</entry>
+{/if}
+ </row>
+{/section}
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ </refsect2>
+{/section}
+ </refsect1>
+</refentry>
+<!-- Generated by phpDocumentor v {$phpdocversion} {$phpdocwebsite} -->
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/docblock.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/docblock.tpl
new file mode 100755
index 00000000..ab140b3b
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/docblock.tpl
@@ -0,0 +1,116 @@
+{if $var}
+{assign var="num" value="refsect3"}
+{else}
+{assign var="num" value="refsect1"}
+{/if}
+ <{$num} id="{$id}.desc">
+ &title.desc;
+{if $line_number}
+ <simpara>
+ Source on line #: {if $class_slink}{$class_slink}{else}{$line_number}{/if}
+ </simpara>
+{/if}
+{if $var}
+ <simpara>
+ {$sdesc|default:"&notdocumented;"}
+ </simpara>
+{/if}
+{if $desc}
+ {$desc}
+{else}
+{if $var && $sdesc}
+{else}
+ &notdocumented;
+{/if}
+{/if}
+ </{$num}>
+{if $params}
+ <{$num} id="{$id}.param">
+ &title.param;
+ <para>
+{section name=params loop=$params}
+ <variablelist>
+ <varlistentry>
+ <term>
+ {assign var="temp" value=$params[params].name}
+ {if strpos($params[params].type, '|') ||
+ strpos($cparams.$temp.cdatatype, '>')}
+ <type>{$params[params].type}</type>
+ {else}
+ {if $params[params].type == 'integer'}
+ {assign var="paramtype" value="int"}
+ {elseif $params[params].type == 'boolean'}
+ {assign var="paramtype" value="bool"}
+ {else}
+ {assign var="paramtype" value=$params[params].type}
+ {/if}
+ {if in_array($paramtype, array('bool', 'int', 'float', 'string', 'mixed', 'object', 'resource', 'array', 'res'))}
+ &type.{$paramtype};
+ {else}
+ <type>{$paramtype}</type>
+ {/if}
+ {/if}
+ <parameter>{$params[params].name|replace:"&":"&amp;"}</parameter>
+ </term>
+ <listitem>
+ <para>
+ {$params[params].description}
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+{/section}
+ </para>
+ </{$num}>
+{/if}
+{foreach from=$tags item="tag" key="tagname"}
+{if $tagname != 'static' && $tagname != 'author' && $tagname != 'version' && $tagname != 'copyright' && $tagname != 'package' && $tagname != 'subpackage' && $tagname != 'example'}
+ <{$num} id="{$id}.{$tagname}">
+ &title.{$tagname};
+ {section name=t loop=$tag}
+ <para>
+ <emphasis>{$tag[t].keyword}</emphasis> {$tag[t].data}
+ </para>
+ {/section}
+ </{$num}>
+{elseif $tagname == 'deprecated'}
+ <{$num} id="{$id}.{$tagname}">
+ &title.note;
+ &note.deprecated;
+ {section name=t loop=$tag}
+ <para>
+ {$tag[t].data}
+ </para>
+ {/section}
+ </{$num}>
+{elseif $tagname == 'static'}
+{assign var="canstatic" value=true}
+{elseif $tagname == 'example'}
+ <{$num} id="{$id}.{$tagname}">
+ <title>Examples</title>
+ {section name=t loop=$tag}
+ {$tag[t].data}
+ {/section}
+ </{$num}>
+{elseif $tagname != 'package' && $tagname != 'subpackage'}
+ <{$num} id="{$id}.{$tagname}">
+ <title>{$tagname}</title>{* <-- need language snippets support for phpDocumentor, will use this instead *}
+ {section name=t loop=$tag}
+ <para>
+ <emphasis>{$tagname}</emphasis> {$tag[t].data}
+ </para>
+ {/section}
+ </{$num}>
+{/if}
+{/foreach}
+{if $canstatic}
+ <{$num} id="{$id}.note">
+ &title.note;
+ &note.canstatic;
+ </{$num}>
+{else}
+ <{$num} id="{$id}.note">
+ &title.note;
+ &note.notstatic;
+ </{$num}>
+{/if}
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/errors.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/errors.tpl
new file mode 100644
index 00000000..0f526584
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/errors.tpl
@@ -0,0 +1,21 @@
+{include file="header.tpl" noleftindex=true}
+{section name=files loop=$files}
+<a href="#{$files[files].file}">{$files[files].file}</a><br>
+{/section}
+{foreach key=file item=issues from=$all}
+<a name="{$file}"></a>
+<h1>{$file}</h1>
+{if count($issues.warnings)}
+<h2>Warnings:</h2><br>
+{section name=warnings loop=$issues.warnings}
+<b>{$issues.warnings[warnings].name}</b> - {$issues.warnings[warnings].listing}<br>
+{/section}
+{/if}
+{if count($issues.errors)}
+<h2>Errors:</h2><br>
+{section name=errors loop=$issues.errors}
+<b>{$issues.errors[errors].name}</b> - {$issues.errors[errors].listing}<br>
+{/section}
+{/if}
+{/foreach}
+{include file="footer.tpl"}
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/globals.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/globals.tpl
new file mode 100755
index 00000000..7392d87a
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/globals.tpl
@@ -0,0 +1,69 @@
+<refentry id="{$id}">
+ <refnamediv>
+ <refname>Package {$package} Global Variables</refname>
+ <refpurpose>Global Variables defined in and used by {$package}</refpurpose>
+ </refnamediv>
+ <refsect1 id="{$id}.details">
+ <title>All Global Variables</title>
+{section name=files loop=$globals}
+ <refsect2 id="{$id}.details.{$globals[files].page}">
+ <title>
+ Global Variables defined in {$globals[files].name}
+ </title>
+ <para>
+ <table>
+ <title>Global Variables defined in {$globals[files].name}</title>
+{section name=d loop=$globals[files].globals}
+{if $globals[files].globals[d].conflicts}{assign var="globalconflict" value=true}{/if}
+{/section}
+ <tgroup cols="{if $globalconflict}4{else}3{/if}">
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Value</entry>
+ <entry>Line Number</entry>
+{if $globalconflict}
+ <entry>Conflicts with other packages</entry>
+{/if}
+ </row>
+ </thead>
+ <tbody>
+{section name=d loop=$globals}
+ <row>
+
+<entry>{$globals[files].globals[d].name}</entry>
+ <entry>{$globals[files].globals[d].value}</entry>
+ <entry>{$globals[files].globals[d].line_number}</entry>
+{if $globalconflict}
+ <entry>{$globals[files].globals[d].conflicts}</entry>
+{/if}
+ </row>
+{/section}
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ </refsect2>
+{/section}
+ </refsect1>
+</refentry>
+<!-- Generated by phpDocumentor v {$phpdocversion} {$phpdocwebsite} -->
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/imethods.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/imethods.tpl
new file mode 100755
index 00000000..c0be1bf7
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/imethods.tpl
@@ -0,0 +1,24 @@
+ <para>
+{section name=classes loop=$imethods}
+ <table>
+ <title>Inherited from {$imethods[classes].parent_class}</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Method Name</entry>
+ <entry>Summary</entry>
+ </row>
+ </thead>
+ <tbody>
+{section name=m loop=$imethods[classes].imethods}
+ <row>
+ <entry>{if $imethods[classes].imethods[m].constructor} Constructor{/if} {$imethods[classes].imethods[m].link}</entry>
+ <entry>{$imethods[classes].imethods[m].sdesc|default:"&notdocumented;"}</entry>
+ </row>
+{/section}
+ </tbody>
+ </tgroup>
+ </table>
+{/section}
+ </para>
+
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/ivars.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/ivars.tpl
new file mode 100755
index 00000000..3b9eecf9
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/ivars.tpl
@@ -0,0 +1,26 @@
+ <para>
+{section name=classes loop=$ivars}
+ <table>
+ <title>Inherited from {$ivars[classes].parent_class}</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Variable Name</entry>
+ <entry>Summary</entry>
+ <entry>Default Value</entry>
+ </row>
+ </thead>
+ <tbody>
+{section name=m loop=$ivars[classes].ivars}
+ <row>
+ <entry>{if $ivars[classes].ivars[m].constructor} Constructor{/if} {$ivars[classes].ivars[m].link}</entry>
+ <entry>{$ivars[classes].ivars[m].sdesc|default:"&notdocumented;"}</entry>
+ <entry>{$ivars[classes].ivars[m].default|default:"&null;"}</entry>
+ </row>
+{/section}
+ </tbody>
+ </tgroup>
+ </table>
+{/section}
+ </para>
+
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/method.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/method.tpl
new file mode 100755
index 00000000..fc53f5dc
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/method.tpl
@@ -0,0 +1,45 @@
+<refentry id="{$id}">
+ <refnamediv>
+ <refname>{if $function_call.constructor}constructor {/if}<function>{$class}::{$function_name}</function></refname>
+ <refpurpose>{$sdesc|default:$function_name}</refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <funcsynopsis>
+ <funcsynopsisinfo>
+ require_once &apos;{$source_location}&apos;;
+ </funcsynopsisinfo>
+ <funcprototype>
+ <funcdef>{$function_return}{if $function_call.returnsref}&amp;{/if}
+ {if $function_call.constructor}constructor {/if}<function>{$class}::{$function_name}</function></funcdef>
+{if count($function_call.params)}
+{section name=params loop=$function_call.params}
+ <paramdef>{if @strpos('>',$function_call.params[params].type)}<replaceable>{/if}{$function_call.params[params].type}{if @strpos('>',$function_call.params[params].type)}</replaceable>{/if} <parameter>{if $function_call.params[params].hasdefault} <optional>{/if}{$function_call.params[params].name|replace:"&":"&amp;"}{if $function_call.params[params].hasdefault} = {$function_call.params[params].default}</optional>{/if}</parameter></paramdef>
+{/section}
+{else}
+<paramdef></paramdef>
+{/if}
+ </funcprototype>
+ </funcsynopsis>
+ </refsynopsisdiv>
+{include file="docblock.tpl" cparams=$params params=$function_call.params desc=$desc tags=$tags}
+</refentry>
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+-->
+
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/package.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/package.tpl
new file mode 100755
index 00000000..5b6bfc1c
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/package.tpl
@@ -0,0 +1,26 @@
+<sect1 id="{$id}">
+<title>{$package}</title>
+{section name=ids loop=$ids}
+{$ids[ids]}
+{/section}
+</sect1>
+<!-- Generated by phpDocumentor v {$phpdocversion} {$phpdocwebsite} -->
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+--> \ No newline at end of file
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/tutorial.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/tutorial.tpl
new file mode 100755
index 00000000..e2cb70c4
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/tutorial.tpl
@@ -0,0 +1,21 @@
+{$contents}
+<!-- Generated by phpDocumentor v {$phpdocversion} {$phpdocwebsite} -->
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+--> \ No newline at end of file
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/var.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/var.tpl
new file mode 100755
index 00000000..0d490e46
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/peardoc2/templates/default/templates/var.tpl
@@ -0,0 +1,15 @@
+ <refsect1 id="{$my_id}.vars">
+ <title>Class Variables</title>
+{section name=var loop=$vars}
+ <refsect2 id="{$vars[vars].id}">
+ <title>{$vars[var].var_type} {$vars[var].var_name}{if $vars[var].default} = {$vars[var].var_default}{/if}</title>
+
+{section name=v loop=$vars[var].var_overrides}
+ <para>
+ <emphasis>Overrides {$vars[var].var_overrides[v].link}</emphasis>{if $vars[var].var_overrides[v].sdesc}: {$vars[var].var_overrides[v].sdesc|default:""}{/if}
+ </para>
+{/section}
+{include file="docblock.tpl" var=true desc=$vars[var].desc sdesc=$vars[var].sdesc tags=$vars[var].tags line_number=$line_number id=$vars[var].id}
+ </refsect2>
+{/section}
+ </refsect1>
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/class_summary.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/class_summary.tpl
new file mode 100755
index 00000000..ca8210a7
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/class_summary.tpl
@@ -0,0 +1,93 @@
+<!-- $Revision: 1.1 $ -->
+<refentry id="{$id}">
+ <refnamediv>
+ <refname>Class {$class_name} Summary</refname>
+ <refpurpose>{$sdesc|default:"&notdocumented"}</refpurpose>
+ </refnamediv>
+{include file="docblock.tpl" desc=$desc tags=$tags line_number=$line_number params=false}
+{include file="var.tpl" vars=$vars my_id=$id}
+ <refsect1 id="{$id}.heritage">
+ <title>
+ Heritage for {$class_name}
+ </title>
+ <refsect2 id="{$id}.heritage.class-trees">
+ <title>
+ Class Trees for {$class_name}
+ </title>
+ <para>
+ {section name=tree loop=$class_tree}
+ {section name=mine loop=$class_tree[tree]} {/section}<itemizedlist>
+ {section name=mine loop=$class_tree[tree]} {/section} <listitem>
+ {section name=mine loop=$class_tree[tree]} {/section} {$class_tree[tree]}
+ {/section}
+ {section name=tree loop=$class_tree}
+ {section name=mine loop=$class_tree[tree]} {/section}</listitem>
+ </itemizedlist>
+ {/section}
+ </para>
+ </refsect2>
+{if $children}
+ <refsect2 id="{$id}.heritage.child-classes">
+ <title>
+ Classes that extend {$class_name}
+ </title>
+ <para>
+ <table>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Class</entry>
+ <entry>Summary</entry>
+ </row>
+ </thead>
+ <tbody>
+{section name=kids loop=$children}
+ <row>
+ <entry>{$children[kids].link}</entry>
+ <entry>{$children[kids].sdesc}</entry>
+ </row>
+{/section}
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ </refsect2>
+{/if}
+{if $imethods}
+ <refsect2 id="{$id}.heritage.inherited-methods">
+ <title>
+ {$class_name} Inherited Methods
+ </title>
+{include file="imethods.tpl" ivars=$ivars}
+ </refsect2>
+{/if}
+{if $ivars}
+ <refsect2 id="{$id}.heritage.inherited-vars">
+ <title>
+ {$class_name} Inherited Variables
+ </title>
+{include file="ivars.tpl" ivars=$ivars}
+ </refsect2>
+{/if}
+ </refsect1>
+</refentry>
+<!-- Generated by phpDocumentor v {$phpdocversion} {$phpdocwebsite} -->
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+--> \ No newline at end of file
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/ivars.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/ivars.tpl
new file mode 100755
index 00000000..3b9eecf9
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/ivars.tpl
@@ -0,0 +1,26 @@
+ <para>
+{section name=classes loop=$ivars}
+ <table>
+ <title>Inherited from {$ivars[classes].parent_class}</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Variable Name</entry>
+ <entry>Summary</entry>
+ <entry>Default Value</entry>
+ </row>
+ </thead>
+ <tbody>
+{section name=m loop=$ivars[classes].ivars}
+ <row>
+ <entry>{if $ivars[classes].ivars[m].constructor} Constructor{/if} {$ivars[classes].ivars[m].link}</entry>
+ <entry>{$ivars[classes].ivars[m].sdesc|default:"&notdocumented;"}</entry>
+ <entry>{$ivars[classes].ivars[m].default|default:"&null;"}</entry>
+ </row>
+{/section}
+ </tbody>
+ </tgroup>
+ </table>
+{/section}
+ </para>
+
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/tutorial.tpl b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/tutorial.tpl
new file mode 100755
index 00000000..e2cb70c4
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Converters/XML/DocBook/templates/peardoc2/templates/tutorial.tpl
@@ -0,0 +1,21 @@
+{$contents}
+<!-- Generated by phpDocumentor v {$phpdocversion} {$phpdocwebsite} -->
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
+--> \ No newline at end of file